IKVM11  11
Java SE 11 Virtual Machine for .NET
Loading...
Searching...
No Matches
IKVM.Runtime.ByteCodeHelper Class Reference

Public Types

enum  MapFlags { None = 0 , NoRemapping = 1 , Unused = 2 }
 

Static Public Member Functions

static object multianewarray (RuntimeTypeHandle typeHandle, int[] lengths)
 
static object multianewarray_ghost (RuntimeTypeHandle typeHandle, int[] lengths)
 
static T[] anewarray_ghost< T > (int length, RuntimeTypeHandle typeHandle)
 
static object DynamicMultianewarray (int[] lengths, global::java.lang.Class clazz)
 
static object DynamicNewarray (int length, global::java.lang.Class clazz)
 
static void DynamicAastore (object arrayref, int index, object val)
 
static object DynamicAaload (object arrayref, int index)
 
static void DynamicNewCheckOnly (global::java.lang.Class clazz)
 
static global::java.lang.Class DynamicClassLiteral (string clazz, ikvm. @internal.CallerID callerId)
 
static object DynamicCast (object obj, global::java.lang.Class clazz)
 
static bool DynamicInstanceOf (object obj, global::java.lang.Class clazz)
 
static global::java.lang.invoke.MethodType DynamicLoadMethodType (ref global::java.lang.invoke.MethodType cache, string sig, ikvm. @internal.CallerID callerID)
 
static global::java.lang.invoke.MethodHandle DynamicLoadMethodHandle (ref global::java.lang.invoke.MethodHandle cache, int kind, string clazz, string name, string sig, ikvm. @internal.CallerID callerID)
 
static T DynamicBinderMemberLookup< T > (int kind, string clazz, string name, string sig, ikvm. @internal.CallerID callerID)
 
static Delegate DynamicCreateDelegate (object obj, Type delegateType, string name, string sig)
 
static global::java.lang.invoke.MethodHandle DynamicEraseInvokeExact (global::java.lang.invoke.MethodHandle mh, global::java.lang.invoke.MethodType expected, global::java.lang.invoke.MethodType target)
 
static int f2i (float f)
 
static long f2l (float f)
 
static int d2i (double d)
 
static long d2l (double d)
 
static object GetClassFromTypeHandle (RuntimeTypeHandle typeHandle)
 
static void arraycopy (object src, int srcStart, object dest, int destStart, int len)
 
static void arraycopy_fast (Array src, int srcStart, Array dest, int destStart, int len)
 
static void arraycopy_primitive_8 (Array src, int srcStart, Array dest, int destStart, int len)
 
static void arraycopy_primitive_4 (Array src, int srcStart, Array dest, int destStart, int len)
 
static void arraycopy_primitive_2 (Array src, int srcStart, Array dest, int destStart, int len)
 
static void arraycopy_primitive_1 (Array src, int srcStart, Array dest, int destStart, int len)
 
static void VerboseCastFailure (RuntimeTypeHandle typeHandle, object obj)
 
static bool SkipFinalizer ()
 Returns true if the Java finalizer should be skipped.
 
static bool SkipFinalizer (object o)
 Returns true if the Java finalizer for the given object should be skipped.
 
static bool VolatileRead (ref bool location)
 Implements a volatile read against a reference to a bool. In Java, a volatile operation is atomic.
 
static void VolatileWrite (ref bool location, bool value)
 Implements a volatile write against a reference to a bool. In Java, a volatile operation is atomic.
 
static byte VolatileRead (ref byte location)
 Implements a volatile read against a reference to a byte. In Java, a volatile operation is atomic.
 
static void VolatileWrite (ref byte location, byte value)
 Implements a volatile write against a reference to a byte. In Java, a volatile operation is atomic.
 
static char VolatileRead (ref char location)
 Implements a volatile read against a reference to a char. In Java, a volatile operation is atomic.
 
static void VolatileWrite (ref char location, char value)
 Implements a volatile write against a reference to a char. In Java, a volatile operation is atomic.
 
static short VolatileRead (ref short location)
 Implements a volatile read against a reference to a short. In Java, a volatile operation is atomic.
 
static void VolatileWrite (ref short location, short value)
 Implements a volatile write against a reference to a short. In Java, a volatile operation is atomic.
 
static int VolatileRead (ref int location)
 Implements a volatile read against a reference to a int. In Java, a volatile operation is atomic.
 
static void VolatileWrite (ref int location, int value)
 Implements a volatile write against a reference to a int. In Java, a volatile operation is atomic.
 
static long VolatileRead (ref long location)
 Implements a volatile read against a reference to a long. In Java, a volatile operation is atomic.
 
static void VolatileWrite (ref long location, long value)
 Implements a volatile write against a reference to a long. In Java, a volatile operation is atomic.
 
static float VolatileRead (ref float location)
 Implements a volatile read against a reference to a float. In Java, a volatile operation is atomic.
 
static void VolatileWrite (ref float location, float value)
 Implements a volatile write against a reference to a float. In Java, a volatile operation is atomic.
 
static double VolatileRead (ref double location)
 Implements a volatile read against a reference to a double. In Java, a volatile operation is atomic.
 
static void VolatileWrite (ref double location, double value)
 Implements a volatile write against a reference to a double. In Java, a volatile operation is atomic.
 
static bool CompareAndSwap (ref object location, object expected, object value)
 Implements the compare and swap operation against a reference to an object.
 
static bool CompareAndSwap (ref int location, int expected, int value)
 Implements the compare and swap operation against a reference to an int.
 
static bool CompareAndSwap (ref long location, long expected, long value)
 Implements a compare and swap operation against a reference to a long.
 
static bool CompareAndSwap (ref double location, double expected, double value)
 Implements a compare and swap operation against a reference to a double.
 
static void InitializeModule (Module module)
 Invoked by exported assemblies.
 
static T GetDotNetEnumField< T > (string name)
 
static T MapException< T > (Exception x, MapFlags mode)
 
static Exception DynamicMapException (Exception x, MapFlags mode, global::java.lang.Class exceptionClass)
 
static T GetDelegateForInvokeExact< T > (object methodHandle)
 
static T GetDelegateForInvoke< T > (object methodHandle, object realType, ref InvokeCache< T > cache)
 
static T GetDelegateForInvokeBasic< T > (global::java.lang.invoke.MethodHandle h)
 
static global::java.lang.invoke.MethodType LoadMethodType< T > ()
 
static void LinkIndyCallSite< T > (ref IndyCallSite< T > site, global::java.lang.invoke.CallSite cs, Exception x)
 
static void DynamicLinkIndyCallSite< T > (ref IndyCallSite< T > site, global::java.lang.invoke.CallSite cs, Exception x, string signature, ikvm. @internal.CallerID callerID)
 

Detailed Description

Definition at line 53 of file ByteCodeHelper.cs.

Member Enumeration Documentation

◆ MapFlags

Enumerator
None 
NoRemapping 
Unused 

Definition at line 1305 of file ByteCodeHelper.cs.

Member Function Documentation

◆ anewarray_ghost< T >()

static T[] IKVM.Runtime.ByteCodeHelper.anewarray_ghost< T > ( int length,
RuntimeTypeHandle typeHandle )
static

Definition at line 114 of file ByteCodeHelper.cs.

115 {
116 var obj = new T[length];
117 GhostTag.SetTag(obj, typeHandle);
118 return obj;
119 }

◆ arraycopy()

static void IKVM.Runtime.ByteCodeHelper.arraycopy ( object src,
int srcStart,
object dest,
int destStart,
int len )
static

Definition at line 549 of file ByteCodeHelper.cs.

550 {
551#if FIRST_PASS
552 throw new NotImplementedException();
553#else
554 // If the two arrays are the same, we can use the fast path, but we're also required to do so,
555 // to get the required memmove semantics.
556 if (src == dest)
557 {
558 try
559 {
560 arraycopy_fast((Array)src, srcStart, (Array)dest, destStart, len);
561 return;
562 }
563 catch (InvalidCastException)
564 {
565 throw new global::java.lang.ArrayStoreException();
566 }
567 }
568 else if (src == null || dest == null)
569 {
570 throw new global::java.lang.NullPointerException();
571 }
572 else if (len < 0)
573 {
574 throw new global::java.lang.ArrayIndexOutOfBoundsException();
575 }
576 else
577 {
578 if (src is object[] src1 && dest is object[] dst1)
579 {
580 // for small copies, don't bother comparing the types as this is relatively expensive
581 if (len > 100 && src.GetType() == dest.GetType())
582 {
583 arraycopy_fast(src1, srcStart, dst1, destStart, len);
584 return;
585 }
586 else
587 {
588 for (; len > 0; len--)
589 {
590 // NOTE we don't need to catch ArrayTypeMismatchException & IndexOutOfRangeException, because
591 // they automatically get converted to the Java equivalents anyway.
592 dst1[destStart++] = src1[srcStart++];
593 }
594
595 return;
596 }
597 }
598 else if (src.GetType() != dest.GetType() && (IsPrimitiveArrayType(src.GetType()) || IsPrimitiveArrayType(dest.GetType())))
599 {
600 // we don't want to allow copying a primitive into an object array!
601 throw new global::java.lang.ArrayStoreException();
602 }
603 else
604 {
605 try
606 {
607 arraycopy_fast((Array)src, srcStart, (Array)dest, destStart, len);
608 return;
609 }
610 catch (InvalidCastException)
611 {
612 throw new global::java.lang.ArrayStoreException();
613 }
614 }
615 }
616#endif
617 }
static void arraycopy_fast(Array src, int srcStart, Array dest, int destStart, int len)

◆ arraycopy_fast()

static void IKVM.Runtime.ByteCodeHelper.arraycopy_fast ( Array src,
int srcStart,
Array dest,
int destStart,
int len )
static

Definition at line 629 of file ByteCodeHelper.cs.

630 {
631#if FIRST_PASS
632 throw new NotImplementedException();
633#else
634 try
635 {
636 Array.Copy(src, srcStart, dest, destStart, len);
637 }
638 catch (ArgumentNullException)
639 {
640 throw new global::java.lang.NullPointerException();
641 }
642 catch (ArgumentException)
643 {
644 throw new global::java.lang.ArrayIndexOutOfBoundsException();
645 }
646#endif
647 }

◆ arraycopy_primitive_1()

static void IKVM.Runtime.ByteCodeHelper.arraycopy_primitive_1 ( Array src,
int srcStart,
Array dest,
int destStart,
int len )
static

Definition at line 737 of file ByteCodeHelper.cs.

738 {
739#if FIRST_PASS
740 throw new NotImplementedException();
741#else
742 try
743 {
744 Buffer.BlockCopy(src, srcStart, dest, destStart, len);
745 return;
746 }
747 catch (ArgumentNullException)
748 {
749 throw new global::java.lang.NullPointerException();
750 }
751 catch (OverflowException)
752 {
753 throw new global::java.lang.ArrayIndexOutOfBoundsException();
754 }
755 catch (ArgumentException)
756 {
757 throw new global::java.lang.ArrayIndexOutOfBoundsException();
758 }
759#endif
760 }

◆ arraycopy_primitive_2()

static void IKVM.Runtime.ByteCodeHelper.arraycopy_primitive_2 ( Array src,
int srcStart,
Array dest,
int destStart,
int len )
static

Definition at line 708 of file ByteCodeHelper.cs.

709 {
710#if FIRST_PASS
711 throw new NotImplementedException();
712#else
713 try
714 {
715 checked
716 {
717 Buffer.BlockCopy(src, srcStart * 2, dest, destStart * 2, len * 2);
718 return;
719 }
720 }
721 catch (ArgumentNullException)
722 {
723 throw new global::java.lang.NullPointerException();
724 }
725 catch (OverflowException)
726 {
727 throw new global::java.lang.ArrayIndexOutOfBoundsException();
728 }
729 catch (ArgumentException)
730 {
731 throw new global::java.lang.ArrayIndexOutOfBoundsException();
732 }
733#endif
734 }

◆ arraycopy_primitive_4()

static void IKVM.Runtime.ByteCodeHelper.arraycopy_primitive_4 ( Array src,
int srcStart,
Array dest,
int destStart,
int len )
static

Definition at line 679 of file ByteCodeHelper.cs.

680 {
681#if FIRST_PASS
682 throw new NotImplementedException();
683#else
684 try
685 {
686 checked
687 {
688 Buffer.BlockCopy(src, srcStart * 4, dest, destStart * 4, len * 4);
689 return;
690 }
691 }
692 catch (ArgumentNullException)
693 {
694 throw new global::java.lang.NullPointerException();
695 }
696 catch (OverflowException)
697 {
698 throw new global::java.lang.ArrayIndexOutOfBoundsException();
699 }
700 catch (ArgumentException)
701 {
702 throw new global::java.lang.ArrayIndexOutOfBoundsException();
703 }
704#endif
705 }

◆ arraycopy_primitive_8()

static void IKVM.Runtime.ByteCodeHelper.arraycopy_primitive_8 ( Array src,
int srcStart,
Array dest,
int destStart,
int len )
static

Definition at line 650 of file ByteCodeHelper.cs.

651 {
652#if FIRST_PASS
653 throw new NotImplementedException();
654#else
655 try
656 {
657 checked
658 {
659 Buffer.BlockCopy(src, srcStart * 8, dest, destStart * 8, len * 8);
660 return;
661 }
662 }
663 catch (ArgumentNullException)
664 {
665 throw new global::java.lang.NullPointerException();
666 }
667 catch (OverflowException)
668 {
669 throw new global::java.lang.ArrayIndexOutOfBoundsException();
670 }
671 catch (ArgumentException)
672 {
673 throw new global::java.lang.ArrayIndexOutOfBoundsException();
674 }
675#endif
676 }

◆ CompareAndSwap() [1/4]

static bool IKVM.Runtime.ByteCodeHelper.CompareAndSwap ( ref double location,
double expected,
double value )
static

Implements a compare and swap operation against a reference to a double.

Parameters
location
expected
value
Returns

Definition at line 1241 of file ByteCodeHelper.cs.

1242 {
1243#if FIRST_PASS || IMPORTER || EXPORTER
1244 throw new NotImplementedException();
1245#else
1246 try
1247 {
1248 return Interlocked.CompareExchange(ref location, value, expected) == expected;
1249 }
1250 catch (SEHException)
1251 {
1252 throw new global::java.lang.InternalError();
1253 }
1254#endif
1255 }
System.Threading.Interlocked Interlocked

◆ CompareAndSwap() [2/4]

static bool IKVM.Runtime.ByteCodeHelper.CompareAndSwap ( ref int location,
int expected,
int value )
static

Implements the compare and swap operation against a reference to an int.

Parameters
location
expected
value
Returns

Definition at line 1195 of file ByteCodeHelper.cs.

1196 {
1197#if FIRST_PASS || IMPORTER || EXPORTER
1198 throw new NotImplementedException();
1199#else
1200 try
1201 {
1202 return Interlocked.CompareExchange(ref location, value, expected) == expected;
1203 }
1204 catch (SEHException e)
1205 {
1206 throw new global::java.lang.InternalError(e);
1207 }
1208#endif
1209 }

◆ CompareAndSwap() [3/4]

static bool IKVM.Runtime.ByteCodeHelper.CompareAndSwap ( ref long location,
long expected,
long value )
static

Implements a compare and swap operation against a reference to a long.

Parameters
location
expected
value
Returns

Definition at line 1218 of file ByteCodeHelper.cs.

1219 {
1220#if FIRST_PASS || IMPORTER || EXPORTER
1221 throw new NotImplementedException();
1222#else
1223 try
1224 {
1225 return Interlocked.CompareExchange(ref location, value, expected) == expected;
1226 }
1227 catch (SEHException e)
1228 {
1229 throw new global::java.lang.InternalError(e);
1230 }
1231#endif
1232 }

◆ CompareAndSwap() [4/4]

static bool IKVM.Runtime.ByteCodeHelper.CompareAndSwap ( ref object location,
object expected,
object value )
static

Implements the compare and swap operation against a reference to an object.

Parameters
location
expected
value
Returns

Definition at line 1172 of file ByteCodeHelper.cs.

1173 {
1174#if FIRST_PASS || IMPORTER || EXPORTER
1175 throw new NotImplementedException();
1176#else
1177 try
1178 {
1179 return Interlocked.CompareExchange(ref location, value, expected) == expected;
1180 }
1181 catch (SEHException e)
1182 {
1183 throw new global::java.lang.InternalError(e);
1184 }
1185#endif
1186 }

◆ d2i()

static int IKVM.Runtime.ByteCodeHelper.d2i ( double d)
static

Definition at line 504 of file ByteCodeHelper.cs.

505 {
506 if (d > int.MinValue && d < int.MaxValue)
507 {
508 return (int)d;
509 }
510 if (d <= int.MinValue)
511 {
512 return int.MinValue;
513 }
514 if (d >= int.MaxValue)
515 {
516 return int.MaxValue;
517 }
518 return 0;
519 }

◆ d2l()

static long IKVM.Runtime.ByteCodeHelper.d2l ( double d)
static

Definition at line 522 of file ByteCodeHelper.cs.

523 {
524 if (d > long.MinValue && d < long.MaxValue)
525 {
526 return (long)d;
527 }
528 if (d <= long.MinValue)
529 {
530 return long.MinValue;
531 }
532 if (d >= long.MaxValue)
533 {
534 return long.MaxValue;
535 }
536 return 0;
537 }

◆ DynamicAaload()

static object IKVM.Runtime.ByteCodeHelper.DynamicAaload ( object arrayref,
int index )
static

Definition at line 171 of file ByteCodeHelper.cs.

172 {
173#if FIRST_PASS
174 throw new NotImplementedException();
175#else
176 Profiler.Count("DynamicAaload");
177 return ((Array)arrayref).GetValue(index);
178#endif
179 }

◆ DynamicAastore()

static void IKVM.Runtime.ByteCodeHelper.DynamicAastore ( object arrayref,
int index,
object val )
static

Definition at line 160 of file ByteCodeHelper.cs.

161 {
162#if FIRST_PASS
163 throw new NotImplementedException();
164#else
165 Profiler.Count("DynamicAastore");
166 ((Array)arrayref).SetValue(val, index);
167#endif
168 }

◆ DynamicBinderMemberLookup< T >()

static T IKVM.Runtime.ByteCodeHelper.DynamicBinderMemberLookup< T > ( int kind,
string clazz,
string name,
string sig,
ikvm.@internal.CallerID callerID )
static
Type Constraints
T :class 
T :Delegate 

Definition at line 362 of file ByteCodeHelper.cs.

363 : class, Delegate
364 {
365#if FIRST_PASS
366 throw new NotImplementedException();
367#else
368 try
369 {
370 var mh = DynamicLoadMethodHandleImpl(kind, clazz, name, sig, callerID);
371 return GetDelegateForInvokeExact<T>(global::java.lang.invoke.MethodHandles.explicitCastArguments(mh, JVM.Context.MethodHandleUtil.GetDelegateMethodType(typeof(T))));
372 }
373 catch (global::java.lang.IncompatibleClassChangeError x)
374 {
375 if (x.getCause() is global::java.lang.NoSuchMethodException)
376 {
377 throw new global::java.lang.NoSuchMethodError(x.getCause().Message);
378 }
379 if (x.getCause() is global::java.lang.NoSuchFieldException)
380 {
381 throw new global::java.lang.NoSuchFieldError(x.getCause().Message);
382 }
383 if (x.getCause() is global::java.lang.IllegalAccessException)
384 {
385 throw new global::java.lang.IllegalAccessError(x.getCause().Message);
386 }
387 throw;
388 }
389#endif
390 }
static T GetDelegateForInvokeExact< T >(object methodHandle)

◆ DynamicCast()

static object IKVM.Runtime.ByteCodeHelper.DynamicCast ( object obj,
global.java.lang.Class clazz )
static

Definition at line 241 of file ByteCodeHelper.cs.

242 {
243#if FIRST_PASS
244 throw new NotImplementedException();
245#else
246 Debug.Assert(obj != null);
247 Profiler.Count("DynamicCast");
248 if (!DynamicInstanceOf(obj, clazz))
249 throw new global::java.lang.ClassCastException(IKVM.Java.Externs.ikvm.runtime.Util.GetTypeWrapperFromObject(JVM.Context, obj).Name + " cannot be cast to " + clazz.getName());
250
251 return obj;
252#endif
253 }
static bool DynamicInstanceOf(object obj, global::java.lang.Class clazz)

◆ DynamicClassLiteral()

static global.java.lang.Class IKVM.Runtime.ByteCodeHelper.DynamicClassLiteral ( string clazz,
ikvm.@internal.CallerID callerId )
static

Definition at line 230 of file ByteCodeHelper.cs.

231 {
232#if FIRST_PASS
233 throw new NotImplementedException();
234#else
235 Profiler.Count("DynamicClassLiteral");
236 return LoadTypeWrapper(clazz, callerId).ClassObject;
237#endif
238 }

◆ DynamicCreateDelegate()

static Delegate IKVM.Runtime.ByteCodeHelper.DynamicCreateDelegate ( object obj,
Type delegateType,
string name,
string sig )
static

Definition at line 393 of file ByteCodeHelper.cs.

394 {
395#if FIRST_PASS
396 throw new NotImplementedException();
397#else
398 RuntimeJavaType tw = RuntimeJavaType.FromClass(global::ikvm.runtime.Util.getClassFromObject(obj));
399 RuntimeJavaMethod mw = tw.GetMethod(name, sig, true);
400 if (mw == null || mw.IsStatic || !mw.IsPublic)
401 {
402#if NO_REF_EMIT
403 global::java.lang.invoke.MethodType methodType = MethodHandleUtil.GetDelegateMethodType(delegateType);
404 if (methodType.parameterCount() > MethodHandleUtil.MaxArity)
405 {
406 throw new NotImplementedException();
407 }
408 global::java.lang.invoke.MethodHandle exception = global::java.lang.invoke.MethodHandles.publicLookup()
409 .findConstructor(mw == null || mw.IsStatic ? typeof(global::java.lang.AbstractMethodError) : typeof(global::java.lang.IllegalAccessError),
410 global::java.lang.invoke.MethodType.methodType(typeof(void), typeof(string)))
411 .bindTo(tw.Name + ".Invoke" + sig);
412 return Delegate.CreateDelegate(delegateType,
413 global::java.lang.invoke.MethodHandles.dropArguments(
414 global::java.lang.invoke.MethodHandles.foldArguments(global::java.lang.invoke.MethodHandles.throwException(methodType.returnType(), exception.type().returnType()), exception),
415 0, methodType.parameterArray()).vmtarget, "Invoke");
416#else
417 MethodInfo invoke = delegateType.GetMethod("Invoke");
418 ParameterInfo[] parameters = invoke.GetParameters();
419 Type[] parameterTypes = new Type[parameters.Length + 1];
420 parameterTypes[0] = typeof(object);
421 for (int i = 0; i < parameters.Length; i++)
422 {
423 parameterTypes[i + 1] = parameters[i].ParameterType;
424 }
425 System.Reflection.Emit.DynamicMethod dm = new System.Reflection.Emit.DynamicMethod("Invoke", invoke.ReturnType, parameterTypes);
426 CodeEmitter ilgen = JVM.Context.CodeEmitterFactory.Create(dm);
427 ilgen.Emit(System.Reflection.Emit.OpCodes.Ldstr, tw.Name + ".Invoke" + sig);
428 JVM.Context.ClassLoaderFactory.GetBootstrapClassLoader()
429 .LoadClassByName(mw == null || mw.IsStatic ? "global::java.lang.AbstractMethodError" : "global::java.lang.IllegalAccessError")
430 .GetMethod("<init>", "(Lglobal::java.lang.String;)V", false)
431 .EmitNewobj(ilgen);
432 ilgen.Emit(System.Reflection.Emit.OpCodes.Throw);
433 ilgen.DoEmit();
434 return dm.CreateDelegate(delegateType, obj);
435#endif
436 }
437 else
438 {
439 mw.ResolveMethod();
440 return Delegate.CreateDelegate(delegateType, obj, (MethodInfo)mw.GetMethod());
441 }
442#endif
443 }
IKVM.Reflection.Type Type
IKVM.Reflection.MethodInfo MethodInfo
IKVM.Reflection.ParameterInfo ParameterInfo

◆ DynamicEraseInvokeExact()

static global.java.lang.invoke.MethodHandle IKVM.Runtime.ByteCodeHelper.DynamicEraseInvokeExact ( global.java.lang.invoke.MethodHandle mh,
global.java.lang.invoke.MethodType expected,
global.java.lang.invoke.MethodType target )
static

Definition at line 452 of file ByteCodeHelper.cs.

453 {
454#if FIRST_PASS
455 return null;
456#else
457 if (mh.type() != expected)
458 {
459 throw new global::java.lang.invoke.WrongMethodTypeException();
460 }
461 return global::java.lang.invoke.MethodHandles.explicitCastArguments(mh, target);
462#endif
463 }

◆ DynamicInstanceOf()

static bool IKVM.Runtime.ByteCodeHelper.DynamicInstanceOf ( object obj,
global.java.lang.Class clazz )
static

Definition at line 256 of file ByteCodeHelper.cs.

257 {
258#if FIRST_PASS
259 throw new NotImplementedException();
260#else
261 Debug.Assert(obj != null);
262 Profiler.Count("DynamicInstanceOf");
263
264 var tw = RuntimeJavaType.FromClass(clazz);
265 // we have to mimick the bytecode behavior, which allows these .NET-isms to show through
266 if (tw.TypeAsBaseType == typeof(Array))
267 return obj is Array;
268
269 if (tw.TypeAsBaseType == typeof(string))
270 return obj is string;
271
272 if (tw.TypeAsBaseType == typeof(IComparable))
273 return obj is IComparable;
274
275 return tw.IsInstance(obj);
276#endif
277 }

◆ DynamicLinkIndyCallSite< T >()

static void IKVM.Runtime.ByteCodeHelper.DynamicLinkIndyCallSite< T > ( ref IndyCallSite< T > site,
global.java.lang.invoke.CallSite cs,
Exception x,
string signature,
ikvm.@internal.CallerID callerID )
static
Type Constraints
T :class 
T :Delegate 

Definition at line 1468 of file ByteCodeHelper.cs.

1469 : class, Delegate
1470 {
1471#if FIRST_PASS
1472 throw new NotImplementedException();
1473#else
1474 // when a CallSite is first constructed, it doesn't call MethodHandleNatives.setCallSiteTargetNormal(),
1475 // so we have to check if we need to initialize it here (i.e. attach an IndyCallSite<T> to it)
1476 if (cs != null)
1477 {
1478 if (cs.ics == null)
1479 MethodHandleNatives.InitializeCallSite(cs);
1480
1481 lock (cs.ics)
1482 cs.ics.SetTarget(cs.target);
1483 }
1484 IndyCallSite<T> ics;
1485 if (x != null || cs == null)
1486 {
1487 x = MapException<Exception>(x ?? (cs == null
1488 ? (Exception)new global::java.lang.ClassCastException("bootstrap method failed to produce a CallSite")
1489 : new global::java.lang.ClassCastException("bootstrap method failed to produce a CallSite")), MapFlags.None);
1490 global::java.lang.invoke.MethodType type = LoadMethodType<T>();
1491 global::java.lang.invoke.MethodHandle exc = x is global::java.lang.BootstrapMethodError
1492 ? global::java.lang.invoke.MethodHandles.constant(typeof(global::java.lang.BootstrapMethodError), x)
1493 : global::java.lang.invoke.MethodHandles.publicLookup().findConstructor(typeof(global::java.lang.BootstrapMethodError), global::java.lang.invoke.MethodType.methodType(typeof(void), typeof(string), typeof(Exception)))
1494 .bindTo("call site initialization exception: " + x + "\n" + x.StackTrace).bindTo(x);
1495 ics = new IndyCallSite<T>();
1496 ((IIndyCallSite)ics).SetTarget(
1497 global::java.lang.invoke.MethodHandles.dropArguments(
1498 global::java.lang.invoke.MethodHandles.foldArguments(
1499 global::java.lang.invoke.MethodHandles.throwException(type.returnType(), typeof(global::java.lang.BootstrapMethodError)),
1500 exc),
1501 0, type.parameterArray()));
1502 }
1503 else
1504 {
1505 ics = new IndyCallSite<T>();
1506 var delegateType = LoadMethodType<T>();
1507 try
1508 {
1509 ((IIndyCallSite)ics).SetTarget(cs.dynamicInvoker().asType(delegateType));
1510 }
1511 catch (global::java.lang.invoke.WrongMethodTypeException e)
1512 {
1513 throw new global::java.lang.invoke.WrongMethodTypeException("call site " + cs.type() + ", requested " + delegateType + ": " + e.Message);
1514 }
1515 }
1516
1517 IndyCallSite<T> curr = site;
1518 if (curr.IsBootstrap)
1519 Interlocked.CompareExchange(ref site, ics, curr);
1520#endif
1521 }
static global::java.lang.invoke.MethodType LoadMethodType< T >()

◆ DynamicLoadMethodHandle()

static global.java.lang.invoke.MethodHandle IKVM.Runtime.ByteCodeHelper.DynamicLoadMethodHandle ( ref global.java.lang.invoke.MethodHandle cache,
int kind,
string clazz,
string name,
string sig,
ikvm.@internal.CallerID callerID )
static

Definition at line 311 of file ByteCodeHelper.cs.

312 {
313 if (cache == null)
314 Interlocked.CompareExchange(ref cache, DynamicLoadMethodHandleImpl(kind, clazz, name, sig, callerID), null);
315
316 return cache;
317 }

◆ DynamicLoadMethodType()

static global.java.lang.invoke.MethodType IKVM.Runtime.ByteCodeHelper.DynamicLoadMethodType ( ref global.java.lang.invoke.MethodType cache,
string sig,
ikvm.@internal.CallerID callerID )
static

Definition at line 280 of file ByteCodeHelper.cs.

281 {
282 if (cache == null)
283 DynamicLoadMethodTypeImpl(ref cache, sig, callerID);
284
285 return cache;
286 }

◆ DynamicMapException()

static Exception IKVM.Runtime.ByteCodeHelper.DynamicMapException ( Exception x,
MapFlags mode,
global.java.lang.Class exceptionClass )
static

Definition at line 1323 of file ByteCodeHelper.cs.

1324 {
1325#if FIRST_PASS
1326 throw new NotImplementedException();
1327#else
1328 var exceptionTypeWrapper = RuntimeJavaType.FromClass(exceptionClass);
1329 mode &= ~MapFlags.NoRemapping;
1330 if (exceptionTypeWrapper.IsSubTypeOf(JVM.Context.JavaBase.TypeOfCliSystemException))
1331 mode |= MapFlags.NoRemapping;
1332
1333 var exceptionType = exceptionTypeWrapper == JVM.Context.JavaBase.TypeOfjavaLangThrowable ? typeof(System.Exception) : exceptionTypeWrapper.TypeAsBaseType;
1334 return (Exception)JVM.Context.ByteCodeHelperMethods.MapException.MakeGenericMethod(exceptionType).Invoke(null, new object[] { x, mode });
1335#endif
1336 }

◆ DynamicMultianewarray()

static object IKVM.Runtime.ByteCodeHelper.DynamicMultianewarray ( int[] lengths,
global.java.lang.Class clazz )
static

Definition at line 122 of file ByteCodeHelper.cs.

123 {
124#if FIRST_PASS
125 throw new NotImplementedException();
126#else
127 Profiler.Count("DynamicMultianewarray");
128
129 var wrapper = RuntimeJavaType.FromClass(clazz);
130 var obj = multianewarray(wrapper.TypeAsArrayType.TypeHandle, lengths);
131 if (wrapper.IsGhostArray)
132 GhostTag.SetTag(obj, wrapper);
133
134 return obj;
135#endif
136 }
static object multianewarray(RuntimeTypeHandle typeHandle, int[] lengths)

◆ DynamicNewarray()

static object IKVM.Runtime.ByteCodeHelper.DynamicNewarray ( int length,
global.java.lang.Class clazz )
static

Definition at line 139 of file ByteCodeHelper.cs.

140 {
141#if FIRST_PASS
142 throw new NotImplementedException();
143#else
144 Profiler.Count("DynamicNewarray");
145 if (length < 0)
146 throw new global::java.lang.NegativeArraySizeException();
147
148 var wrapper = RuntimeJavaType.FromClass(clazz);
149 var obj = Array.CreateInstance(wrapper.TypeAsArrayType, length);
150 if (wrapper.IsGhost || wrapper.IsGhostArray)
151 GhostTag.SetTag(obj, wrapper.MakeArrayType(1));
152
153 return obj;
154#endif
155 }

◆ DynamicNewCheckOnly()

static void IKVM.Runtime.ByteCodeHelper.DynamicNewCheckOnly ( global.java.lang.Class clazz)
static

Definition at line 185 of file ByteCodeHelper.cs.

186 {
187#if FIRST_PASS
188 throw new NotImplementedException();
189#else
190 Profiler.Count("DynamicNewCheckOnly");
191 var wrapper = RuntimeJavaType.FromClass(clazz);
192 if (wrapper.IsAbstract)
193 throw new global::java.lang.InstantiationError(wrapper.Name);
194
195 wrapper.RunClassInit();
196#endif
197 }

◆ f2i()

static int IKVM.Runtime.ByteCodeHelper.f2i ( float f)
static

Definition at line 468 of file ByteCodeHelper.cs.

469 {
470 if (f > int.MinValue && f < int.MaxValue)
471 {
472 return (int)f;
473 }
474 if (f <= int.MinValue)
475 {
476 return int.MinValue;
477 }
478 if (f >= int.MaxValue)
479 {
480 return int.MaxValue;
481 }
482 return 0;
483 }

◆ f2l()

static long IKVM.Runtime.ByteCodeHelper.f2l ( float f)
static

Definition at line 486 of file ByteCodeHelper.cs.

487 {
488 if (f > long.MinValue && f < long.MaxValue)
489 {
490 return (long)f;
491 }
492 if (f <= long.MinValue)
493 {
494 return long.MinValue;
495 }
496 if (f >= long.MaxValue)
497 {
498 return long.MaxValue;
499 }
500 return 0;
501 }

◆ GetClassFromTypeHandle()

static object IKVM.Runtime.ByteCodeHelper.GetClassFromTypeHandle ( RuntimeTypeHandle typeHandle)
static

Definition at line 543 of file ByteCodeHelper.cs.

544 {
546 }
static global::java.lang.Class getClassFromTypeHandle(RuntimeTypeHandle handle)
Definition Util.cs:67

◆ GetDelegateForInvoke< T >()

static T IKVM.Runtime.ByteCodeHelper.GetDelegateForInvoke< T > ( object methodHandle,
object realType,
ref InvokeCache< T > cache )
static
Type Constraints
T :class 
T :Delegate 

Definition at line 1351 of file ByteCodeHelper.cs.

1352 : class, Delegate
1353 {
1354#if FIRST_PASS
1355 throw new NotImplementedException();
1356#else
1357 var methodHandle_ = (global::java.lang.invoke.MethodHandle)methodHandle;
1358 var realType_ = (global::java.lang.invoke.MethodType)realType;
1359
1360 T del;
1361 if (cache.Type == methodHandle_.type() && (del = (methodHandle_.isVarargsCollector() ? cache.varArg : cache.fixedArg)) != null)
1362 return del;
1363
1364 del = methodHandle_.form.vmentry.vmtarget as T;
1365 if (del == null)
1366 {
1367 var adapter = global::java.lang.invoke.MethodHandles.exactInvoker(methodHandle_.type());
1368 if (methodHandle_.isVarargsCollector())
1369 adapter = adapter.asVarargsCollector(methodHandle_.type().parameterType(methodHandle_.type().parameterCount() - 1));
1370
1371 // if realType is set, the delegate contains erased unloadable types
1372 if (realType_ != null)
1373 adapter = adapter.asType(realType_.insertParameterTypes(0, (global::java.lang.Class)ClassLiteral<global::java.lang.invoke.MethodHandle>.Value)).asFixedArity();
1374
1375 adapter = adapter.asType(JVM.Context.MethodHandleUtil.GetDelegateMethodType(typeof(T)));
1376 del = GetDelegateForInvokeExact<T>(adapter);
1377 if (cache.TrySetType(methodHandle_.type()))
1378 {
1379 if (methodHandle_.isVarargsCollector())
1380 cache.varArg = del;
1381 else
1382 cache.fixedArg = del;
1383 }
1384 }
1385
1386 return del;
1387#endif
1388 }

◆ GetDelegateForInvokeBasic< T >()

static T IKVM.Runtime.ByteCodeHelper.GetDelegateForInvokeBasic< T > ( global.java.lang.invoke.MethodHandle h)
static
Type Constraints
T :class 
T :Delegate 

Definition at line 1390 of file ByteCodeHelper.cs.

1391 : class, Delegate
1392 {
1393#if FIRST_PASS
1394 throw new NotImplementedException();
1395#else
1396 var del = h.form.vmentry.vmtarget as T;
1397 del ??= MethodHandleUtil.GetVoidAdapter(h.form.vmentry) as T;
1398 return del;
1399#endif
1400 }

◆ GetDelegateForInvokeExact< T >()

static T IKVM.Runtime.ByteCodeHelper.GetDelegateForInvokeExact< T > ( object methodHandle)
static
Type Constraints
T :class 
T :Delegate 

Definition at line 1338 of file ByteCodeHelper.cs.

1339 : class, Delegate
1340 {
1341#if FIRST_PASS
1342 throw new NotImplementedException();
1343#else
1344 var methodHandle_ = (global::java.lang.invoke.MethodHandle)methodHandle;
1345 var del = methodHandle_._invokeExactDelegate as T;
1346 del ??= JVM.Context.MethodHandleUtil.GetDelegateForInvokeExact<T>(methodHandle_);
1347 return del;
1348#endif
1349 }

◆ GetDotNetEnumField< T >()

static T IKVM.Runtime.ByteCodeHelper.GetDotNetEnumField< T > ( string name)
static
Type Constraints
T :global 
T :java.lang.Enum 

Definition at line 1285 of file ByteCodeHelper.cs.

1287 : global::java.lang.Enum
1288#endif
1289 {
1290#if FIRST_PASS
1291 throw new NotImplementedException();
1292#else
1293 try
1294 {
1295 return (T)global::java.lang.Enum.valueOf((global::java.lang.Class)ClassLiteral<T>.Value, name);
1296 }
1297 catch (global::java.lang.IllegalArgumentException)
1298 {
1299 throw new global::java.lang.NoSuchFieldError(((global::java.lang.Class)ClassLiteral<T>.Value).getName() + "." + name);
1300 }
1301#endif
1302 }

◆ InitializeModule()

static void IKVM.Runtime.ByteCodeHelper.InitializeModule ( Module module)
static

Invoked by exported assemblies.

Parameters
module
Exceptions
ArgumentOutOfRangeException

Definition at line 1265 of file ByteCodeHelper.cs.

1266 {
1267#if FIRST_PASS
1268 throw new NotImplementedException();
1269#else
1270 var asm = Assembly.GetCallingAssembly();
1271 if (module.Assembly != asm)
1272 throw new ArgumentOutOfRangeException();
1273
1274 // check for InitializeModule method present on classloader
1275 var classLoader = JVM.Context.AssemblyClassLoaderFactory.FromAssembly(asm).GetJavaClassLoader();
1276 if (classLoader != null)
1277 {
1278 var init = (Action<Module>)Delegate.CreateDelegate(typeof(Action<Module>), classLoader, "InitializeModule", false, false);
1279 if (init != null)
1280 init(module);
1281 }
1282#endif
1283 }
IKVM.Reflection.Assembly Assembly

◆ LinkIndyCallSite< T >()

static void IKVM.Runtime.ByteCodeHelper.LinkIndyCallSite< T > ( ref IndyCallSite< T > site,
global.java.lang.invoke.CallSite cs,
Exception x )
static
Type Constraints
T :class 
T :Delegate 

Definition at line 1413 of file ByteCodeHelper.cs.

1414 : class, Delegate
1415 {
1416#if FIRST_PASS
1417 throw new NotImplementedException();
1418#else
1419 // when a CallSite is first constructed, it doesn't call MethodHandleNatives.setCallSiteTargetNormal(),
1420 // so we have to check if we need to initialize it here (i.e. attach an IndyCallSite<T> to it)
1421 if (cs != null)
1422 {
1423 if (cs.ics == null)
1424 MethodHandleNatives.InitializeCallSite(cs);
1425
1426 lock (cs.ics)
1427 cs.ics.SetTarget(cs.target);
1428 }
1429
1430 IndyCallSite<T> ics;
1431 if (x != null || cs == null)
1432 {
1433 x = MapException<Exception>(x ?? (Exception)new global::java.lang.ClassCastException("bootstrap method failed to produce a CallSite"), MapFlags.None);
1434 global::java.lang.invoke.MethodType type = LoadMethodType<T>();
1435 global::java.lang.invoke.MethodHandle exc = x is global::java.lang.BootstrapMethodError
1436 ? global::java.lang.invoke.MethodHandles.constant(typeof(global::java.lang.BootstrapMethodError), x)
1437 : global::java.lang.invoke.MethodHandles.publicLookup().findConstructor(typeof(global::java.lang.BootstrapMethodError), global::java.lang.invoke.MethodType.methodType(typeof(void), typeof(string), typeof(Exception)))
1438 .bindTo("call site initialization exception: " + x + "\n" + x.StackTrace).bindTo(x);
1439 ics = new IndyCallSite<T>();
1440 ((IIndyCallSite)ics).SetTarget(
1441 global::java.lang.invoke.MethodHandles.dropArguments(
1442 global::java.lang.invoke.MethodHandles.foldArguments(
1443 global::java.lang.invoke.MethodHandles.throwException(type.returnType(), typeof(global::java.lang.BootstrapMethodError)),
1444 exc),
1445 0, type.parameterArray()));
1446 }
1447 else if ((ics = cs.ics as IndyCallSite<T>) == null)
1448 {
1449 ics = new IndyCallSite<T>();
1450 var expectedType = LoadMethodType<T>();
1451 try
1452 {
1453 ((IIndyCallSite)ics).SetTarget(cs.dynamicInvoker().asType(expectedType));
1454 }
1455 catch (global::java.lang.invoke.WrongMethodTypeException e)
1456 {
1457 throw new global::java.lang.invoke.WrongMethodTypeException("call site " + cs.type() + ", requested " + expectedType + ": " + e.Message);
1458 }
1459 }
1460
1461 var curr = site;
1462 if (curr.IsBootstrap)
1463 Interlocked.CompareExchange(ref site, ics, curr);
1464#endif
1465 }

◆ LoadMethodType< T >()

static global.java.lang.invoke.MethodType IKVM.Runtime.ByteCodeHelper.LoadMethodType< T > ( )
static
Type Constraints
T :class 
T :Delegate 

Definition at line 1402 of file ByteCodeHelper.cs.

1403 : class, Delegate
1404 {
1405#if FIRST_PASS
1406 throw new NotImplementedException();
1407#else
1408 return JVM.Context.MethodHandleUtil.GetDelegateMethodType(typeof(T));
1409#endif
1410 }

◆ MapException< T >()

static T IKVM.Runtime.ByteCodeHelper.MapException< T > ( Exception x,
MapFlags mode )
static
Type Constraints
T :Exception 

Definition at line 1313 of file ByteCodeHelper.cs.

1313 : Exception
1314 {
1315#if FIRST_PASS
1316 throw new NotImplementedException();
1317#else
1318 return JVM.Context.ExceptionHelper.MapException<T>(x, (mode & MapFlags.NoRemapping) == 0, (mode & MapFlags.Unused) != 0);
1319#endif
1320 }

◆ multianewarray()

static object IKVM.Runtime.ByteCodeHelper.multianewarray ( RuntimeTypeHandle typeHandle,
int[] lengths )
static

Definition at line 67 of file ByteCodeHelper.cs.

68 {
69 for (int i = 0; i < lengths.Length; i++)
70 {
71 if (lengths[i] < 0)
72 {
73#if !FIRST_PASS
74 throw new global::java.lang.NegativeArraySizeException();
75#endif
76 }
77 }
78
79 return MultianewarrayHelper(Type.GetTypeFromHandle(typeHandle).GetElementType(), lengths, 0);
80 }

◆ multianewarray_ghost()

static object IKVM.Runtime.ByteCodeHelper.multianewarray_ghost ( RuntimeTypeHandle typeHandle,
int[] lengths )
static

Definition at line 98 of file ByteCodeHelper.cs.

99 {
100 var type = Type.GetTypeFromHandle(typeHandle);
101 int rank = 0;
102 while (ReflectUtil.IsVector(type))
103 {
104 rank++;
105 type = type.GetElementType();
106 }
107
108 var obj = multianewarray(RuntimeArrayJavaType.MakeArrayType(typeof(object), rank).TypeHandle, lengths);
109 GhostTag.SetTag(obj, typeHandle);
110 return obj;
111 }

◆ SkipFinalizer() [1/2]

static bool IKVM.Runtime.ByteCodeHelper.SkipFinalizer ( )
static

Returns true if the Java finalizer should be skipped.

Returns

Definition at line 797 of file ByteCodeHelper.cs.

798 {
799#if FIRST_PASS
800 throw new NotImplementedException();
801#else
802 return Environment.HasShutdownStarted && !global::java.lang.Shutdown.runFinalizersOnExit;
803#endif
804 }

◆ SkipFinalizer() [2/2]

static bool IKVM.Runtime.ByteCodeHelper.SkipFinalizer ( object o)
static

Returns true if the Java finalizer for the given object should be skipped.

Parameters
o
Returns

Definition at line 811 of file ByteCodeHelper.cs.

812 {
813#if FIRST_PASS
814 throw new NotImplementedException();
815#else
816 if (SkipFinalizer())
817 return true;
818
819 if (o is global::java.lang.Object jlo)
820 if (ObjectAccessor.GetInit(jlo) == false)
821 return true;
822
823 return false;
824#endif
825 }
static bool SkipFinalizer()
Returns true if the Java finalizer should be skipped.

◆ VerboseCastFailure()

static void IKVM.Runtime.ByteCodeHelper.VerboseCastFailure ( RuntimeTypeHandle typeHandle,
object obj )
static

Definition at line 763 of file ByteCodeHelper.cs.

764 {
765#if FIRST_PASS
766 throw new NotImplementedException();
767#else
768 Type t1 = obj.GetType();
769 Type t2 = Type.GetTypeFromHandle(typeHandle);
770 string msg;
771 if (t1.Assembly.FullName == t2.Assembly.FullName && t1.Assembly.Location != t2.Assembly.Location)
772 {
773 string l1 = t1.Assembly.Location;
774 string l2 = t2.Assembly.Location;
775 if (l1 == "")
776 {
777 l1 = "unknown location";
778 }
779 if (l2 == "")
780 {
781 l2 = "unknown location";
782 }
783 msg = String.Format("Object of type \"{0}\" loaded from {1} cannot be cast to \"{2}\" loaded from {3}", t1.AssemblyQualifiedName, l1, t2.AssemblyQualifiedName, l2);
784 }
785 else
786 {
787 msg = String.Format("Object of type \"{0}\" cannot be cast to \"{1}\"", t1.AssemblyQualifiedName, t2.AssemblyQualifiedName);
788 }
789 throw new global::java.lang.ClassCastException(msg);
790#endif
791 }

◆ VolatileRead() [1/8]

static bool IKVM.Runtime.ByteCodeHelper.VolatileRead ( ref bool location)
static

Implements a volatile read against a reference to a bool. In Java, a volatile operation is atomic.

Parameters
location
Returns

Definition at line 834 of file ByteCodeHelper.cs.

835 {
836#if FIRST_PASS || IMPORTER || EXPORTER
837 throw new NotImplementedException();
838#else
839 try
840 {
841 return Volatile.Read(ref location);
842 }
843 catch (SEHException e)
844 {
845 throw new global::java.lang.InternalError(e);
846 }
847#endif
848 }

◆ VolatileRead() [2/8]

static byte IKVM.Runtime.ByteCodeHelper.VolatileRead ( ref byte location)
static

Implements a volatile read against a reference to a byte. In Java, a volatile operation is atomic.

Parameters
location
Returns

Definition at line 876 of file ByteCodeHelper.cs.

877 {
878#if FIRST_PASS || IMPORTER || EXPORTER
879 throw new NotImplementedException();
880#else
881 try
882 {
883 return Volatile.Read(ref location);
884 }
885 catch (SEHException e)
886 {
887 throw new global::java.lang.InternalError(e);
888 }
889#endif
890 }

◆ VolatileRead() [3/8]

static char IKVM.Runtime.ByteCodeHelper.VolatileRead ( ref char location)
static

Implements a volatile read against a reference to a char. In Java, a volatile operation is atomic.

Parameters
location
Returns

Definition at line 918 of file ByteCodeHelper.cs.

919 {
920#if FIRST_PASS || IMPORTER || EXPORTER
921 throw new NotImplementedException();
922#else
923 try
924 {
925 return (char)Volatile.Read(ref Unsafe.As<char, short>(ref location));
926 }
927 catch (SEHException e)
928 {
929 throw new global::java.lang.InternalError(e);
930 }
931#endif
932 }

◆ VolatileRead() [4/8]

static double IKVM.Runtime.ByteCodeHelper.VolatileRead ( ref double location)
static

Implements a volatile read against a reference to a double. In Java, a volatile operation is atomic.

Parameters
location
Returns

Definition at line 1128 of file ByteCodeHelper.cs.

1129 {
1130#if FIRST_PASS || IMPORTER || EXPORTER
1131 throw new NotImplementedException();
1132#else
1133 try
1134 {
1135 return Interlocked.CompareExchange(ref location, 0, 0);
1136 }
1137 catch (SEHException e)
1138 {
1139 throw new global::java.lang.InternalError(e);
1140 }
1141#endif
1142 }

◆ VolatileRead() [5/8]

static float IKVM.Runtime.ByteCodeHelper.VolatileRead ( ref float location)
static

Implements a volatile read against a reference to a float. In Java, a volatile operation is atomic.

Parameters
location
Returns

Definition at line 1086 of file ByteCodeHelper.cs.

1087 {
1088#if FIRST_PASS || IMPORTER || EXPORTER
1089 throw new NotImplementedException();
1090#else
1091 try
1092 {
1093 return Volatile.Read(ref location);
1094 }
1095 catch (SEHException e)
1096 {
1097 throw new global::java.lang.InternalError(e);
1098 }
1099#endif
1100 }

◆ VolatileRead() [6/8]

static int IKVM.Runtime.ByteCodeHelper.VolatileRead ( ref int location)
static

Implements a volatile read against a reference to a int. In Java, a volatile operation is atomic.

Parameters
location
Returns

Definition at line 1002 of file ByteCodeHelper.cs.

1003 {
1004#if FIRST_PASS || IMPORTER || EXPORTER
1005 throw new NotImplementedException();
1006#else
1007 try
1008 {
1009 return Volatile.Read(ref location);
1010 }
1011 catch (SEHException e)
1012 {
1013 throw new global::java.lang.InternalError(e);
1014 }
1015#endif
1016 }

◆ VolatileRead() [7/8]

static long IKVM.Runtime.ByteCodeHelper.VolatileRead ( ref long location)
static

Implements a volatile read against a reference to a long. In Java, a volatile operation is atomic.

Parameters
location
Returns

Definition at line 1044 of file ByteCodeHelper.cs.

1045 {
1046#if FIRST_PASS || IMPORTER || EXPORTER
1047 throw new NotImplementedException();
1048#else
1049 try
1050 {
1051 return Interlocked.CompareExchange(ref location, 0, 0);
1052 }
1053 catch (SEHException e)
1054 {
1055 throw new global::java.lang.InternalError(e);
1056 }
1057#endif
1058 }

◆ VolatileRead() [8/8]

static short IKVM.Runtime.ByteCodeHelper.VolatileRead ( ref short location)
static

Implements a volatile read against a reference to a short. In Java, a volatile operation is atomic.

Parameters
location
Returns

Definition at line 960 of file ByteCodeHelper.cs.

961 {
962#if FIRST_PASS || IMPORTER || EXPORTER
963 throw new NotImplementedException();
964#else
965 try
966 {
967 return Volatile.Read(ref location);
968 }
969 catch (SEHException e)
970 {
971 throw new global::java.lang.InternalError(e);
972 }
973#endif
974 }

◆ VolatileWrite() [1/8]

static void IKVM.Runtime.ByteCodeHelper.VolatileWrite ( ref bool location,
bool value )
static

Implements a volatile write against a reference to a bool. In Java, a volatile operation is atomic.

Parameters
location
value

Definition at line 855 of file ByteCodeHelper.cs.

856 {
857#if FIRST_PASS || IMPORTER || EXPORTER
858 throw new NotImplementedException();
859#else
860 try
861 {
862 Volatile.Write(ref location, value);
863 }
864 catch (SEHException e)
865 {
866 throw new global::java.lang.InternalError(e);
867 }
868#endif
869 }

◆ VolatileWrite() [2/8]

static void IKVM.Runtime.ByteCodeHelper.VolatileWrite ( ref byte location,
byte value )
static

Implements a volatile write against a reference to a byte. In Java, a volatile operation is atomic.

Parameters
location
value

Definition at line 897 of file ByteCodeHelper.cs.

898 {
899#if FIRST_PASS || IMPORTER || EXPORTER
900 throw new NotImplementedException();
901#else
902 try
903 {
904 Volatile.Write(ref location, value);
905 }
906 catch (SEHException e)
907 {
908 throw new global::java.lang.InternalError(e);
909 }
910#endif
911 }

◆ VolatileWrite() [3/8]

static void IKVM.Runtime.ByteCodeHelper.VolatileWrite ( ref char location,
char value )
static

Implements a volatile write against a reference to a char. In Java, a volatile operation is atomic.

Parameters
location
value

Definition at line 939 of file ByteCodeHelper.cs.

940 {
941#if FIRST_PASS || IMPORTER || EXPORTER
942 throw new NotImplementedException();
943#else
944 try
945 {
946 Volatile.Write(ref Unsafe.As<char, short>(ref location), (short)value);
947 }
948 catch (SEHException e)
949 {
950 throw new global::java.lang.InternalError(e);
951 }
952#endif
953 }

◆ VolatileWrite() [4/8]

static void IKVM.Runtime.ByteCodeHelper.VolatileWrite ( ref double location,
double value )
static

Implements a volatile write against a reference to a double. In Java, a volatile operation is atomic.

Parameters
location
value

Definition at line 1149 of file ByteCodeHelper.cs.

1150 {
1151#if FIRST_PASS || IMPORTER || EXPORTER
1152 throw new NotImplementedException();
1153#else
1154 try
1155 {
1156 Interlocked.Exchange(ref location, value);
1157 }
1158 catch (SEHException e)
1159 {
1160 throw new global::java.lang.InternalError(e);
1161 }
1162#endif
1163 }

◆ VolatileWrite() [5/8]

static void IKVM.Runtime.ByteCodeHelper.VolatileWrite ( ref float location,
float value )
static

Implements a volatile write against a reference to a float. In Java, a volatile operation is atomic.

Parameters
location
value

Definition at line 1107 of file ByteCodeHelper.cs.

1108 {
1109#if FIRST_PASS || IMPORTER || EXPORTER
1110 throw new NotImplementedException();
1111#else
1112 try
1113 {
1114 Volatile.Write(ref location, value);
1115 }
1116 catch (SEHException e)
1117 {
1118 throw new global::java.lang.InternalError(e);
1119 }
1120#endif
1121 }

◆ VolatileWrite() [6/8]

static void IKVM.Runtime.ByteCodeHelper.VolatileWrite ( ref int location,
int value )
static

Implements a volatile write against a reference to a int. In Java, a volatile operation is atomic.

Parameters
location
value

Definition at line 1023 of file ByteCodeHelper.cs.

1024 {
1025#if FIRST_PASS || IMPORTER || EXPORTER
1026 throw new NotImplementedException();
1027#else
1028 try
1029 {
1030 Volatile.Write(ref location, value);
1031 }
1032 catch (SEHException e)
1033 {
1034 throw new global::java.lang.InternalError(e);
1035 }
1036#endif
1037 }

◆ VolatileWrite() [7/8]

static void IKVM.Runtime.ByteCodeHelper.VolatileWrite ( ref long location,
long value )
static

Implements a volatile write against a reference to a long. In Java, a volatile operation is atomic.

Parameters
location
value

Definition at line 1065 of file ByteCodeHelper.cs.

1066 {
1067#if FIRST_PASS || IMPORTER || EXPORTER
1068 throw new NotImplementedException();
1069#else
1070 try
1071 {
1072 Interlocked.Exchange(ref location, value);
1073 }
1074 catch (SEHException e)
1075 {
1076 throw new global::java.lang.InternalError(e);
1077 }
1078#endif
1079 }

◆ VolatileWrite() [8/8]

static void IKVM.Runtime.ByteCodeHelper.VolatileWrite ( ref short location,
short value )
static

Implements a volatile write against a reference to a short. In Java, a volatile operation is atomic.

Parameters
location
value

Definition at line 981 of file ByteCodeHelper.cs.

982 {
983#if FIRST_PASS || IMPORTER || EXPORTER
984 throw new NotImplementedException();
985#else
986 try
987 {
988 Volatile.Write(ref location, value);
989 }
990 catch (SEHException e)
991 {
992 throw new global::java.lang.InternalError(e);
993 }
994#endif
995 }

The documentation for this class was generated from the following file: