25using System.Diagnostics;
26using System.Runtime.InteropServices;
27using System.Threading;
33#if IMPORTER || EXPORTER
40using System.Reflection;
56#if FIRST_PASS == false && EXPORTER == FALSE
58 static ObjectAccessor objectAccessor;
60 static ObjectAccessor ObjectAccessor =>
JVM.
Internal.BaseAccessors.Get(
ref objectAccessor);
67 public static object multianewarray(RuntimeTypeHandle typeHandle,
int[] lengths)
69 for (
int i = 0; i < lengths.Length; i++)
74 throw new global::java.lang.NegativeArraySizeException();
79 return MultianewarrayHelper(
Type.GetTypeFromHandle(typeHandle).GetElementType(), lengths, 0);
83 static object MultianewarrayHelper(
Type elemType,
int[] lengths,
int index)
85 var o = Array.CreateInstance(elemType, lengths[index++]);
86 if (index < lengths.Length)
88 elemType = elemType.GetElementType();
90 for (
int i = 0; i < a.Length; i++)
91 a[i] = MultianewarrayHelper(elemType, lengths, index);
100 var type =
Type.GetTypeFromHandle(typeHandle);
105 type = type.GetElementType();
113 [DebuggerStepThrough]
116 var obj =
new T[length];
121 [DebuggerStepThrough]
125 throw new NotImplementedException();
127 Profiler.Count(
"DynamicMultianewarray");
129 var wrapper = RuntimeJavaType.FromClass(clazz);
130 var obj =
multianewarray(wrapper.TypeAsArrayType.TypeHandle, lengths);
131 if (wrapper.IsGhostArray)
138 [DebuggerStepThrough]
142 throw new NotImplementedException();
146 throw new global::java.lang.NegativeArraySizeException();
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));
159 [DebuggerStepThrough]
163 throw new NotImplementedException();
166 ((Array)arrayref).SetValue(val, index);
170 [DebuggerStepThrough]
174 throw new NotImplementedException();
177 return ((Array)arrayref).GetValue(index);
184 [DebuggerStepThrough]
188 throw new NotImplementedException();
190 Profiler.Count(
"DynamicNewCheckOnly");
191 var wrapper = RuntimeJavaType.FromClass(clazz);
192 if (wrapper.IsAbstract)
193 throw new global::java.lang.InstantiationError(wrapper.Name);
195 wrapper.RunClassInit();
199 static RuntimeJavaType LoadTypeWrapper(
string clazz, ikvm.@
internal.CallerID callerId)
202 throw new NotImplementedException();
206 var context = RuntimeJavaType.FromClass(callerId.getCallerClass());
208 var loader = callerId.getCallerClassLoader();
211 ClassLoaderAccessor cla =
null;
213 cla.InvokeCheckPackageAccess(loader, wrapper.ClassObject, callerId.getCallerClass().pd);
216 if (!wrapper.IsAccessibleFrom(context))
217 throw new global::java.lang.IllegalAccessError(
"Try to access class " + wrapper.Name +
" from class " + context.Name);
229 [DebuggerStepThrough]
233 throw new NotImplementedException();
235 Profiler.Count(
"DynamicClassLiteral");
236 return LoadTypeWrapper(clazz, callerId).ClassObject;
240 [DebuggerStepThrough]
241 public static object DynamicCast(
object obj, global::java.lang.Class clazz)
244 throw new NotImplementedException();
246 Debug.Assert(obj !=
null);
249 throw new global::java.lang.ClassCastException(
IKVM.
Java.
Externs.
ikvm.
runtime.
Util.GetTypeWrapperFromObject(
JVM.Context, obj).Name +
" cannot be cast to " + clazz.getName());
255 [DebuggerStepThrough]
259 throw new NotImplementedException();
261 Debug.Assert(obj !=
null);
262 Profiler.Count(
"DynamicInstanceOf");
264 var tw = RuntimeJavaType.FromClass(clazz);
266 if (tw.TypeAsBaseType == typeof(Array))
269 if (tw.TypeAsBaseType == typeof(
string))
270 return obj is string;
272 if (tw.TypeAsBaseType == typeof(IComparable))
273 return obj is IComparable;
275 return tw.IsInstance(obj);
279 [DebuggerStepThrough]
280 public static global::java.lang.invoke.MethodType
DynamicLoadMethodType(
ref global::java.lang.invoke.MethodType cache,
string sig, ikvm.@
internal.CallerID callerID)
283 DynamicLoadMethodTypeImpl(
ref cache, sig, callerID);
288 private static void DynamicLoadMethodTypeImpl(
ref global::java.lang.invoke.MethodType cache,
string sig, global::ikvm.@
internal.CallerID callerID)
291 throw new NotImplementedException();
296 var args = loader.ArgJavaTypeListFromSig(sig,
LoadMode.LoadOrThrow);
297 var ptypes =
new global::java.lang.Class[args.Length];
298 for (
int i = 0; i < ptypes.Length; i++)
299 ptypes[i] = args[i].ClassObject;
301 Interlocked.CompareExchange(
ref cache, global::java.lang.invoke.MethodType.methodType(loader.RetTypeWrapperFromSig(sig,
LoadMode.LoadOrThrow).ClassObject, ptypes),
null);
310 [DebuggerStepThrough]
311 public 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)
314 Interlocked.CompareExchange(
ref cache, DynamicLoadMethodHandleImpl(kind, clazz, name, sig, callerID),
null);
319 static global::java.lang.invoke.MethodHandle DynamicLoadMethodHandleImpl(
int kind,
string clazz,
string name,
string sig, ikvm.@
internal.CallerID callerID)
322 throw new NotImplementedException();
324 var refc = LoadTypeWrapper(clazz, callerID).ClassObject;
328 switch ((MethodHandleKind)kind)
330 case MethodHandleKind.GetStatic:
331 case MethodHandleKind.PutStatic:
332 case MethodHandleKind.GetField:
333 case MethodHandleKind.PutField:
334 global::java.lang.Class type =
RuntimeClassLoader.FromCallerID(callerID).FieldTypeWrapperFromSig(sig,
LoadMode.LoadOrThrow).ClassObject;
335 return global::java.lang.invoke.MethodHandleNatives.linkMethodHandleConstant(callerID.getCallerClass(), kind, refc, name, type);
337 global::java.lang.invoke.MethodType mt =
null;
340 if (kind == (
int)MethodHandleKind.InvokeVirtual && refc ==
JVM.Context.
JavaBase.TypeOfJavaLangInvokeMethodHandle.ClassObject)
345 return global::java.lang.invoke.MethodHandles.exactInvoker(mt);
347 return global::java.lang.invoke.MethodHandles.invoker(mt);
351 return global::java.lang.invoke.MethodHandleNatives.linkMethodHandleConstant(callerID.getCallerClass(), kind, refc, name, mt);
361 [DebuggerStepThrough]
363 where T :
class, Delegate
366 throw new NotImplementedException();
370 var mh = DynamicLoadMethodHandleImpl(kind, clazz, name, sig, callerID);
373 catch (global::java.lang.IncompatibleClassChangeError x)
375 if (x.getCause() is global::java.lang.NoSuchMethodException)
377 throw new global::java.lang.NoSuchMethodError(x.getCause().Message);
379 if (x.getCause() is global::java.lang.NoSuchFieldException)
381 throw new global::java.lang.NoSuchFieldError(x.getCause().Message);
383 if (x.getCause() is global::java.lang.IllegalAccessException)
385 throw new global::java.lang.IllegalAccessError(x.getCause().Message);
392 [DebuggerStepThrough]
396 throw new NotImplementedException();
398 RuntimeJavaType tw = RuntimeJavaType.FromClass(global::ikvm.runtime.Util.getClassFromObject(obj));
400 if (mw ==
null || mw.IsStatic || !mw.IsPublic)
403 global::java.lang.invoke.MethodType methodType =
MethodHandleUtil.GetDelegateMethodType(delegateType);
406 throw new NotImplementedException();
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");
417 MethodInfo invoke = delegateType.GetMethod(
"Invoke");
419 Type[] parameterTypes =
new Type[parameters.Length + 1];
420 parameterTypes[0] = typeof(
object);
421 for (
int i = 0; i < parameters.Length; i++)
423 parameterTypes[i + 1] = parameters[i].ParameterType;
425 System.Reflection.Emit.DynamicMethod dm =
new System.Reflection.Emit.DynamicMethod(
"Invoke", invoke.ReturnType, parameterTypes);
427 ilgen.Emit(
System.Reflection.Emit.OpCodes.Ldstr, tw.Name +
".Invoke" + sig);
429 .LoadClassByName(mw ==
null || mw.IsStatic ?
"global::java.lang.AbstractMethodError" :
"global::java.lang.IllegalAccessError")
430 .GetMethod(
"<init>",
"(Lglobal::java.lang.String;)V",
false)
432 ilgen.Emit(
System.Reflection.Emit.OpCodes.Throw);
434 return dm.CreateDelegate(delegateType, obj);
440 return Delegate.CreateDelegate(delegateType, obj, (
MethodInfo)mw.GetMethod());
445 [DebuggerStepThrough]
451 [DebuggerStepThrough]
452 public 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)
457 if (mh.type() != expected)
459 throw new global::java.lang.invoke.WrongMethodTypeException();
461 return global::java.lang.invoke.MethodHandles.explicitCastArguments(mh, target);
467 [DebuggerStepThrough]
468 public static int f2i(
float f)
470 if (f >
int.MinValue && f <
int.MaxValue)
474 if (f <=
int.MinValue)
478 if (f >=
int.MaxValue)
485 [DebuggerStepThrough]
486 public static long f2l(
float f)
488 if (f >
long.MinValue && f <
long.MaxValue)
492 if (f <=
long.MinValue)
494 return long.MinValue;
496 if (f >=
long.MaxValue)
498 return long.MaxValue;
503 [DebuggerStepThrough]
504 public static int d2i(
double d)
506 if (d >
int.MinValue && d <
int.MaxValue)
510 if (d <=
int.MinValue)
514 if (d >=
int.MaxValue)
521 [DebuggerStepThrough]
522 public static long d2l(
double d)
524 if (d >
long.MinValue && d <
long.MaxValue)
528 if (d <=
long.MinValue)
530 return long.MinValue;
532 if (d >=
long.MaxValue)
534 return long.MaxValue;
542 [DebuggerStepThrough]
548 [DebuggerStepThrough]
549 public static void arraycopy(
object src,
int srcStart,
object dest,
int destStart,
int len)
552 throw new NotImplementedException();
560 arraycopy_fast((Array)src, srcStart, (Array)dest, destStart, len);
563 catch (InvalidCastException)
565 throw new global::java.lang.ArrayStoreException();
568 else if (src ==
null || dest ==
null)
570 throw new global::java.lang.NullPointerException();
574 throw new global::java.lang.ArrayIndexOutOfBoundsException();
578 if (src is
object[] src1 && dest is
object[] dst1)
581 if (len > 100 && src.GetType() == dest.GetType())
588 for (; len > 0; len--)
592 dst1[destStart++] = src1[srcStart++];
598 else if (src.GetType() != dest.GetType() && (IsPrimitiveArrayType(src.GetType()) || IsPrimitiveArrayType(dest.GetType())))
601 throw new global::java.lang.ArrayStoreException();
607 arraycopy_fast((Array)src, srcStart, (Array)dest, destStart, len);
610 catch (InvalidCastException)
612 throw new global::java.lang.ArrayStoreException();
619 private static bool IsPrimitiveArrayType(
Type type)
622 throw new NotImplementedException();
624 return type.IsArray &&
JVM.Context.
ClassLoaderFactory.GetJavaTypeFromType(type.GetElementType()).IsPrimitive;
628 [DebuggerStepThrough]
629 public static void arraycopy_fast(Array src,
int srcStart, Array dest,
int destStart,
int len)
632 throw new NotImplementedException();
636 Array.Copy(src, srcStart, dest, destStart, len);
638 catch (ArgumentNullException)
640 throw new global::java.lang.NullPointerException();
642 catch (ArgumentException)
644 throw new global::java.lang.ArrayIndexOutOfBoundsException();
649 [DebuggerStepThrough]
653 throw new NotImplementedException();
659 Buffer.BlockCopy(src, srcStart * 8, dest, destStart * 8, len * 8);
663 catch (ArgumentNullException)
665 throw new global::java.lang.NullPointerException();
667 catch (OverflowException)
669 throw new global::java.lang.ArrayIndexOutOfBoundsException();
671 catch (ArgumentException)
673 throw new global::java.lang.ArrayIndexOutOfBoundsException();
678 [DebuggerStepThrough]
682 throw new NotImplementedException();
688 Buffer.BlockCopy(src, srcStart * 4, dest, destStart * 4, len * 4);
692 catch (ArgumentNullException)
694 throw new global::java.lang.NullPointerException();
696 catch (OverflowException)
698 throw new global::java.lang.ArrayIndexOutOfBoundsException();
700 catch (ArgumentException)
702 throw new global::java.lang.ArrayIndexOutOfBoundsException();
707 [DebuggerStepThrough]
711 throw new NotImplementedException();
717 Buffer.BlockCopy(src, srcStart * 2, dest, destStart * 2, len * 2);
721 catch (ArgumentNullException)
723 throw new global::java.lang.NullPointerException();
725 catch (OverflowException)
727 throw new global::java.lang.ArrayIndexOutOfBoundsException();
729 catch (ArgumentException)
731 throw new global::java.lang.ArrayIndexOutOfBoundsException();
736 [DebuggerStepThrough]
740 throw new NotImplementedException();
744 Buffer.BlockCopy(src, srcStart, dest, destStart, len);
747 catch (ArgumentNullException)
749 throw new global::java.lang.NullPointerException();
751 catch (OverflowException)
753 throw new global::java.lang.ArrayIndexOutOfBoundsException();
755 catch (ArgumentException)
757 throw new global::java.lang.ArrayIndexOutOfBoundsException();
766 throw new NotImplementedException();
768 Type t1 = obj.GetType();
769 Type t2 =
Type.GetTypeFromHandle(typeHandle);
771 if (t1.Assembly.FullName == t2.Assembly.FullName && t1.Assembly.Location != t2.Assembly.Location)
773 string l1 = t1.Assembly.Location;
774 string l2 = t2.Assembly.Location;
777 l1 =
"unknown location";
781 l2 =
"unknown location";
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);
787 msg = String.Format(
"Object of type \"{0}\" cannot be cast to \"{1}\"", t1.AssemblyQualifiedName, t2.AssemblyQualifiedName);
789 throw new global::java.lang.ClassCastException(msg);
800 throw new NotImplementedException();
802 return Environment.HasShutdownStarted && !global::java.lang.Shutdown.runFinalizersOnExit;
814 throw new NotImplementedException();
819 if (o is global::java.lang.Object jlo)
820 if (ObjectAccessor.GetInit(jlo) ==
false)
836#if FIRST_PASS || IMPORTER || EXPORTER
837 throw new NotImplementedException();
843 catch (SEHException e)
845 throw new global::java.lang.InternalError(e);
857#if FIRST_PASS || IMPORTER || EXPORTER
858 throw new NotImplementedException();
864 catch (SEHException e)
866 throw new global::java.lang.InternalError(e);
878#if FIRST_PASS || IMPORTER || EXPORTER
879 throw new NotImplementedException();
885 catch (SEHException e)
887 throw new global::java.lang.InternalError(e);
899#if FIRST_PASS || IMPORTER || EXPORTER
900 throw new NotImplementedException();
906 catch (SEHException e)
908 throw new global::java.lang.InternalError(e);
920#if FIRST_PASS || IMPORTER || EXPORTER
921 throw new NotImplementedException();
925 return (
char)
Volatile.Read(
ref Unsafe.As<
char,
short>(
ref location));
927 catch (SEHException e)
929 throw new global::java.lang.InternalError(e);
941#if FIRST_PASS || IMPORTER || EXPORTER
942 throw new NotImplementedException();
946 Volatile.Write(
ref Unsafe.As<
char,
short>(
ref location), (
short)value);
948 catch (SEHException e)
950 throw new global::java.lang.InternalError(e);
962#if FIRST_PASS || IMPORTER || EXPORTER
963 throw new NotImplementedException();
969 catch (SEHException e)
971 throw new global::java.lang.InternalError(e);
983#if FIRST_PASS || IMPORTER || EXPORTER
984 throw new NotImplementedException();
990 catch (SEHException e)
992 throw new global::java.lang.InternalError(e);
1004#if FIRST_PASS || IMPORTER || EXPORTER
1005 throw new NotImplementedException();
1011 catch (SEHException e)
1013 throw new global::java.lang.InternalError(e);
1025#if FIRST_PASS || IMPORTER || EXPORTER
1026 throw new NotImplementedException();
1032 catch (SEHException e)
1034 throw new global::java.lang.InternalError(e);
1046#if FIRST_PASS || IMPORTER || EXPORTER
1047 throw new NotImplementedException();
1053 catch (SEHException e)
1055 throw new global::java.lang.InternalError(e);
1067#if FIRST_PASS || IMPORTER || EXPORTER
1068 throw new NotImplementedException();
1074 catch (SEHException e)
1076 throw new global::java.lang.InternalError(e);
1088#if FIRST_PASS || IMPORTER || EXPORTER
1089 throw new NotImplementedException();
1095 catch (SEHException e)
1097 throw new global::java.lang.InternalError(e);
1109#if FIRST_PASS || IMPORTER || EXPORTER
1110 throw new NotImplementedException();
1116 catch (SEHException e)
1118 throw new global::java.lang.InternalError(e);
1130#if FIRST_PASS || IMPORTER || EXPORTER
1131 throw new NotImplementedException();
1137 catch (SEHException e)
1139 throw new global::java.lang.InternalError(e);
1151#if FIRST_PASS || IMPORTER || EXPORTER
1152 throw new NotImplementedException();
1158 catch (SEHException e)
1160 throw new global::java.lang.InternalError(e);
1174#if FIRST_PASS || IMPORTER || EXPORTER
1175 throw new NotImplementedException();
1179 return Interlocked.CompareExchange(
ref location, value, expected) == expected;
1181 catch (SEHException e)
1183 throw new global::java.lang.InternalError(e);
1197#if FIRST_PASS || IMPORTER || EXPORTER
1198 throw new NotImplementedException();
1202 return Interlocked.CompareExchange(
ref location, value, expected) == expected;
1204 catch (SEHException e)
1206 throw new global::java.lang.InternalError(e);
1220#if FIRST_PASS || IMPORTER || EXPORTER
1221 throw new NotImplementedException();
1225 return Interlocked.CompareExchange(
ref location, value, expected) == expected;
1227 catch (SEHException e)
1229 throw new global::java.lang.InternalError(e);
1243#if FIRST_PASS || IMPORTER || EXPORTER
1244 throw new NotImplementedException();
1248 return Interlocked.CompareExchange(
ref location, value, expected) == expected;
1250 catch (SEHException)
1252 throw new global::java.lang.InternalError();
1257#if EXPORTER == false
1264 [MethodImpl(MethodImplOptions.NoInlining)]
1268 throw new NotImplementedException();
1270 var
asm =
Assembly.GetCallingAssembly();
1271 if (module.Assembly !=
asm)
1272 throw new ArgumentOutOfRangeException();
1276 if (classLoader !=
null)
1278 var init = (Action<Module>)Delegate.CreateDelegate(typeof(Action<Module>), classLoader,
"InitializeModule",
false,
false);
1287 where T : global::java.lang.Enum
1291 throw new NotImplementedException();
1295 return (T)global::java.lang.Enum.valueOf((global::java.lang.Class)
ClassLiteral<T>.
Value, name);
1297 catch (global::java.lang.IllegalArgumentException)
1299 throw new global::java.lang.NoSuchFieldError(((global::java.lang.Class)
ClassLiteral<T>.
Value).getName() +
"." + name);
1316 throw new NotImplementedException();
1326 throw new NotImplementedException();
1328 var exceptionTypeWrapper = RuntimeJavaType.FromClass(exceptionClass);
1330 if (exceptionTypeWrapper.IsSubTypeOf(
JVM.Context.
JavaBase.TypeOfCliSystemException))
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 });
1339 where T :
class, Delegate
1342 throw new NotImplementedException();
1344 var methodHandle_ = (global::java.lang.invoke.MethodHandle)methodHandle;
1345 var del = methodHandle_._invokeExactDelegate as T;
1352 where T :
class, Delegate
1355 throw new NotImplementedException();
1357 var methodHandle_ = (global::java.lang.invoke.MethodHandle)methodHandle;
1358 var realType_ = (global::java.lang.invoke.MethodType)realType;
1361 if (cache.Type == methodHandle_.type() && (del = (methodHandle_.isVarargsCollector() ? cache.varArg : cache.fixedArg)) !=
null)
1364 del = methodHandle_.form.vmentry.vmtarget as T;
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));
1372 if (realType_ !=
null)
1377 if (cache.TrySetType(methodHandle_.type()))
1379 if (methodHandle_.isVarargsCollector())
1382 cache.fixedArg = del;
1391 where T :
class, Delegate
1394 throw new NotImplementedException();
1396 var del = h.form.vmentry.vmtarget as T;
1403 where T : class, Delegate
1406 throw new NotImplementedException();
1414 where T :
class, Delegate
1417 throw new NotImplementedException();
1427 cs.ics.SetTarget(cs.target);
1431 if (x !=
null || cs ==
null)
1433 x = MapException<Exception>(x ?? (Exception)
new global::java.lang.ClassCastException(
"bootstrap method failed to produce a CallSite"),
MapFlags.None);
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);
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)),
1445 0, type.parameterArray()));
1453 ((
IIndyCallSite)ics).SetTarget(cs.dynamicInvoker().asType(expectedType));
1455 catch (global::java.lang.invoke.WrongMethodTypeException e)
1457 throw new global::java.lang.invoke.WrongMethodTypeException(
"call site " + cs.type() +
", requested " + expectedType +
": " + e.Message);
1462 if (curr.IsBootstrap)
1469 where T :
class, Delegate
1472 throw new NotImplementedException();
1482 cs.ics.SetTarget(cs.target);
1485 if (x !=
null || cs ==
null)
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);
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);
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)),
1501 0, type.parameterArray()));
1509 ((
IIndyCallSite)ics).SetTarget(cs.dynamicInvoker().asType(delegateType));
1511 catch (global::java.lang.invoke.WrongMethodTypeException e)
1513 throw new global::java.lang.invoke.WrongMethodTypeException(
"call site " + cs.type() +
", requested " + delegateType +
": " + e.Message);
1518 if (curr.IsBootstrap)
1527#if EXPORTER == false
1537 where T : class, Delegate
1540 internal readonly
bool IsBootstrap;
1550 this.IsBootstrap = bootstrap;
1551 this.target = target;
1577 internal T fixedArg;
1580 global::java.lang.invoke.MethodType
type;
1582 internal global::java.lang.invoke.MethodType
Type =>
type;
1584 internal bool TrySetType(global::java.lang.invoke.MethodType newType)
1587 return type == newType;
1594 [StructLayout(LayoutKind.Explicit)]
1606 converter.d = value;
1612 converter.l = value;
1618 [StructLayout(LayoutKind.Explicit)]
1630 converter.f = value;
1636 converter.i = value;
1642 public struct MHA<T1, T2, T3, T4, T5, T6, T7, T8>
1672 public delegate
void MHV<T1, T2, T3, T4, T5, T6>(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6);
1673 public delegate
void MHV<T1, T2, T3, T4, T5, T6, T7>(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7);
1674 public delegate
void MHV<T1, T2, T3, T4, T5, T6, T7, T8>(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8);
1682 public delegate TResult
MH<T1, T2, T3, T4, T5, T6, TResult>(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6);
1683 public delegate TResult
MH<T1, T2, T3, T4, T5, T6, T7, TResult>(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7);
1684 public delegate TResult
MH<T1, T2, T3, T4, T5, T6, T7, T8, TResult>(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8);
System.Threading.Interlocked Interlocked
IKVM.Reflection.Module Module
IKVM.Reflection.Type Type
IKVM.Reflection.Assembly Assembly
IKVM.Reflection.MethodInfo MethodInfo
IKVM.Reflection.ParameterInfo ParameterInfo
static global::java.lang.Class getClassFromTypeHandle(RuntimeTypeHandle handle)
static T GetDelegateForInvoke< T >(object methodHandle, object realType, ref InvokeCache< T > cache)
static global::java.lang.Class DynamicClassLiteral(string clazz, ikvm. @internal.CallerID callerId)
static global::java.lang.invoke.MethodType LoadMethodType< T >()
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 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 void LinkIndyCallSite< T >(ref IndyCallSite< T > site, global::java.lang.invoke.CallSite cs, Exception x)
static object DynamicCast(object obj, global::java.lang.Class clazz)
static object GetClassFromTypeHandle(RuntimeTypeHandle typeHandle)
static void arraycopy_primitive_1(Array src, int srcStart, Array dest, int destStart, int len)
static bool VolatileRead(ref bool location)
Implements a volatile read against a reference to a bool. 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 T GetDelegateForInvokeBasic< T >(global::java.lang.invoke.MethodHandle h)
static object DynamicAaload(object arrayref, int index)
static void arraycopy(object src, int srcStart, object dest, int destStart, int len)
static object multianewarray_ghost(RuntimeTypeHandle typeHandle, int[] lengths)
static object DynamicNewarray(int length, global::java.lang.Class clazz)
static T GetDelegateForInvokeExact< T >(object methodHandle)
static void VerboseCastFailure(RuntimeTypeHandle typeHandle, object obj)
static bool CompareAndSwap(ref long location, long expected, long value)
Implements a compare and swap operation against a reference to a long.
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 void DynamicLinkIndyCallSite< T >(ref IndyCallSite< T > site, global::java.lang.invoke.CallSite cs, Exception x, string signature, ikvm. @internal.CallerID callerID)
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 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 void arraycopy_fast(Array src, int srcStart, Array dest, int destStart, int len)
static T GetDotNetEnumField< T >(string name)
static bool SkipFinalizer()
Returns true if the Java finalizer should be skipped.
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 long d2l(double d)
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 object DynamicMultianewarray(int[] lengths, global::java.lang.Class clazz)
static void DynamicAastore(object arrayref, int index, object val)
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 bool CompareAndSwap(ref object location, object expected, object value)
Implements the compare and swap operation against a reference to an object.
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 long VolatileRead(ref long location)
Implements a volatile read against a reference to a long. In Java, a volatile operation is atomic.
static void arraycopy_primitive_4(Array src, int srcStart, Array dest, int destStart, int len)
static object multianewarray(RuntimeTypeHandle typeHandle, int[] lengths)
static byte VolatileRead(ref byte location)
Implements a volatile read against a reference to a byte. 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 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 T[] anewarray_ghost< T >(int length, RuntimeTypeHandle typeHandle)
static int VolatileRead(ref int location)
Implements a volatile read against a reference to a int. In Java, a volatile operation is atomic.
static Exception DynamicMapException(Exception x, MapFlags mode, global::java.lang.Class exceptionClass)
static void InitializeModule(Module module)
Invoked by exported assemblies.
static bool CompareAndSwap(ref double location, double expected, double value)
Implements a compare and swap operation against a reference to a double.
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 void arraycopy_primitive_2(Array src, int srcStart, Array dest, int destStart, int len)
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 bool location, bool value)
Implements a volatile write against a reference to a bool. In Java, a volatile operation is atomic.
static void DynamicNewCheckOnly(global::java.lang.Class clazz)
static bool SkipFinalizer(object o)
Returns true if the Java finalizer for the given object should be skipped.
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 arraycopy_primitive_8(Array src, int srcStart, Array dest, int destStart, int len)
static bool CompareAndSwap(ref int location, int expected, int value)
Implements the compare and swap operation against a reference to an int.
static T MapException< T >(Exception x, MapFlags mode)
Provides a static cache of java.lang.Class instances per .NET type.
static object Value
Gets the class literal value, caching the result.
CodeEmitter Create(MethodBuilder mb)
Creates a new instance.
static IndyCallSite< T > CreateBootstrap(T bootstrap)
Main state of the running JVM.
.NET exception that corresponds to a Java exception.
RuntimeAssemblyClassLoader FromAssembly(Assembly assembly)
Obtains the RuntimeAssemblyClassLoader for the given Assembly. This method should not be used with dy...
Runtime support for a class loader.
CodeEmitterFactory CodeEmitterFactory
Gets the CodeEmitterFactory associated with this instance of the runtime.
MethodHandleUtil MethodHandleUtil
Gets the MethodHandleUtil associated with this instance of the runtime.
ByteCodeHelperMethods ByteCodeHelperMethods
Gets the ByteCodeHelperMethods associated with this instance of the runtime.
ExceptionHelper ExceptionHelper
Gets the ExceptionHelper associated with this instance of the runtime.
RuntimeAssemblyClassLoaderFactory AssemblyClassLoaderFactory
Gets the RuntimeAssemblyClassLoaderFactory associated with this instance of the runtime.
CoreClasses JavaBase
Gets the CoreClasses associated with this instance of the runtime.
RuntimeClassLoaderFactory ClassLoaderFactory
Gets the RuntimeClassLoaderFactory associated with this instance of the runtime.
void SetTarget(global::java.lang.invoke.MethodHandle mh)
delegate void MHV< T1, T2, T3, T4, T5 >(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5)
delegate void MHV< T1, T2, T3 >(T1 t1, T2 t2, T3 t3)
delegate void MHV< T1, T2, T3, T4, T5, T6, T7, T8 >(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8)
delegate void MHV< T1, T2, T3, T4, T5, T6 >(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6)
delegate TResult MH< T1, T2, T3, TResult >(T1 t1, T2 t2, T3 t3)
delegate void MHV< T1, T2, T3, T4 >(T1 t1, T2 t2, T3 t3, T4 t4)
delegate TResult MH< T1, T2, T3, T4, T5, T6, T7, TResult >(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7)
delegate TResult MH< TResult >()
delegate void MHV< T1, T2, T3, T4, T5, T6, T7 >(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7)
delegate TResult MH< T1, T2, T3, T4, T5, T6, TResult >(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6)
delegate TResult MH< T1, T2, T3, T4, T5, T6, T7, T8, TResult >(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8)
delegate TResult MH< T1, T2, T3, T4, TResult >(T1 t1, T2 t2, T3 t3, T4 t4)
delegate void MHV< T1 >(T1 t1)
delegate TResult MH< T1, T2, T3, T4, T5, TResult >(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5)
delegate void MHV< T1, T2 >(T1 t1, T2 t2)
delegate TResult MH< T1, T2, TResult >(T1 t1, T2 t2)
delegate TResult MH< T1, TResult >(T1 t1)
static long ToLong(double value, ref DoubleConverter converter)
static double ToDouble(long value, ref DoubleConverter converter)
static float ToFloat(int value, ref FloatConverter converter)
static int ToInt(float value, ref FloatConverter converter)
global::java.lang.invoke.MethodType type
MHA(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8)