Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product...
Transcript of Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product...
![Page 1: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/1.jpg)
![Page 2: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/2.jpg)
<Insert Picture Here>
Maxine: A JVM Written in Java
Michael HauptOracle LabsPotsdam, Germany
![Page 3: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/3.jpg)
3
The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle.
![Page 4: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/4.jpg)
Speaker's Background
4
Technische Universität Darmstadt, 2001–2006
Doctoral research, Steamloom (virtual machine support for aspect-oriented programming)
![Page 5: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/5.jpg)
Speaker's Background
4
Technische Universität Darmstadt, 2001–2006
Doctoral research, Steamloom (virtual machine support for aspect-oriented programming)
Hasso-Plattner-Institut Potsdam, 2006–2011
Postdoc, virtual machine architecture disentangling, SOM family, NXTalk
![Page 6: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/6.jpg)
Speaker's Background
4
Technische Universität Darmstadt, 2001–2006
Doctoral research, Steamloom (virtual machine support for aspect-oriented programming)
Hasso-Plattner-Institut Potsdam, 2006–2011
Postdoc, virtual machine architecture disentangling, SOM family, NXTalk
Oracle Labs, Potsdam,since 2011
Maxine team, virtual machine architecture, multi-language virtual machines, code cache management, JSR292
![Page 7: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/7.jpg)
Who Needs a JVM?
5
JVM
![Page 8: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/8.jpg)
Who Needs a JVM?
5
application developers, end users ✔
JVM
Java
Applications
![Page 9: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/9.jpg)
Who Needs a JVM?
5
application developers, end users ✔
researchers ✔
JVM
Java
Applications
Dynamic Compiler Garbage Collector Object Layout Runtime
Optimisations
Target Architecture Parallel
Concurrent Language Specifics Thread Migration
Concurrency AbstractionsTagging
![Page 10: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/10.jpg)
Who Needs a JVM?
5
application developers, end users ✔
researchers ✔
programming language implementers ✔
JVM
Java
Applications
Dynamic Compiler Garbage Collector Object Layout Runtime
Optimisations
Target Architecture Parallel
Concurrent Language Specifics Thread Migration
Concurrency AbstractionsTagging
Java, Ruby, Python, Smalltalk, ...
![Page 11: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/11.jpg)
Who Needs a JVM?
5
application developers, end users ✔
researchers ✔
programming language implementers ✔
JVM
Java
Applications
Dynamic Compiler Garbage Collector Object Layout Runtime
Optimisations
Target Architecture Parallel
Concurrent Language Specifics Thread Migration
Concurrency AbstractionsTagging
Java, Ruby, Python, Smalltalk, ...
! ! ! !
![Page 12: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/12.jpg)
Who Needs a JVM?
5
application developers, end users ✔
researchers ✔
programming language implementers ✔
JVM
Java
Applications
Dynamic Compiler Garbage Collector Object Layout Runtime
Optimisations
Target Architecture Parallel
Concurrent Language Specifics Thread Migration
Concurrency AbstractionsTagging
Java, Ruby, Python, Smalltalk, ...
J?VM
! ! ! !
![Page 13: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/13.jpg)
Maxine
6
almost 100 % Java
use unmodified JDK
meta-circularity studies
Home page: http://wikis.oracle.com/display/MaxineVM/Home
Source (GPLv2): https://hg.kenai.com/hg/maxine~maxine
Mailing list via: http://kenai.com/projects/maxine
![Page 14: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/14.jpg)
Maxine
6
almost 100 % Java
use unmodified JDK
meta-circularity studies
supported on 64-bit x86
Solaris, Mac OS X, Linux
Virtual Edition: Xen
Home page: http://wikis.oracle.com/display/MaxineVM/Home
Source (GPLv2): https://hg.kenai.com/hg/maxine~maxine
Mailing list via: http://kenai.com/projects/maxine
![Page 15: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/15.jpg)
Maxine
6
almost 100 % Java
use unmodified JDK
meta-circularity studies
full IDE support
(Eclipse, NetBeans)
tooling: Inspector
supported on 64-bit x86
Solaris, Mac OS X, Linux
Virtual Edition: Xen
Home page: http://wikis.oracle.com/display/MaxineVM/Home
Source (GPLv2): https://hg.kenai.com/hg/maxine~maxine
Mailing list via: http://kenai.com/projects/maxine
![Page 16: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/16.jpg)
Maxine
6
almost 100 % Java
use unmodified JDK
meta-circularity studies
full IDE support
(Eclipse, NetBeans)
tooling: Inspector
supported on 64-bit x86
Solaris, Mac OS X, Linux
Virtual Edition: Xen
Home page: http://wikis.oracle.com/display/MaxineVM/Home
Source (GPLv2): https://hg.kenai.com/hg/maxine~maxine
Mailing list via: http://kenai.com/projects/maxine
dynamic compilation only
semi-space GC
modular architecture
![Page 17: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/17.jpg)
VM Research Group at Oracle Labs
7
Home page: http://wikis.oracle.com/display/MaxineVM/Home
Source (GPLv2): https://hg.kenai.com/hg/maxine~maxine
Mailing list via: http://kenai.com/projects/maxine
DougSimon
MarioWolczko
Director
ThomasWürthinger
MichaelHaupt
ChristianWimmer
LaurentDaynès
MickJordan
MichaelVan De Vanter
![Page 18: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/18.jpg)
Why Java?
8
language• reflection• annotations
JDK• rich and powerful API• inclusion in VM
ecosystem• IDE support• tooling
VM architecture• uniform representation• same compiler chain
![Page 19: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/19.jpg)
Bootstrapping Maxine
9
Maxine Source Code
![Page 20: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/20.jpg)
Bootstrapping Maxine
9
Maxine Source Code
Maxine Bytecodes
javacJust-in-Time Compilers
Memory Manager
... others ...
![Page 21: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/21.jpg)
Host VM (HotSpot)
Bootstrapping Maxine
9
Maxine Source Code
Maxine Bytecodes
Boot Image Generator
javac
![Page 22: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/22.jpg)
Host VM (HotSpot)
Bootstrapping Maxine
9
Maxine Source Code
Maxine Bytecodes
Boot Image Generator
javacJust-in-Time Compilers
Memory Manager
... others ...
![Page 23: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/23.jpg)
Host VM (HotSpot)
Bootstrapping Maxine
9
Maxine Source Code
Maxine Bytecodes
Boot Image Generator
javacJust-in-Time Compilers
Memory Manager
... others ...
![Page 24: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/24.jpg)
Host VM (HotSpot)
Bootstrapping Maxine
9
Maxine Source Code
Maxine Bytecodes
Boot Image Generator
javacJust-in-Time Compilers
Memory Manager
... others ...
![Page 25: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/25.jpg)
Host VM (HotSpot)
Bootstrapping Maxine
9
Maxine Source Code
Maxine Bytecodes
Boot Image Generator
MaxineBoot Image
javacJust-in-Time Compilers
Memory Manager
... others ...
![Page 26: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/26.jpg)
Host VM (HotSpot)
Bootstrapping Maxine
9
Maxine Source Code
Maxine Bytecodes
Boot Image Generator
Boot Loader
MaxineBoot Image
javacJust-in-Time Compilers
Memory Manager
... others ...
![Page 27: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/27.jpg)
Maxine Scheme Abstractions
10
Maxine VM
Dynamic Compilers Garbage Collector Object Layout Runtime
![Page 28: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/28.jpg)
Maxine Scheme Abstractions
10
Maxine VM
Dynamic Compilers Garbage Collector Object Layout Runtime
interface LayoutScheme
![Page 29: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/29.jpg)
Maxine Scheme Abstractions
10
Maxine VM
Dynamic Compilers Garbage Collector Object Layout Runtime
interface LayoutScheme interface ReferenceScheme
![Page 30: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/30.jpg)
Maxine Scheme Abstractions
10
Maxine VM
Dynamic Compilers Garbage Collector Object Layout Runtime
interface LayoutScheme interface ReferenceSchemeinterface HeapScheme
![Page 31: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/31.jpg)
Maxine Scheme Abstractions
10
Maxine VM
Dynamic Compilers Garbage Collector Object Layout Runtime
interface LayoutScheme interface ReferenceSchemeinterface HeapScheme
interface MonitorScheme
![Page 32: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/32.jpg)
Maxine Scheme Abstractions
10
Maxine VM
Dynamic Compilers Garbage Collector Object Layout Runtime
interface LayoutScheme interface ReferenceSchemeinterface HeapScheme
interface MonitorScheme interface RunScheme
![Page 33: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/33.jpg)
Maxine Scheme Abstractions
10
Maxine VM
Dynamic Compilers Garbage Collector Object Layout Runtime
interface LayoutScheme interface ReferenceSchemeinterface HeapScheme
interface MonitorScheme interface RunSchemeinterface CompilationBroker
![Page 34: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/34.jpg)
Example: ReferenceScheme
11
What you use in Maxine to access a field:
int x = Reference.fromJava(obj).readInt(24); field offset (in bytes) is computed by LayoutScheme;we assume a constant offset in this example
![Page 35: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/35.jpg)
Example: ReferenceScheme
11
What you use in Maxine to access a field:
int x = Reference.fromJava(obj).readInt(24);
Actual call chain after forced inlining via @INLINE or @FOLD:
Reference ref = MaxineVM.vm.config.referenceScheme.toReference(obj);Pointer ptr = MaxineVM.vm.config.referenceScheme.toOrigin(ref);int x = ptr.readInt(24);
field offset (in bytes) is computed by LayoutScheme;we assume a constant offset in this example
![Page 36: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/36.jpg)
Example: ReferenceScheme
11
What you use in Maxine to access a field:
int x = Reference.fromJava(obj).readInt(24);
Actual call chain after forced inlining via @INLINE or @FOLD:
Reference ref = MaxineVM.vm.config.referenceScheme.toReference(obj);Pointer ptr = MaxineVM.vm.config.referenceScheme.toOrigin(ref);int x = ptr.readInt(24);
All fields are marked @CONSTANT, so the compiler knows theconcrete scheme implementation used:
class DirectReferenceScheme implements ReferenceScheme { @INTRINSIC(UNSAFE_CAST) native Reference toReference(Object origin); @INTRINSIC(UNSAFE_CAST) native Word toOrigin(Reference ref);}
field offset (in bytes) is computed by LayoutScheme;we assume a constant offset in this example
![Page 37: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/37.jpg)
Example: ReferenceScheme
11
What you use in Maxine to access a field:
int x = Reference.fromJava(obj).readInt(24);
Actual call chain after forced inlining via @INLINE or @FOLD:
Reference ref = MaxineVM.vm.config.referenceScheme.toReference(obj);Pointer ptr = MaxineVM.vm.config.referenceScheme.toOrigin(ref);int x = ptr.readInt(24);
All fields are marked @CONSTANT, so the compiler knows theconcrete scheme implementation used:
class DirectReferenceScheme implements ReferenceScheme { @INTRINSIC(UNSAFE_CAST) native Reference toReference(Object origin); @INTRINSIC(UNSAFE_CAST) native Word toOrigin(Reference ref);}
Final machine code:
movl [rax + 24], rbx
field offset (in bytes) is computed by LayoutScheme;we assume a constant offset in this example
![Page 38: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/38.jpg)
Baseline Compiler: T1X
12
job: assemble pre-generated bytecode templates• written in Java• compiled by optimising compiler at VM build time• very small amount of glue assembly
![Page 39: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/39.jpg)
Baseline Compiler: T1X
12
job: assemble pre-generated bytecode templates• written in Java• compiled by optimising compiler at VM build time• very small amount of glue assembly
template code for integer array load (IALOAD)@T1X_TEMPLATE(IALOAD)static int iaload(@Slot(1) Object array, @Slot(0) int index) { ArrayAccess.checkIndex(array, index); return result = ArrayAccess.getInt(array, index);}@INLINEstatic void checkIndex(Object array, int index) { int length = Layout.readArrayLength(Reference.fromJava(array)); if (UnsignedMath.aboveOrEqual(index, length)) { throw Throw.arrayIndexOutOfBoundsException(array, index); }}
@INLINEstatic int getInt(Object array, int index) { return Layout.getInt(Reference.fromJava(array), index);}
![Page 40: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/40.jpg)
Baseline Compiler: T1X
13
instantiated template code for integer array load
mov rdi, [rsp + 16] mov esi, [rsp] mov rax, rdi movsxd rax, [rax + 16] cmp esi, eax jb L1 call Throw.indexOutOfBoundsException() nop mov rdi, rax call MaxRuntimeCalls.runtimeUnwindException nop L1: movsxd rsi, esi movsxd rax, rdi[rsi * 4 + 24] addq rsp, 0x10 mov [rsp], eax
prologue(loading of operand stack slots)
compiled template
epilogue(storing of operand stack slots)
8 bytes hub (class pointer)8 bytes misc (locking, GC)4 bytes array length4 bytes alignment
![Page 41: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/41.jpg)
Inspector
14
![Page 42: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/42.jpg)
Optimising Compilers: C1X and Graal
15
HotSpot VMRuntime
InterpreterObject Locking
C1 / C2
Inline Assembly
Garbage Collector Type Information
Compiler Interface
C++
![Page 43: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/43.jpg)
Optimising Compilers: C1X and Graal
15
HotSpot VMRuntime
InterpreterObject Locking
C1 / C2
Inline Assembly
Garbage Collector Type Information
Compiler Interface
Java
C++
Maxine VMRuntime
T1XObject Locking
C1X
XIR
Garbage Collector Type Information
Compiler Interface
![Page 44: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/44.jpg)
Optimising Compilers: C1X and Graal
15
HotSpot VMRuntime
InterpreterObject Locking
C1 / C2
Inline Assembly
Garbage Collector Type Information
Compiler Interface
Java
C++
Maxine VMRuntime
T1XObject Locking
C1X
XIR
Garbage Collector Type Information
Compiler Interface
![Page 45: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/45.jpg)
Optimising Compilers: C1X and Graal
15
HotSpot VMRuntime
InterpreterObject Locking
C1 / C2
Inline Assembly
Garbage Collector Type Information
Compiler Interface
Java
C++
Maxine VMRuntime
T1XObject Locking
C1X
XIR
Garbage Collector Type Information
Compiler Interface
Graal VMRuntime
InterpreterObject Locking
Graal
Snippets
Garbage Collector Type Information
Compiler Interface
![Page 46: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/46.jpg)
Optimising Compilers: C1X and Graal
15
HotSpot VMRuntime
InterpreterObject Locking
C1 / C2
Inline Assembly
Garbage Collector Type Information
Compiler Interface
Java
C++
Maxine VMRuntime
T1XObject Locking
C1X
XIR
Garbage Collector Type Information
Compiler Interface
Graal VMRuntime
InterpreterObject Locking
Graal
Snippets
Garbage Collector Type Information
Compiler Interface
![Page 47: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/47.jpg)
Optimising Compilers: C1X and Graal
15
HotSpot VMRuntime
InterpreterObject Locking
C1 / C2
Inline Assembly
Garbage Collector Type Information
Compiler Interface
Java
C++
Maxine VMRuntime
T1XObject Locking
C1X
XIR
Garbage Collector Type Information
Compiler Interface
Graal VMRuntime
InterpreterObject Locking
Graal
Snippets
Garbage Collector Type Information
Compiler Interface
Maxine VM with GraalRuntime
T1XObject Locking
Graal
Snippets
Garbage Collector Type Information
Compiler Interface
![Page 48: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/48.jpg)
Optimising Compilers: C1X and Graal
15
HotSpot VMRuntime
InterpreterObject Locking
C1 / C2
Inline Assembly
Garbage Collector Type Information
Compiler Interface
Java
C++
Maxine VMRuntime
T1XObject Locking
C1X
XIR
Garbage Collector Type Information
Compiler Interface
Graal VMRuntime
InterpreterObject Locking
Graal
Snippets
Garbage Collector Type Information
Compiler Interface
Maxine VM with GraalRuntime
T1XObject Locking
Graal
Snippets
Garbage Collector Type Information
Compiler Interface
![Page 49: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/49.jpg)
Graal
16
Home page: http://openjdk.java.net/projects/graal/
Source (GPLv2): http://hg.openjdk.java.net/graal/graal/
Mailing list: [email protected]
Vision Statement
Create an extensible, modular, dynamic, and aggressive compiler using
object-oriented and reflective Java programming,
a graph-based and visualizable intermediate representation,
and Java snippets.
-- Thomas Würthinger
Collaboration with Johannes-Kepler-Universität Linz, Austria
Lukas Stadler, Gilles Duboscq, Christian Häubl, Prof. Hanspeter MössenböckJKU
![Page 50: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/50.jpg)
Graal
17
Architecture Lowering
Memory Optimisations
VM Lowering
Loop Optimisations
Escape Analysis
Type Inference
Method Inlining
Java Bytecode Parser
Peephole Optimisations
Register Allocation
Code Generation
Java Bytecodes
Machine Code
![Page 51: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/51.jpg)
Graal
17
Architecture Lowering
Memory Optimisations
VM Lowering
Loop Optimisations
Escape Analysis
Type Inference
Method Inlining
Java Bytecode Parser
Peephole Optimisations
Register Allocation
Code Generation
Java Bytecodes
Machine Code
![Page 52: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/52.jpg)
Graal
17
Architecture Lowering
Memory Optimisations
VM Lowering
Loop Optimisations
Escape Analysis
Type Inference
Method Inlining
Java Bytecode Parser
Peephole Optimisations
Register Allocation
Code Generation
Java Bytecodes
Machine Code
Language dependent
Language independentVM independent
Architecture independent
VM dependentArchitecture independent
VM dependentArchitecture dependent
![Page 53: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/53.jpg)
Performance: Maxine/C1X
18
2-socket dual core AMD Opteron 2214, 2.2 GHz, 4 total cores4 GByte main memory
Oracle Enterprise Linux, version 2.6.18-238.9.1.0.1.e15
71% 64%
58% 54%
76% 74%
151%
119%
81%
157%
191%
138%
0%
20%
40%
60%
80%
100%
120%
140%
160%
180%
200%
SPECjvm2008 DaCapo peak DaCapo startup SPECjbb2005 SciMark 2.0 JavaGrande
Client Maxine/C1X Server
![Page 54: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/54.jpg)
Performance: GraalVM
19
Intel(R) Core(TM) i5-750 @ 2.67GHz (4 cores)8 GByte main memory
Ubuntu Linux 11.10, kernel 3.0.0-12
72%
48%
66%
77%
61%
74%
0%
20%
40%
60%
80%
100%
120%
DaCapo Scala-DaCapo SPECjvm2008
Client GraalVM Server
![Page 55: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/55.jpg)
Maxine VM
Maxine: Code Cache Management
20
T1X
C1X
![Page 56: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/56.jpg)
Maxine VMT1X Cache C1X Cache
Maxine: Code Cache Management
20
m()
n()
o()
<clinit>
T1X
C1X
![Page 57: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/57.jpg)
Maxine VMT1X Cache C1X Cache
Maxine: Code Cache Management
20
m()
n()
o()
<clinit>
m()
o()
m()
o()
T1X
C1X
![Page 58: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/58.jpg)
Maxine VMT1X Cache C1X Cache
Maxine: Code Cache Management
20
m()
n()
o()
<clinit>
m()
o()
m()
o()
<clinit>
T1X
C1X
![Page 59: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/59.jpg)
Maxine VMT1X Cache C1X Cache
Maxine: Code Cache Management
20
m()
n()
o()
<clinit>
m()
o()
m()
o()
<clinit>
T1X
C1X
T1X Cache with Semi-Space Memory Management Scheme
to-space from-space
![Page 60: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/60.jpg)
Maxine VMT1X Cache C1X Cache
Maxine: Code Cache Management
20
m()
n()
o()
<clinit>
m()
o()
m()
o()
<clinit>
T1X
C1X
T1X Cache with Semi-Space Memory Management Scheme
to-space from-space
m() n()<clinit>
![Page 61: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/61.jpg)
Maxine VMT1X Cache C1X Cache
Maxine: Code Cache Management
20
m()
n()
o()
<clinit>
m()
o()
m()
o()
<clinit>
T1X
C1X
T1X Cache with Semi-Space Memory Management Scheme
to-space from-space
m() n()<clinit> o()
![Page 62: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/62.jpg)
Maxine VMT1X Cache C1X Cache
Maxine: Code Cache Management
20
m()
n()
o()
<clinit>
m()
o()
m()
o()
<clinit>
T1X
C1X
T1X Cache with Semi-Space Memory Management Scheme
to-space from-space
m() n()<clinit>
![Page 63: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/63.jpg)
Maxine VMT1X Cache C1X Cache
Maxine: Code Cache Management
20
m()
n()
o()
<clinit>
m()
o()
m()
o()
<clinit>
T1X
C1X
T1X Cache with Semi-Space Memory Management Scheme
to-space from-spaceto-spacefrom-space
m() n()<clinit>
![Page 64: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/64.jpg)
Maxine VMT1X Cache C1X Cache
Maxine: Code Cache Management
20
m()
n()
o()
<clinit>
m()
o()
m()
o()
<clinit>
T1X
C1X
T1X Cache with Semi-Space Memory Management Scheme
to-space from-spaceto-spacefrom-space
m() n()<clinit> n()<clinit>
![Page 65: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/65.jpg)
Maxine VMT1X Cache C1X Cache
Maxine: Code Cache Management
20
m()
n()
o()
<clinit>
m()
o()
m()
o()
<clinit>
T1X
C1X
T1X Cache with Semi-Space Memory Management Scheme
to-space from-spaceto-spacefrom-space
n()<clinit> n()<clinit> m()
![Page 66: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/66.jpg)
Maxine VMT1X Cache C1X Cache
Maxine: Code Cache Management
20
m()
n()
o()
<clinit>
m()
o()
m()
o()
<clinit>
T1X
C1X
T1X Cache with Semi-Space Memory Management Scheme
to-space from-spaceto-spacefrom-space
n()<clinit> n()<clinit> m() o()
![Page 67: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/67.jpg)
Code Cache Management: Which Methods are Live?
21
t1 call stack
baseline (T1X) method optimised (C1X) method ✔ live method
o()
T1X Cache
to-space from-space
p()
f()
g()
h()
g()
f() g() h() i() j()
k() l()
![Page 68: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/68.jpg)
Code Cache Management: Which Methods are Live?
21
t1 call stack
baseline (T1X) method optimised (C1X) method ✔ live method
o()
T1X Cache
to-space from-space
p()
f()
g()
h()
g()
f() g() h() i() j()
k() l()
✔ ✔ ✔
![Page 69: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/69.jpg)
Code Cache Management: Which Methods are Live?
21
t1 call stack
baseline (T1X) method optimised (C1X) method ✔ live method
o()
T1X Cache
to-space from-space
p()
f()
g()
h()
g()
f() g() h() i() j()
k() l()
k()
✔ ✔ ✔
✔
![Page 70: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/70.jpg)
Code Cache Management: Which Methods are Live?
21
t1 call stack
baseline (T1X) method optimised (C1X) method ✔ live method
o()
T1X Cache
to-space from-space
p()
f()
g()
h()
g()
f() g() h() i() j()
k() l()
k()
j()
✔ ✔ ✔ ✔
✔
![Page 71: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/71.jpg)
Code Cache Management: Which Methods are Live?
21
t1 call stack
baseline (T1X) method optimised (C1X) method ✔ live method
o()
T1X Cache
to-space from-space
p()
f()
g()
h()
g()
f() g() h() i() j()
k() l()
k()
j()
✔ ✔ ✔ ✔
✔
![Page 72: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/72.jpg)
Code Cache Management: Which Methods are Live?
21
t1 call stack
baseline (T1X) method optimised (C1X) method ✔ live method
o()
T1X Cache
to-space from-space
p()
f()
g()
h()
g()
f() g() h() i() j()
k() l()
k()
j()
live methods• methods on stack• direct callees of on-stack methods
others to protect from eviction• freshly compiled, not yet installed• invocation counter within optimisation threshold• existing type profile
✔ ✔ ✔ ✔
✔
![Page 73: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/73.jpg)
Code Cache Management: Eviction
22
t1 call stack
baseline (T1X) method optimised (C1X) method ✔ live method
o()
T1X Cache
from-space to-space
p()
f()
g()
h()
g()
i()
l()
j()
k()
f()✔ g()✔ h()✔ j()✔
k()✔
![Page 74: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/74.jpg)
Code Cache Management: Eviction
22
t1 call stack
baseline (T1X) method optimised (C1X) method ✔ live method
o()
T1X Cache
from-space to-space
p()
f()
g()
h()
g()
i()
l()
j()
k() course of action1. invalidate unmarked methods (and vtable entries, direct calls)
f()✔ g()✔ h()✔ j()✔
k()✔
![Page 75: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/75.jpg)
Code Cache Management: Eviction
22
t1 call stack
baseline (T1X) method optimised (C1X) method ✔ live method
o()
T1X Cache
from-space to-space
p()
f()
g()
h()
g()
j()
k() course of action1. invalidate unmarked methods (and vtable entries, direct calls)
f()✔ g()✔ h()✔ j()✔
k()✔
![Page 76: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/76.jpg)
Code Cache Management: Eviction
22
t1 call stack
baseline (T1X) method optimised (C1X) method ✔ live method
o()
T1X Cache
from-space to-space
p()
f()
g()
h()
g()
j()
k() course of action1. invalidate unmarked methods (and vtable entries, direct calls)2. move marked methods (update vtable entries, direct calls)
f()✔ g()✔ h()✔ j()✔
k()✔
![Page 77: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/77.jpg)
Code Cache Management: Eviction
22
t1 call stack
baseline (T1X) method optimised (C1X) method ✔ live method
o()
T1X Cache
from-space to-space
p()
f()
g()
h()
g()
j()
k() course of action1. invalidate unmarked methods (and vtable entries, direct calls)2. move marked methods (update vtable entries, direct calls)
f() g() h() j() k()
![Page 78: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/78.jpg)
Code Cache Management: Eviction
22
t1 call stack
baseline (T1X) method optimised (C1X) method ✔ live method
o()
T1X Cache
from-space to-space
p()
f()
g()
h()
g()
j()
k() course of action1. invalidate unmarked methods (and vtable entries, direct calls)2. move marked methods (update vtable entries, direct calls)3. patch return addresses
f() g() h() j() k()
![Page 79: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/79.jpg)
Code Cache Management: Eviction
22
t1 call stack
baseline (T1X) method optimised (C1X) method ✔ live method
o()
T1X Cache
from-space to-space
p()
f()
g()
h()
g()
j()
k() course of action1. invalidate unmarked methods (and vtable entries, direct calls)2. move marked methods (update vtable entries, direct calls)3. patch return addresses
f() g() h() j() k()
![Page 80: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/80.jpg)
Where Do Pointers to Machine Code Occur,and How Are They Handled?
23
vtables/itables ✓directly accessible via meta-level API (actors, hubs); invalidate (replace with trampoline calls) or relocate
direct calls ✓directly accessible via target method API (safepoints); invalidate (replace with trampoline calls) or relocate
return addresses ✓ accessible during stack walking; relocate accordingly
local variables ✖ These might have to be relocated—how to determine which Address is a code pointer?member variables ✖
These might have to be relocated—how to determine which Address is a code pointer?
![Page 81: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/81.jpg)
Where Do Pointers to Machine Code Occur,and How Are They Handled?
23
vtables/itables ✓directly accessible via meta-level API (actors, hubs); invalidate (replace with trampoline calls) or relocate
direct calls ✓directly accessible via target method API (safepoints); invalidate (replace with trampoline calls) or relocate
return addresses ✓ accessible during stack walking; relocate accordingly
local variables ✖ These might have to be relocated—how to determine which Address is a code pointer?member variables ✖
These might have to be relocated—how to determine which Address is a code pointer?
![Page 82: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/82.jpg)
Where Do Pointers to Machine Code Occur,and How Are They Handled?
23
vtables/itables ✓directly accessible via meta-level API (actors, hubs); invalidate (replace with trampoline calls) or relocate
direct calls ✓directly accessible via target method API (safepoints); invalidate (replace with trampoline calls) or relocate
return addresses ✓ accessible during stack walking; relocate accordingly
local variables ✖ These might have to be relocated—how to determine which Address is a code pointer?member variables ✖
These might have to be relocated—how to determine which Address is a code pointer?
![Page 83: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/83.jpg)
Where Do Pointers to Machine Code Occur,and How Are They Handled?
23
vtables/itables ✓directly accessible via meta-level API (actors, hubs); invalidate (replace with trampoline calls) or relocate
direct calls ✓directly accessible via target method API (safepoints); invalidate (replace with trampoline calls) or relocate
return addresses ✓ accessible during stack walking; relocate accordingly
local variables ✖ These might have to be relocated—how to determine which Address is a code pointer?member variables ✖
These might have to be relocated—how to determine which Address is a code pointer?
![Page 84: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/84.jpg)
Where Do Pointers to Machine Code Occur,and How Are They Handled?
23
vtables/itables ✓directly accessible via meta-level API (actors, hubs); invalidate (replace with trampoline calls) or relocate
direct calls ✓directly accessible via target method API (safepoints); invalidate (replace with trampoline calls) or relocate
return addresses ✓ accessible during stack walking; relocate accordingly
local variables ✖ These might have to be relocated—how to determine which Address is a code pointer?member variables ✖
These might have to be relocated—how to determine which Address is a code pointer?
![Page 85: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/85.jpg)
Tagged Code Pointers
24
Word
Address Offset
Pointer Size
CodePointer
Object
![Page 86: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/86.jpg)
Tagged Code Pointers
24
Word
Address Offset
Pointer Size
CodePointer
Object
1 tag bit63 bits payload (offset from base code address)
![Page 87: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/87.jpg)
Tagged Code Pointers
24
class CodePointer { ... @INLINE public static CodePointer from(long value) { if (isHosted()) { return new CodePointer(tag(value)); } return UnsafeCast.asCodePointer(tag(value)); } ...}
Word
Address Offset
Pointer Size
CodePointer
Object
1 tag bit63 bits payload (offset from base code address)
![Page 88: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/88.jpg)
Tagged Code Pointers
24
class CodePointer { ... @INLINE public static CodePointer from(long value) { if (isHosted()) { return new CodePointer(tag(value)); } return UnsafeCast.asCodePointer(tag(value)); } ...}
@INTRINSIC(UNSAFE_CAST)public static CodePointer asCodePointer(long value) { return CodePointer.from(value);}
Word
Address Offset
Pointer Size
CodePointer
Object
1 tag bit63 bits payload (offset from base code address)
![Page 89: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/89.jpg)
Stack Reference Maps and Tagged Code Pointers
25
static void m(int i, MyClass o) { int j = 2 * i; o.f(i);}
0: iconst_21: iload_02: imul3: istore_24: aload_15: iload_26: invokevirtual <f:(I)V>9: return
![Page 90: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/90.jpg)
Stack Reference Maps and Tagged Code Pointers
25
static void m(int i, MyClass o) { int j = 2 * i; o.f(i);}
0: iconst_21: iload_02: imul3: istore_24: aload_15: iload_26: invokevirtual <f:(I)V>9: return
i
o
j
arguments
locals
operands
1
2
3
4
5
<r>0 return address
idealised stack frame layout
![Page 91: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/91.jpg)
Stack Reference Maps and Tagged Code Pointers
25
static void m(int i, MyClass o) { int j = 2 * i; o.f(i);}
0: iconst_21: iload_02: imul3: istore_24: aload_15: iload_26: invokevirtual <f:(I)V>9: return
i
o
j
arguments
locals
operands
1
2
3
4
5
<r>0 return address
idealised stack frame layout
0 1 2 3 4 5
stack reference map(at instruction 6)
![Page 92: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/92.jpg)
Stack Reference Maps and Tagged Code Pointers
25
static void m(int i, MyClass o) { int j = 2 * i; o.f(i);}
0: iconst_21: iload_02: imul3: istore_24: aload_15: iload_26: invokevirtual <f:(I)V>9: return
i
o
j
arguments
locals
operands
1
2
3
4
5
<r>0 return address
idealised stack frame layout
0 1 2 3 4 5
stack reference map(at instruction 6)
void x(...) { ... MyClass o = ...; CodePointer cp = ...; ...}
![Page 93: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/93.jpg)
Stack Reference Maps and Tagged Code Pointers
25
static void m(int i, MyClass o) { int j = 2 * i; o.f(i);}
0: iconst_21: iload_02: imul3: istore_24: aload_15: iload_26: invokevirtual <f:(I)V>9: return
i
o
j
arguments
locals
operands
1
2
3
4
5
<r>0 return address
idealised stack frame layout
0 1 2 3 4 5
stack reference map(at instruction 6)
void x(...) { ... MyClass o = ...; CodePointer cp = ...; ...}
0 1 2 3 4 5
![Page 94: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/94.jpg)
Stack Reference Maps and Tagged Code Pointers
25
static void m(int i, MyClass o) { int j = 2 * i; o.f(i);}
0: iconst_21: iload_02: imul3: istore_24: aload_15: iload_26: invokevirtual <f:(I)V>9: return
i
o
j
arguments
locals
operands
1
2
3
4
5
<r>0 return address
idealised stack frame layout
0 1 2 3 4 5
stack reference map(at instruction 6)
void x(...) { ... MyClass o = ...; CodePointer cp = ...; ...}
0 1 2 3 4 5
Maxine VM
GC code eviction
stack reference map builder
![Page 95: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/95.jpg)
Stack Reference Maps and Tagged Code Pointers
25
static void m(int i, MyClass o) { int j = 2 * i; o.f(i);}
0: iconst_21: iload_02: imul3: istore_24: aload_15: iload_26: invokevirtual <f:(I)V>9: return
i
o
j
arguments
locals
operands
1
2
3
4
5
<r>0 return address
idealised stack frame layout
0 1 2 3 4 5
stack reference map(at instruction 6)
void x(...) { ... MyClass o = ...; CodePointer cp = ...; ...}
0 1 2 3 4 5
Maxine VM
GC code eviction
stack reference map builder
ignore tagged refs,scan others
![Page 96: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/96.jpg)
Stack Reference Maps and Tagged Code Pointers
25
static void m(int i, MyClass o) { int j = 2 * i; o.f(i);}
0: iconst_21: iload_02: imul3: istore_24: aload_15: iload_26: invokevirtual <f:(I)V>9: return
i
o
j
arguments
locals
operands
1
2
3
4
5
<r>0 return address
idealised stack frame layout
0 1 2 3 4 5
stack reference map(at instruction 6)
void x(...) { ... MyClass o = ...; CodePointer cp = ...; ...}
0 1 2 3 4 5
Maxine VM
GC code eviction
stack reference map builder
ignore tagged refs,scan others
regard and relocateonly tagged refs
![Page 97: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/97.jpg)
<Insert
26
Thank you for your attention.
Acknowledgements: these slides are joint work of the VM research group.
Home page: http://wikis.oracle.com/display/MaxineVM/Home
Source (GPLv2): https://hg.kenai.com/hg/maxine~maxine
Mailing list via: http://kenai.com/projects/maxine
![Page 98: Maxine A JVM in Java - JUG Saxony3 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into](https://reader033.fdocuments.in/reader033/viewer/2022041822/5e5e83c4e4f2f872460ac8b7/html5/thumbnails/98.jpg)