IKVM11  11
Java SE 11 Virtual Machine for .NET
Loading...
Searching...
No Matches
IKVM.Java.Externs.sun.misc.VM Class Reference

Static Public Member Functions

static void initialize ()
 
static global::java.lang.ClassLoader latestUserDefinedLoader0 ()
 

Detailed Description

Definition at line 33 of file VM.cs.

Member Function Documentation

◆ initialize()

static void IKVM.Java.Externs.sun.misc.VM.initialize ( )
static

Definition at line 36 of file VM.cs.

37 {
38#if FIRST_PASS
39 throw new NotImplementedException();
40#else
41 JVM.Init();
42#endif
43 }
Main state of the running JVM.

◆ latestUserDefinedLoader0()

static global.java.lang.ClassLoader IKVM.Java.Externs.sun.misc.VM.latestUserDefinedLoader0 ( )
static

Definition at line 45 of file VM.cs.

46 {
47#if FIRST_PASS
48 throw new NotImplementedException();
49#else
50 var trace = new StackTrace(2, false);
51 for (var i = 0; i < trace.FrameCount; i++)
52 {
53 var f = trace.GetFrame(i);
54 var m = f.GetMethod();
55 if (m == null)
56 continue;
57
58 // not to be considered from Java
59 if (global::IKVM.Java.Externs.sun.reflect.Reflection.IsHideFromStackWalk(m))
60 continue;
61
62 if (m.DeclaringType != null && JVM.Context.ClassLoaderFactory.GetJavaTypeFromType(m.DeclaringType) is RuntimeJavaType tw and not null)
63 {
64 // check that the assembly isn't java.base or the IKVM runtime
65 var clw = tw.ClassLoader;
66 if (clw is RuntimeAssemblyClassLoader acl)
67 if (acl.GetAssembly(tw) == typeof(object).Assembly || acl.GetAssembly(tw) == typeof(VM).Assembly)
68 continue;
69
70 // associated Java class loader is our nearest
71 var cl = clw.GetJavaClassLoader();
72 if (cl != null)
73 return cl;
74 }
75 }
76
77 return null;
78#endif
79 }
IKVM.Reflection.Assembly Assembly
RuntimeClassLoaderFactory ClassLoaderFactory
Gets the RuntimeClassLoaderFactory associated with this instance of the runtime.

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