IKVM11
11
Java SE 11 Virtual Machine for .NET
Loading...
Searching...
No Matches
VM.cs
Go to the documentation of this file.
1
/*
2
Copyright (C) 2007-2015 Jeroen Frijters
3
Copyright (C) 2009 Volker Berlin (i-net software)
4
5
This software is provided 'as-is', without any express or implied
6
warranty. In no event will the authors be held liable for any damages
7
arising from the use of this software.
8
9
Permission is granted to anyone to use this software for any purpose,
10
including commercial applications, and to alter it and redistribute it
11
freely, subject to the following restrictions:
12
13
1. The origin of this software must not be misrepresented; you must not
14
claim that you wrote the original software. If you use this software
15
in a product, an acknowledgment in the product documentation would be
16
appreciated but is not required.
17
2. Altered source versions must be plainly marked as such, and must not be
18
misrepresented as being the original software.
19
3. This notice may not be removed or altered from any source distribution.
20
21
Jeroen Frijters
22
jeroen@frijters.net
23
24
*/
25
using
System
;
26
using
System.Diagnostics;
27
28
using
IKVM.Runtime
;
29
30
namespace
IKVM.Java.Externs.sun.misc
31
{
32
33
static
class
VM
34
{
35
36
public
static
void
initialize
()
37
{
38
#if FIRST_PASS
39
throw
new
NotImplementedException();
40
#else
41
JVM
.Init();
42
#endif
43
}
44
45
public
static
global::java.lang.ClassLoader
latestUserDefinedLoader0
()
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
}
80
81
}
82
83
}
Assembly
IKVM.Reflection.Assembly Assembly
Definition
IkvmReflectionAssemblySymbol.cs:7
IKVM.Java.Externs.sun.misc.VM
Definition
VM.cs:34
IKVM.Java.Externs.sun.misc.VM.latestUserDefinedLoader0
static global::java.lang.ClassLoader latestUserDefinedLoader0()
Definition
VM.cs:45
IKVM.Java.Externs.sun.misc.VM.initialize
static void initialize()
Definition
VM.cs:36
IKVM.Runtime.JVM
Main state of the running JVM.
Definition
JVM.Resolver.cs:18
IKVM.Runtime.RuntimeContext.ClassLoaderFactory
RuntimeClassLoaderFactory ClassLoaderFactory
Gets the RuntimeClassLoaderFactory associated with this instance of the runtime.
Definition
RuntimeContext.cs:252
IKVM.Java.Externs.sun.misc
Definition
GC.cs:27
IKVM.Runtime
Definition
Accessor.cs:5
System
Definition
HexConverter.cs:9
src
IKVM.Runtime
Java
Externs
sun
misc
VM.cs
Generated by
1.12.0