State of java.lang.invoke Implementation in OpenJDK

Size: px
Start display at page:

Download "State of java.lang.invoke Implementation in OpenJDK"

Transcription

1 State of java.lang.invoke Implementation in OpenJDK Vladimir Ivanov HotSpot JVM Compile r Oracle Corp. JVM Language Summit

2 Safe Harbor Statement 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. 2

3 JSR 292 Support for Dynamically Typed Languages in the JVM Initial design sketch 2005 JSR 292 Expert Group formed Expert Group reboot Method Handle API (Early Draft Review) API refinement (e.g., CONSTANT_MethodHandle) Java 7 Release API refinement (e.g., BootstrapMethods) 3

4 Method Handles in JDK 7 GA Good Flexible and powerful. MH graphs are aggressively inlined and optimized. Not-so-good Performance cliff when inlining does not occur MH.invoke() is slow NoClassDefFoundError in large applications Ugly No general fast path for compiled code JVM is entangled in MH operations 4

5 Quest for a Better IR 2012: Lambda Forms in 7u40 Root problem: MH chains are wrong IR for the JVM Lambda Forms for the rescue Mostly-native moves into Java Decouple representation decisions from the JVM Meshes better with the JVM execution engine translates to bytecode Interprets and/or compiles Erases types, avoiding NCDFE issues 5

6 MHs vs LFs A method handle is a typed, directly executable reference to an underlying method, constructor, field, or similar low-level operation, with optional transformations of arguments or return values. [A lambda form is a] symbolic, non-executable form of a method handle's invocation semantics. javadoc public internal MH.form n:1 LF 6

7 The Grand Plan JDK MH.type public n:1 n:1 MT.target CS MH = MethodHandle MT = MethodType CS = CallSite 7

8 JDK public internal The Grand Plan LF MN.form.vmentry MH n:1 n:1.type n:1 extends n:1 MT DMH BMH VM anon classes.target n:1 CS MTF MH = MethodHandle MT = MethodType CS = CallSite LF = LambdaForm DMH = DirectMethodHandle BMH = BoundMethodHandle MN = MemberName MTF = MethodTypeForm 8

9 JDK public internal The Grand Plan LF MN.form.vmentry.vmtarget MH n:1 n:1 n:1.type n:1 extends n:1 MT DMH MH::linkTo* MH::invokeBasic BMH VM anon classes.target n:1 CS MTF MH = MethodHandle MT = MethodType CS = CallSite LF = LambdaForm DMH = DirectMethodHandle BMH = BoundMethodHandle MN = MemberName MTF = MethodTypeForm MHN = MethodHandleNative Upcalls MHN VM calls JVM 9 JVM_Method native stubs appendix resolved_references[] linkcallsite linkmethod etc methodhandles*.cpp MH::init/resolve setcallsitetarget* etc

10 Lambda Form Example: putfield / Lookup.findSetter putobjectfieldcast_000=lambda(a0:l,a1:l,a2:l)=>{ t3:j=dmh.fieldoffset (a0:l); t4:l=dmh.checkbase (a1:l); t5:l=dmh.checkcast (a0:l,a2:l); t6:v=unsafe.putobject((unsafe@...),t4:l,t3:j,t5:l);void} 10

11 Lambda Form Example: putfield / Lookup.findSetter putobjectfieldcast_000=lambda(a0:l,a1:l,a2:l)=>{ t3:j=dmh.fieldoffset (a0:l); t4:l=dmh.checkbase (a1:l); t5:l=dmh.checkcast (a0:l,a2:l); t6:v=unsafe.putobject((unsafe@...),t4:l,t3:j,t5:l);void} Basic value type is one of { ref, int, long, float, double } + void represented as signature letters "LIJFD + V 11

12 Lambda Form Example: putfield / Lookup.findSetter LF.arity = 3 LF.debugName LF.names[7] putobjectfieldcast_000=lambda(a0:l,a1:l,a2:l)=>{ t3:j=dmh.fieldoffset (a0:l); t4:l=dmh.checkbase (a1:l); t5:l=dmh.checkcast (a0:l,a2:l); t6:v=unsafe.putobject((unsafe@...),t4:l,t3:j,t5:l);void} Name.function Name.arguments[] Name.type LF.result = -1 Name.index 12

13 Lambda Form Execution putobjectfieldcast_000=lambda(a0:l,a1:l,a2:l)=>{ t3:j=dmh.fieldoffset (a0:l); t4:l=dmh.checkbase (a1:l); t5:l=dmh.checkcast (a0:l,a2:l); 13

14 Lambda Form Execution MH Entry point: LambdaForm::vmentry interpreter compiled code MH.form LF LF? class (VM anon) Can point to: LambdaForm Interpreter compiled bytecode.vmentry MN.vmtarget JVM_Method.from_interpreted.from_compiled 14

15 Lambda Form Interpreter 15

16 t3:j t4:l t5:l t6:v Lambda Form Compiled Form static void putobjectfieldcast_000( Object, Object, Object ); 0: aload_0 1: invokestatic #16 // DMH.fieldOffset:... 4: lstore_3 5: aload_1 6: invokestatic #20 // DMH.checkBase:... 9: astore 5 11: aload_0 12: aload_2 13: invokestatic #24 // DMH.checkCast:... 16: astore 6 a0:l a1:l a2:l 18: ldc #26 // <<sun.misc.unsafe@3830f1c0>> 20: checkcast #28 // class sun/misc/unsafe 23: aload 5 25: lload_3 26: aload 6 28: invokevirtual #32 // Unsafe.putObject:(Object;Object;)V 31: return putobjectfieldcast_000=lambda(a0:l,a1:l,a2:l)=>{ t3:j=dmh.fieldoffset (a0:l); t4:l=dmh.checkbase (a1:l); t5:l=dmh.checkcast (a0:l,a2:l); t6:v=unsafe.putobject((unsafe@...),t4:l,t3:j,t5:l);void} 16 RuntimeVisibleAnnotations: LambdaForm$Hidden, LambdaForm$Compiled, ForceInline

17 t6:v VM Anonymous Classes Constant Pool Patching static void putobjectfieldcast_000( );... 18: ldc #26 // String CONSTANT_PLACEHOLDER_0 20: checkcast #28 // class sun/misc/unsafe 23: aload 5 25: lload_3 26: aload 6 28: invokevirtual #32 // Unsafe.putObject(...) 31: return putobjectfieldcast_000=lambda(a0:l,a1:l,a2:l)=>{ t3:j=dmh.fieldoffset (a0:l); t4:l=dmh.checkbase (a1:l); t5:l=dmh.checkcast (a0:l,a2:l); t6:v=unsafe.putobject((unsafe@...),t4:l,t3:j,t5:l);void} Unsafe.defineAnonymousClass( LambdaForm.class, byte[] { }, Object[] {, unsafeobj, }) #26 ConstantPool #26 = Utf resolved_references[] {..., unsafeobj,...} 17

18 MHs vs LFs Sharing vs Customization MH Shared Lambda Form many method handles share a single LF instance LF Customized Lambda Form LF instance is customized for some particular method handle MH LF 18

19 MHs vs LFs Example: putfield / Lookup.findSetter LOOKUP.findSetter( MyClass1.class, f1", Field1.class); LOOKUP.findSetter( MyClass2.class, f2", Field2.class); MT MH (MyClass1,Field1)void Field1.class offset1 constructs (MyClass2,Field2)void Field2.class offset2 MH 19 LF.form (L,L,L)void.form putobjectfieldcast_000=lambda(a0:l,a1:l,a2:l)=>{ t3:j=dmh.fieldoffset (a0:l); t4:l=dmh.checkbase (a1:l); t5:l=dmh.checkcast (a0:l,a2:l); t6:v=unsafe.putobject((unsafe@...),t4:l,t3:j,t5:l);void} LF

20 MHs vs LFs Example: putfield / Lookup.findSetter LOOKUP.findSetter( MyClass1.class, i1", int.class); LOOKUP.findSetter( MyClass2.class, l2", long.class); MH MT MH (MyClass1,int)void int.class offset1 constructs (MyClass2,long)void long.class offset2.form (L,L,I)void putintfield_000=lambda(a0:l,a1:l,a2:i)=>{ t3:j=dmh.fieldoffset (a0:l); t4:l=dmh.checkbase (a1:l); t5:v=unsafe.putint((unsafe@...),t4:l,t3:j,a2:i);void} (L,L,J)void.form putlongfield_000=lambda(a0:l,a1:l,a2:j)=>{ t3:j=dmh.fieldoffset (a0:l); t4:l=dmh.checkbase (a1:l); t5:v=unsafe.putlong((unsafe@...),t4:l,t3:j,a2:j);void} LF 20 LF

21 JSR 292 Released 7 GA 7u40 8 GA 8u20 8u40 Lambda Forms Nashorn Project Lambda j.l.i enhancements Type speculation in C2 Math.exact*() intrinsics Lambda Form Sharing 21

22 22

23 Lambda Form Caching 8u40: JEP 210 MH ~10 6 MH LF ~10 6 ~10 3 LF ~10 4 ~10 3 classes classes 23

24 Sharing vs Customization Example: MHs.guardWithTest() 24 T guard(a... a, B... b) { if (test(a...)) return target(a..., b...); else return fallback(a..., b...); } guard=lambda(a0:l, a, b ) => { t1:i =<<test>>(a ); t2:l=mhi.selectalternative( t1:i, <<target>>, <<fallback>>); t3:?=mh.invokebasic(t2:l, a, b );t3}

25 Sharing vs Customization Example: Customized version guard_000=lambda(a0:l)=>{ t1:i t2:l=mhi.selectalternative( t3:v=mh.invokebasic(t2:l);void} test: MethodHandle target: MethodHandle fallback: MethodHandle static void guard_000(object); ldc... // <<MethodHandle()boolean>> checkcast... // class MethodHandle invokevirtual... // MethodHandle.invokeBasic:()I if_icmpne ldc checkcast astore_2 aload_2... // <<MethodHandle()void>>... // class MethodHandle invokevirtual... // MethodHandle.invokeBasic:()V goto ldc... // <<MethodHandle()void>> checkcast... // class MethodHandle astore_2 aload_2 invokevirtual... // MethodHandle.invokeBasic:()V return t1:i t2:l + t3:v 25

26 Sharing vs Customization Example: Shareable version guard_000=lambda(a0:l)=>{ t3:l=bmh$species_l3.argl0(a0:l); // test t4:l=bmh$species_l3.argl1(a0:l); // target t5:l=bmh$species_l3.argl2(a0:l); // fallback t6:i =MethodHandle.invokeBasic(t3:L); t7:l=methodhandleimpl.selectalternative(t6:i,t4:l,t5:l); t8:v=methodhandle.invokebasic(t7:l);void} 26

27 Lambda Form Sharing Pros Smaller dynamic footprint # of loaded classes, Metaspace size Faster startup/warmup less LFs to instantiate, less classes to load, less code to compile Enables new optimizations Lambda Form precompilation Improves worst case stack consumption 27

28 Lambda Form Sharing Dynamic Footprint 16 8 ratio 4 2 metaspace classes 1 Octane 28 higher/better 8u40: b05 vs b21, Nashorn Measurements by Sergey Kuksenko

29 Lambda Form Sharing Startup / Warmup 354% % higher/better 1 st iteration duration 8u40: b05 vs b21, Nashorn

30 Lambda Form Precompilation Before: first 30 invocations go through LF interpreter then compiled to bytecode After: Lambda Form is precompiled during creation completely bypasses LF interpreter 30

31 Stack Consumption Lambda Form Interpreter jdk.nashorn.internal.scripts.script$recompilation$2$test.f1(test.js:1) j.l.i.lambdaform$dmh/ invokestatic_ll_l j.l.i.lambdaform$dmh/ invokespecial_l3_l j.l.i.lambdaform$namedfunction.invoke_lll_l test.js: 1: function f1() {} 2: f1() j.l.i.lambdaform$dmh/ invokestatic_ll_l j.l.i.lambdaform$namedfunction.invokewitharguments j.l.i.lambdaform.interpretname j.l.i.lambdaform.interpretwitharguments j.l.i.lambdaform.interpret_l j.l.i.lambdaform$dmh/ invokespecial_l3_l j.l.i.lambdaform$namedfunction.invoke_lll_l j.l.i.lambdaform$dmh/ invokestatic_ll_l j.l.i.lambdaform$namedfunction.invokewitharguments j.l.i.lambdaform.interpretname j.l.i.lambdaform.interpretwitharguments j.l.i.lambdaform.interpret_l reinvoke exactinvoker j.l.i.lambdaform$mh/ linktocallsite jdk.nashorn.internal.scripts.script$recompilation$1$test.:program(test.js:2) 31

32 Stack Consumption Compiled Form jdk.nashorn.internal.scripts.script$recompilation$2$test.f1(test.js:1) j.l.i.lambdaform$dmh/ invokestatic_ll_l j.l.i.lambdaform$bmh/ reinvoke j.l.i.lambdaform$mh/ exactinvoker j.l.i.lambdaform$mh/ linktocallsite jdk.nashorn.internal.scripts.script$recompilation$1$test.:program(test.js:9) 32

33 Lambda Form Sharing Peak Performance % % higher/better 8u40: b05 vs b21, Nashorn Measurements by Sergey Kuksenko

34 Lambda Form Sharing Problems in 8u40 Profile pollution peak performance suffers Non-constant MH calls became slower JIT can t inline through them less optimized machine code 34

35 Profile Pollution Customization vs Sharing 35

36 Profile Pollution Customized version static void guard_000(object); guard_000=lambda(a0:l)=>{ t1:i =<<test>>(); t2:l=methodhandleimpl.selectalternative( t1:i,<<target>>,<<fallback>>); t3:v=methodhandle.invokebasic(t2:l);void} ldc... // <<test>> checkcast... // class MethodHandle invokevirtual... // MethodHandle.invokeBasic:()I if_icmpne ldc checkcast astore_2 aload_2... // <<target>>... // class MethodHandle invokevirtual... // MH.invokeBasic:()V goto ldc... // <<fallback>> checkcast... // class MethodHandle astore_2 aload_2 invokevirtual... // MethodHandle.invokeBasic:()V return t1:i t2:l + t3:v 36

37 Profile Pollution Customized version static void guard_000(object); 0% guard_000=lambda(a0:l)=>{ t1:i =<<alwaystrue>>(); t2:l=methodhandleimpl.selectalternative( t1:i,<<target>>,<<fallback>>); t3:v=methodhandle.invokebasic(t2:l);void} ldc... // <<alwaystrue>> checkcast... // class MethodHandle invokevirtual... // MH.invokeBasic:()I if_icmpne ldc checkcast astore_2 aload_2... // <<target>>... // class MethodHandle invokevirtual... // MH.invokeBasic:()V goto ldc... // <<fallback>> checkcast... // class MethodHandle astore_2 aload_2 invokevirtual... // MH.invokeBasic:()V return t1:i t2:l + t3:v 37

38 Profile Pollution Customized version static void guard_001(object); 100% guard_001=lambda(a0:l)=>{ t1:i =<<alwaysfalse>>; t2:l=methodhandleimpl.selectalternative( t1:i,<<target>>,<<fallback>>); t3:v=methodhandle.invokebasic(t2:l);void} ldc... // <<alwaysfalse>> checkcast... // class MethodHandle invokevirtual... // MH.invokeBasic:()I if_icmpne ldc checkcast astore_2 aload_2... // <<target>>... // class MethodHandle invokevirtual... // MH.invokeBasic:()V goto ldc... // <<fallback>> checkcast... // class MethodHandle astore_2 aload_2 invokevirtual... // MH.invokeBasic:()V return t1:i t2:l + t3:v 38

39 Profile Pollution Shared version static void guard_000(object);???% aload_0 checkcast // BMH$Species_L3 getfield... // BMH$Species_L3.argL0:Object invokevirtual... // MH.invokeBasic:()I if_icmpne aload_2 checkcast... // class MethodHandle astore_5 aload_5 invokevirtual... // MH.invokeBasic:()V goto aload_3 checkcast... // class MethodHandle astore_5 aload_5 invokevirtual... // MH.invokeBasic:()V return 39

40 Profile Pollution How to fix Idea: customized profiling collect per-methodhandle profile during warm-up inject profile into the JVM when warm-up is over?% static void guard_000(object); aload_0 checkcast // BMH$Species_L3 getfield... // BMH$Species_L3.argL0:Object invokevirtual... // MH.invokeBasic:()I if_icmpne aload_2 checkcast... // class MethodHandle astore_5 aload_5 invokevirtual... // MH.invokeBasic:()V goto aload_3 checkcast... // class MethodHandle astore_5 aload_5 invokevirtual... // MH.invokeBasic:()V return 40

41 Profile Pollution Custom Branch Profiling guard_000=lambda(a0:l)=>{ t1:l=bmh$species_l4.argl0(a0:l); // test t2:l=bmh$species_l4.argl1(a0:l); // target t3:l=bmh$species_l4.argl2(a0:l); // fallback t4:l=bmh$species_l4.argl3(a0:l); // counts (int[2]) t5:i =MethodHandle.invokeBasic(t1:L); t6:i =MethodHandleImpl.profileBoolean(t5:I,t4:L); t7:l=methodhandleimpl.selectalternative(t6:i,t2:l,t3:l); t8:v=methodhandle.invokebasic(t7:l);void} 41

42 Profile Pollution Custom Branch Profiling Logic profiling / warm-up interpreter / C1 C2 when counts array is unknown per-lambdaform compiled method optimized C2 intrinsic injects per-mh counts into IR 42

43 Profile Pollution Custom Branch Profiling Logic profiling / warm-up interpreter / C1 C2 when counts array is unknown per-lambdaform compiled method optimized C2 intrinsic injects per-mh counts into IR 43

44 Profile Pollution Other cases Type profile not a problem Type speculation (by Roland Westrelin in 8u20) -XX:+UseTypeProfile -XX:TypeProfileLevel=[012]{3} Deoptimization counts no generic solution yet fixed some manifestations of the problem JDK : GWT can be marked non-compilable due to deopt count pollution 44

45 Non-Constant Method Handle Invocation MH.invokeExact() et al 45

46 Non-Constant Method Handle Invocation Non-constant method 105 jsr292.gwt::run1 (7 bytes) inline 3 java.lang.invoke.lambdaform$mh/ ::invokeexact_mt (13 bytes) inline 2 java.lang.invoke.invokers::checkexacttype (30 bytes) inline 11 java.lang.invoke.methodhandle::type (5 bytes) 9 java.lang.invoke.methodhandle::invokebasic()v (0 bytes) receiver not constant 46

47 Non-Constant Method Handle Invocation Customized version java.lang.invoke.lambdaform$mh/ ::guard (56 5 java.lang.invoke.lambdaform$dmh/ ::invokestatic I (13 bytes) inline 1 java.lang.invoke.directmethodhandle::internalmembername (8 bytes) inline 9 jsr292.gwt::test1 (12 bytes) inline 31 java.lang.invoke.lambdaform$dmh/ ::invokestatic V (13 bytes) inline 1 java.lang.invoke.directmethodhandle::internalmembername (8 bytes) inline 9 jsr292.gwt::f1 (2 bytes) inline 52 java.lang.invoke.lambdaform$dmh/ ::invokestatic V (13 bytes) inline 1 java.lang.invoke.directmethodhandle::internalmembername (8 bytes) inline 9 jsr292.gwt::f2 (2 bytes) inline (hot) 47

48 Non-Constant Method Handle Invocation Shared version java.lang.invoke.lambdaform$mh/ ::guard (68 24 java.lang.invoke.methodhandle::invokebasic()i (0 bytes) receiver not 47 java.lang.invoke.methodhandle::invokebasic()v (0 bytes) receiver not 64 java.lang.invoke.methodhandle::invokebasic()v (0 bytes) receiver not constant 48

49 Non-Constant Method Handle Invocation Customized Lambda Form single compiled method per MH chain / root LF nmethod Shared Lambda Form compiled method per MH/LF 49

50 Non-Constant Method Handle Invocation Solution: Optional Customization nmethod Original (shared) guard_000=lambda(a0:l)=>{ t1:l=bmh$species_l4.argl0(a0:l); Customized (a0 is overridden by t1:l) guard_000=lambda(a0:l)=>{ t1:l=<<methodhandle >> t2:l=bmh$species_l4.argl0(t1:l); 50

51 Timeline 7 GA 7u40 8 GA 8u20 8u40 8u60 9+ λ-forms Nashorn Project Lambda catchexception λ-form sharing type speculation Math.exact*() intrinsics λ-form sharing Now Aug, 2015 Performance fixes (e.g. per-mh profiling, LF customization) 51

52 Future work Ultimate Sharing MH.asType() Optimization Reduce Stack Consumption Lightweight Code Loading Profile Pollution 52

53 Ultimate Sharing call site LF [ I, J, L,, F ] [ I, J, L,, F ]... Currently: Lambda Form instance per erased signature Goal: Single Lambda Form instance per unit of behavior LF [ I, J, L,, F ] target [ I, J, L,, F ] 53

54 Ultimate Sharing call site No conversions [ I, J, L,, F ] Boxing [ I, J, L,, F ] LF [ I, J, L,, F ] [ L, L, L,, L ] LF [ I, J, L,, F ] [ L, L, L,, L ] target [ I, J, L,, F ] [ I, J, L,, F ] 54

55 Ultimate Sharing call site No conversions Boxing Boxing + VarArgs [ I, J, L,, F ] [ I, J, L,, F ] [ I, J, L,, F ] LF [ I, J, L,, F ] [ L, L, L,, L ] [ L ] LF [ I, J, L,, F ] [ L, L, L,, L ] [ L ] target [ I, J, L,, F ] [ I, J, L,, F ] [ I, J, L,, F ] 55

56 Ultimate Sharing [ I, J, L,, F ] [ I, J, L,, F ] JVM support is needed reliable box/unbox elimination array explosion [ L ] [ ] [ L ] [ ] [ I, J, L,, F ] [ I, J, L,, F ] 56

57 MethodHandle.asType() Better Caching / Sharing Improve caching/sharing of MH.asType() transformations type adaptations are expensive to construct Single-element per-mh cache subject to profile pollution MH.invoke() on shared MH doesn t work well (w.r.t. peak performance) 57

58 Reduce stack consumption Precompiled Lambda Forms jdk.nashorn.internal.scripts.script$recompilation$2$test.f1(test.js:1) j.l.i.lambdaform$dmh/ invokestatic_ll_l j.l.i.lambdaform$bmh/ reinvoke j.l.i.lambdaform$mh/ exactinvoker j.l.i.lambdaform$mh/ linktocallsite jdk.nashorn.internal.scripts.script$recompilation$1$test.:program(test.js:9) 58

59 Reduce stack consumption (1) Lambda Form Inlining jdk.nashorn.internal.scripts.script$recompilation$2$test.f1(test.js:1) j.l.i.lambdaform$dmh/ invokestatic_ll_l j.l.i.lambdaform$bmh/ reinvoke j.l.i.lambdaform$mh/ exactinvoker j.l.i.lambdaform$mh/ linktocallsite j.l.i.lf$mh/.customized jdk.nashorn.internal.scripts.script$recompilation$1$test.:program(test.js:9) 59

60 Reduce stack consumption (1) Lambda Form Inlining jdk.nashorn.internal.scripts.script$recompilation$2$test.f1(test.js:1) j.l.i.lambdaform$mh/ customized j.l.i.lambdaform$mh/ linktocallsite jdk.nashorn.internal.scripts.script$recompilation$1$test.:program(test.js:9) 60

61 Reduce stack consumption (1) Lambda Form Inlining Pros easy to implement doesn t require any JVM extensions Cons defeats Lambda Form sharing too many indy call sites to specialize for VM anonymous classes are too heavyweight 61

62 Reduce stack consumption (2) Tail Calls jdk.nashorn.internal.scripts.script$recompilation$2$test.f1(test.js:1) (*) jdk.nashorn.internal.scripts.script$recompilation$1$test.:program(test.js:9) (*) during invocation: linktocallsite =tail-call=> reinvoke =tail-call=> exactinvoker =tail-call=> invokestatic_ll_l =tail-call=> $test.f1 62

63 Lightweight Code Loading VM Anonymous Classes Class<?> Unsafe.defineAnonymousClass( Class<?> hostclass, byte[] code, Object[] cppatches) 63

64 Lightweight Code Loading VM Anonymous Classes Class<?> Unsafe.defineAnonymousClass( Class<?> hostclass, byte[] code, Object[] cppatches) 64

65 Lightweight Code Loading MethodHandle Lookup.loadCode( /*Class<?> hostclass,*/ byte[] code, Object[] cppatches) 65

66 Profile Pollution MH LF class 66

67 Future Extensions Variable Handles Small API Enhancements Native Calls 67

68 JEP 193: Variable Handles Safe, performant, enhanced atomics access to fields and array elements VarHandles are like method handles for data Abstracts over location static fields, instance fields, arrays, off heap Supports explicit fences and atomic operation Safer than Unsafe, as fast as MethodHandles 68 JEP-193 Variable Handles by Doug Lea, Paul Sandoz

69 API Enhancements Candidates MHs.tryFinally() MHs.*Loop() Lookup.lookupClass()/findSuperConstructor() Additional combinators for argument handling e.g. MHs.spreadArguments(MH target, int pos, int count) discussion 69

70 Native Calls Project Panama: FFI Java Native Construction Lookup.findVirtual() et al Lookup.findNative() Reference (typed) Reference (direct) DirectMethodHandle MemberName NativeMethodHandle NativeEntryPoint Linker MH.linkToVirtual() et al MH.linkToNative() Invocation indy, MH.invoke(), MH.invokeExact() 70 Making native calls from the JVM by John Rose

71 Thank 71

72 Materials Implementation Notes: "Deconstructing MethodHandles by Paul Sandoz "Lambda Forms by John Rose, JVMLS'12 J9's MethodHandle Compilation Pipeline by Dan Heidinga, Jfocus VM Summit

73 Graphic Section Divider 73

Invokedynamic: Deep Dive

Invokedynamic: Deep Dive Invokedynamic: Deep Dive Vladimir Ivanov, @iwan0www HotSpot JVM Compile r Oracle vladimir.x.ivanov@oracle.com 1 14.03.2015 Agenda Introduction Public API Internals 2 Introduction 3 JSR 292 History Supporting

More information

2012 Oracle Corporation. Monday, July 30, 12

2012 Oracle Corporation. Monday, July 30, 12 Lambda Forms: IR for Method Handles John R. Rose Da Vinci Machine Project, JSR 292 Lead The following is intended to outline our general product direction. It is intended for information

More information

JSR 292 backport. (Rémi Forax) University Paris East

JSR 292 backport. (Rémi Forax) University Paris East JSR 292 backport (Rémi Forax) University Paris East Interactive talk Ask your question when you want Just remember : Use only verbs understandable by a 4 year old kid Use any technical words you want A

More information

JSR 292 and companions Rémi Forax FOSDEM'09

JSR 292 and companions Rémi Forax FOSDEM'09 JSR 292 and companions Rémi Forax FOSDEM'09 Da Vinci Mission Prototype (J)VM extensions to run non-java languages efficiently Complete the existing architecture with general purpose extensions New languages

More information

invokedynamic under the hood

invokedynamic under the hood Nadeesh T V ORACLE India Pvt Ltd 26 Aug 2016 Outline 1 JVM Languages 2 PreInvokedynamic 3 Invokedynamic 4 MethodHandle 5 Summary JVM Languages Languages which can run on Java Virtual Machine (JVM) Should

More information

MethodHandlesArrayElementGetterBench.testCreate Analysis. Copyright 2016, Oracle and/or its affiliates. All rights reserved.

MethodHandlesArrayElementGetterBench.testCreate Analysis. Copyright 2016, Oracle and/or its affiliates. All rights reserved. MethodHandlesArrayElementGetterBench.testCreate Analysis Overview Benchmark : nom.indy.methodhandlesarrayelementgetterbench.testcreate Results with JDK8 (ops/us) JDK8 Intel 234 T8 T8 with -XX:FreqInlineSize=325

More information

invokedynamic IN 45 MINUTES!!! Wednesday, February 6, 13

invokedynamic IN 45 MINUTES!!! Wednesday, February 6, 13 invokedynamic IN 45 MINUTES!!! Me Charles Oliver Nutter headius@headius.com, @headius blog.headius.com JRuby Guy at Sun, Engine Yard, Red Hat JVM enthusiast, educator, contributor Earliest adopter of invokedynamic

More information

MethodHandle implemention tips and tricks

MethodHandle implemention tips and tricks MethodHandle implemention tips and tricks Dan Heidinga J9 VM Software Developer daniel_heidinga@ca.ibm.com J9 Virtual Machine 2011 IBM Corporation MethodHandles: a 30 sec introduction A method handle is

More information

April 15, 2009 John R. Rose, Sr. Staff Engineer

April 15, 2009 John R. Rose, Sr. Staff Engineer New JVM Plumbing: Method Handles and More April 15, 2009 John R. Rose, Sr. Staff Engineer john.rose@sun.com http://blogs.sun.com/jrose 1 Method Handles are Anonymous references to JVM methods Like methods,

More information

MethodHandle Introspection: Internals

MethodHandle Introspection: Internals Dan Heidinga J9 Virtual Machine 30 July 2012 MethodHandle Introspection: Internals Standard disclaimer IBM s statements regarding its plans, directions and intent are subject to change or withdrawal at

More information

JSR 292 Cookbook: Fresh Recipes with New Ingredients

JSR 292 Cookbook: Fresh Recipes with New Ingredients JSR 292 Cookbook: Fresh Recipes with New Ingredients John Rose Christian Thalinger Sun Microsystems Overview Got a language cooking on the JVM? JSR 292, a set of major changes to the JVM architecture,

More information

<Insert Picture Here> Get on the Grid. JVM Language Summit Getting Started Guide. Cameron Purdy, VP of Development, Oracle

<Insert Picture Here> Get on the Grid. JVM Language Summit Getting Started Guide. Cameron Purdy, VP of Development, Oracle Get on the Grid JVM Language Summit Getting Started Guide Cameron Purdy, VP of Development, Oracle The following is intended to outline our general product direction. It is intended

More information

CSE P 501 Compilers. Java Implementation JVMs, JITs &c Hal Perkins Winter /11/ Hal Perkins & UW CSE V-1

CSE P 501 Compilers. Java Implementation JVMs, JITs &c Hal Perkins Winter /11/ Hal Perkins & UW CSE V-1 CSE P 501 Compilers Java Implementation JVMs, JITs &c Hal Perkins Winter 2008 3/11/2008 2002-08 Hal Perkins & UW CSE V-1 Agenda Java virtual machine architecture.class files Class loading Execution engines

More information

Agenda. CSE P 501 Compilers. Java Implementation Overview. JVM Architecture. JVM Runtime Data Areas (1) JVM Data Types. CSE P 501 Su04 T-1

Agenda. CSE P 501 Compilers. Java Implementation Overview. JVM Architecture. JVM Runtime Data Areas (1) JVM Data Types. CSE P 501 Su04 T-1 Agenda CSE P 501 Compilers Java Implementation JVMs, JITs &c Hal Perkins Summer 2004 Java virtual machine architecture.class files Class loading Execution engines Interpreters & JITs various strategies

More information

<Insert Picture Here> Implementing lambda expressions in Java

<Insert Picture Here> Implementing lambda expressions in Java Implementing lambda expressions in Java Brian Goetz Java Language Architect Adding lambda expressions to Java In adding lambda expressions to Java, the obvious question is: what is

More information

Compiling Faster, Compiling Better with Falcon. Iván

Compiling Faster, Compiling Better with Falcon. Iván Compiling Faster, Compiling Better with Falcon Iván Krȳlov @JohnWings Compiling Faster, Compiling Better with Falcon Overview of 3 technologies Falcon compiler ReadyNow & Compile Stashing Challenges (largely

More information

JVML Instruction Set. How to get more than 256 local variables! Method Calls. Example. Method Calls

JVML Instruction Set. How to get more than 256 local variables! Method Calls. Example. Method Calls CS6: Program and Data Representation University of Virginia Computer Science Spring 006 David Evans Lecture 8: Code Safety and Virtual Machines (Duke suicide picture by Gary McGraw) pushing constants JVML

More information

Copyright 2013, Oracle and/or its affiliates. All rights reserved.

Copyright 2013, Oracle and/or its affiliates. All rights reserved. 1 Lambda: A peek under the hood Brian Goetz Java Language Architect, Oracle 2 The following is intended to outline our general product direction. It is intended for information purposes only, and may not

More information

Run-time Program Management. Hwansoo Han

Run-time Program Management. Hwansoo Han Run-time Program Management Hwansoo Han Run-time System Run-time system refers to Set of libraries needed for correct operation of language implementation Some parts obtain all the information from subroutine

More information

CS2110 Fall 2011 Lecture 25. Under the Hood: The Java Virtual Machine, Part II

CS2110 Fall 2011 Lecture 25. Under the Hood: The Java Virtual Machine, Part II CS2110 Fall 2011 Lecture 25 Under the Hood: The Java Virtual Machine, Part II 1 Java program last time Java compiler Java bytecode (.class files) Compile for platform with JIT Interpret with JVM run native

More information

Administration CS 412/413. Why build a compiler? Compilers. Architectural independence. Source-to-source translator

Administration CS 412/413. Why build a compiler? Compilers. Architectural independence. Source-to-source translator CS 412/413 Introduction to Compilers and Translators Andrew Myers Cornell University Administration Design reports due Friday Current demo schedule on web page send mail with preferred times if you haven

More information

Static Analysis of Dynamic Languages. Jennifer Strater

Static Analysis of Dynamic Languages. Jennifer Strater Static Analysis of Dynamic Languages Jennifer Strater 2017-06-01 Table of Contents Introduction............................................................................... 1 The Three Compiler Options...............................................................

More information

Copyright 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 16

Copyright 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 16 1 Copyright 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 16 Towards JVM Dynamic Languages Toolchain Insert Picture Here Attila

More information

Today. Instance Method Dispatch. Instance Method Dispatch. Instance Method Dispatch 11/29/11. today. last time

Today. Instance Method Dispatch. Instance Method Dispatch. Instance Method Dispatch 11/29/11. today. last time CS2110 Fall 2011 Lecture 25 Java program last time Java compiler Java bytecode (.class files) Compile for platform with JIT Interpret with JVM Under the Hood: The Java Virtual Machine, Part II 1 run native

More information

Just-In-Time Compilation

Just-In-Time Compilation Just-In-Time Compilation Thiemo Bucciarelli Institute for Software Engineering and Programming Languages 18. Januar 2016 T. Bucciarelli 18. Januar 2016 1/25 Agenda Definitions Just-In-Time Compilation

More information

Working with Native Libraries in Java

Working with Native Libraries in Java Working with Native Libraries in Java Vladimir Ivanov HotSpot JVM Compile r Oracle Corp. 1 Twitter: @iwan0www OpenJDK: vlivanov 23.04.2016 Safe Harbor Statement The following is intended to outline our

More information

JVM. What This Topic is About. Course Overview. Recap: Interpretive Compilers. Abstract Machines. Abstract Machines. Class Files and Class File Format

JVM. What This Topic is About. Course Overview. Recap: Interpretive Compilers. Abstract Machines. Abstract Machines. Class Files and Class File Format Course Overview What This Topic is About PART I: overview material 1 Introduction 2 Language processors (tombstone diagrams, bootstrapping) 3 Architecture of a compiler PART II: inside a compiler 4 Syntax

More information

Improving Java Performance

Improving Java Performance Improving Java Performance #perfmatters Raimon Ràfols ...or the mumbo-jumbo behind the java compiler Agenda - Disclaimer - Who am I? - Our friend the java compiler - Language additions & things to consider

More information

jdk.dynalink is here! Attila Szegedi, Fauna Inc.

jdk.dynalink is here! Attila Szegedi, Fauna Inc. jdk.dynalink is here! Attila Szegedi, Fauna Inc. 1 Part I: Overview 2 Dynalink in the JDK In JDK 9 as jdk.dynalink package and module. Nashorn uses it. Available for integration with other language runtimes

More information

CSC 4181 Handout : JVM

CSC 4181 Handout : JVM CSC 4181 Handout : JVM Note: This handout provides you with the basic information about JVM. Although we tried to be accurate about the description, there may be errors. Feel free to check your compiler

More information

JAVA PERFORMANCE. PR SW2 S18 Dr. Prähofer DI Leopoldseder

JAVA PERFORMANCE. PR SW2 S18 Dr. Prähofer DI Leopoldseder JAVA PERFORMANCE PR SW2 S18 Dr. Prähofer DI Leopoldseder OUTLINE 1. What is performance? 1. Benchmarking 2. What is Java performance? 1. Interpreter vs JIT 3. Tools to measure performance 4. Memory Performance

More information

Compiling Techniques

Compiling Techniques Lecture 10: Introduction to 10 November 2015 Coursework: Block and Procedure Table of contents Introduction 1 Introduction Overview Java Virtual Machine Frames and Function Call 2 JVM Types and Mnemonics

More information

JDK 9/10/11 and Garbage Collection

JDK 9/10/11 and Garbage Collection JDK 9/10/11 and Garbage Collection Thomas Schatzl Senior Member of Technical Staf Oracle JVM Team May, 2018 thomas.schatzl@oracle.com Copyright 2017, Oracle and/or its afliates. All rights reserved. 1

More information

Perchance to Stream with Java 8

Perchance to Stream with Java 8 Perchance to Stream with Java 8 Paul Sandoz Oracle The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated $$ into

More information

2011 Oracle Corporation and Affiliates. Do not re-distribute!

2011 Oracle Corporation and Affiliates. Do not re-distribute! How to Write Low Latency Java Applications Charlie Hunt Java HotSpot VM Performance Lead Engineer Who is this guy? Charlie Hunt Lead JVM Performance Engineer at Oracle 12+ years of

More information

Ahead of Time (AOT) Compilation

Ahead of Time (AOT) Compilation Ahead of Time (AOT) Compilation Vaibhav Choudhary (@vaibhav_c) Java Platforms Team https://blogs.oracle.com/vaibhav Copyright 2018, Oracle and/or its affiliates. All rights reserved. Safe Harbor Statement

More information

Jython Python for the Java Platform. Jim Baker, Committer twitter.com/jimbaker zyasoft.com/pythoneering

Jython Python for the Java Platform. Jim Baker, Committer twitter.com/jimbaker zyasoft.com/pythoneering Jython Python for the Java Platform Jim Baker, Committer jbaker@zyasoft.com twitter.com/jimbaker zyasoft.com/pythoneering Jython Milestones 9 years ago - Released JPython 1.1 8 years ago - Released 2.0

More information

Improving Java Code Performance. Make your Java/Dalvik VM happier

Improving Java Code Performance. Make your Java/Dalvik VM happier Improving Java Code Performance Make your Java/Dalvik VM happier Agenda - Who am I - Java vs optimizing compilers - Java & Dalvik - Examples - Do & dont's - Tooling Who am I? (Mobile) Software Engineering

More information

Course Overview. PART I: overview material. PART II: inside a compiler. PART III: conclusion

Course Overview. PART I: overview material. PART II: inside a compiler. PART III: conclusion Course Overview PART I: overview material 1 Introduction (today) 2 Language Processors (basic terminology, tombstone diagrams, bootstrapping) 3 The architecture of a Compiler PART II: inside a compiler

More information

New Java performance developments: compilation and garbage collection

New Java performance developments: compilation and garbage collection New Java performance developments: compilation and garbage collection Jeroen Borgers @jborgers #jfall17 Part 1: New in Java compilation Part 2: New in Java garbage collection 2 Part 1 New in Java compilation

More information

<Insert Picture Here> Adventures in JSR-292 or How To Be A Duck Without Really Trying

<Insert Picture Here> Adventures in JSR-292 or How To Be A Duck Without Really Trying Adventures in JSR-292 or How To Be A Duck Without Really Trying Jim Laskey Multi-language Lead Java Language and Tools Group The following is intended to outline our general product

More information

JVM JIT-compiler overview. Vladimir Ivanov HotSpot JVM Compile r Oracle Corp.

JVM JIT-compiler overview. Vladimir Ivanov HotSpot JVM Compile r Oracle Corp. JVM JIT-compiler overview Vladimir Ivanov HotSpot JVM Compile r Oracle Corp. 1 Agenda! about compilers in general and JIT-compilers in particular! about JIT-compilers in HotSpot JVM! monitoring JIT-compilers

More information

Delft-Java Link Translation Buffer

Delft-Java Link Translation Buffer Delft-Java Link Translation Buffer John Glossner 1,2 and Stamatis Vassiliadis 2 1 Lucent / Bell Labs Advanced DSP Architecture and Compiler Research Allentown, Pa glossner@lucent.com 2 Delft University

More information

Java: framework overview and in-the-small features

Java: framework overview and in-the-small features Chair of Software Engineering Carlo A. Furia, Marco Piccioni, Bertrand Meyer Java: framework overview and in-the-small features Chair of Software Engineering Carlo A. Furia, Marco Piccioni, Bertrand Meyer

More information

Invokedynamic in Practice. Adding invokedynamic support to JRuby

Invokedynamic in Practice. Adding invokedynamic support to JRuby Invokedynamic in Practice Adding invokedynamic support to JRuby Intro Charles Nutter @headius headius@headius.com JRuby guy at Engine Yard JVM enthusiast JRuby Ruby language on JVM Pushes JVM/platform

More information

Let s make some Marc R. Hoffmann Eclipse Summit Europe

Let s make some Marc R. Hoffmann Eclipse Summit Europe Let s make some Marc R. Hoffmann Eclipse Summit Europe 2012 24.10.2012 public class WhatIsFaster { int i; void inc1() { i = i + 1; } void inc2() { i += 1; } void inc3() { i++; } } Why? Compilers Scrip;ng

More information

Dynamic Dispatch and Duck Typing. L25: Modern Compiler Design

Dynamic Dispatch and Duck Typing. L25: Modern Compiler Design Dynamic Dispatch and Duck Typing L25: Modern Compiler Design Late Binding Static dispatch (e.g. C function calls) are jumps to specific addresses Object-oriented languages decouple method name from method

More information

Under the Hood: The Java Virtual Machine. Lecture 23 CS2110 Fall 2008

Under the Hood: The Java Virtual Machine. Lecture 23 CS2110 Fall 2008 Under the Hood: The Java Virtual Machine Lecture 23 CS2110 Fall 2008 Compiling for Different Platforms Program written in some high-level language (C, Fortran, ML,...) Compiled to intermediate form Optimized

More information

A Trace-based Java JIT Compiler Retrofitted from a Method-based Compiler

A Trace-based Java JIT Compiler Retrofitted from a Method-based Compiler A Trace-based Java JIT Compiler Retrofitted from a Method-based Compiler Hiroshi Inoue, Hiroshige Hayashizaki, Peng Wu and Toshio Nakatani IBM Research Tokyo IBM Research T.J. Watson Research Center April

More information

Let's talk about invokedynamic

Let's talk about invokedynamic Let's talk about invokedynamic Me Charles Oliver Nutter headius@headius.com, @headius blog.headius.com JRuby Guy at Sun, Engine Yard, Red Hat JVM enthusiast, educator, contributor Earliest adopter of invokedynamic

More information

Adventures on the Road to Valhalla

Adventures on the Road to Valhalla Adventures on the Road to Valhalla (A play in at least three acts) Brian Goetz, Java Language Architect JVM Language Summit, Santa Clara, August 2015 1 The following is intended to outline our general

More information

An Introduction to Multicodes. Ben Stephenson Department of Computer Science University of Western Ontario

An Introduction to Multicodes. Ben Stephenson Department of Computer Science University of Western Ontario An Introduction to Multicodes Ben Stephenson Department of Computer Science University of Western Ontario ben@csd csd.uwo.ca Outline Java Virtual Machine Background The Current State of the Multicode Art

More information

The Java Virtual Machine

The Java Virtual Machine Virtual Machines in Compilation Abstract Syntax Tree Compilation 2007 The compile Virtual Machine Code interpret compile Native Binary Code Michael I. Schwartzbach BRICS, University of Aarhus 2 Virtual

More information

Software. Ian Graves/Razvan Lupusoru/Sandhya Viswanathan (Intel) Vladimir Ivanov/John Rose/Paul Sandoz (Oracle)

Software. Ian Graves/Razvan Lupusoru/Sandhya Viswanathan (Intel) Vladimir Ivanov/John Rose/Paul Sandoz (Oracle) Software Ian Graves/Razvan Lupusoru/Sandhya Viswanathan (Intel) Vladimir Ivanov/John Rose/Paul Sandoz (Oracle) How we started? More and more SIMD support in modern processors Straw-man Vector API (John

More information

Alan Bateman Java Platform Group, Oracle November Copyright 2018, Oracle and/or its affiliates. All rights reserved.!1

Alan Bateman Java Platform Group, Oracle November Copyright 2018, Oracle and/or its affiliates. All rights reserved.!1 Alan Bateman Java Platform Group, Oracle November 2018 Copyright 2018, Oracle and/or its affiliates. All rights reserved.!1 Project Loom Continuations Fibers Tail-calls Copyright 2018, Oracle and/or its

More information

Java TM. Multi-Dispatch in the. Virtual Machine: Design and Implementation. Computing Science University of Saskatchewan

Java TM. Multi-Dispatch in the. Virtual Machine: Design and Implementation. Computing Science University of Saskatchewan Multi-Dispatch in the Java TM Virtual Machine: Design and Implementation Computing Science University of Saskatchewan Chris Dutchyn (dutchyn@cs.ualberta.ca) September 22, 08 Multi-Dispatch in the Java

More information

The Java Language Implementation

The Java Language Implementation CS 242 2012 The Java Language Implementation Reading Chapter 13, sections 13.4 and 13.5 Optimizing Dynamically-Typed Object-Oriented Languages With Polymorphic Inline Caches, pages 1 5. Outline Java virtual

More information

CSc 453 Interpreters & Interpretation

CSc 453 Interpreters & Interpretation CSc 453 Interpreters & Interpretation Saumya Debray The University of Arizona Tucson Interpreters An interpreter is a program that executes another program. An interpreter implements a virtual machine,

More information

Truffle A language implementation framework

Truffle A language implementation framework Truffle A language implementation framework Boris Spasojević Senior Researcher VM Research Group, Oracle Labs Slides based on previous talks given by Christian Wimmer, Christian Humer and Matthias Grimmer.

More information

Running class Timing on Java HotSpot VM, 1

Running class Timing on Java HotSpot VM, 1 Compiler construction 2009 Lecture 3. A first look at optimization: Peephole optimization. A simple example A Java class public class A { public static int f (int x) { int r = 3; int s = r + 5; return

More information

Jaguar: Enabling Efficient Communication and I/O in Java

Jaguar: Enabling Efficient Communication and I/O in Java Jaguar: Enabling Efficient Communication and I/O in Java Matt Welsh and David Culler UC Berkeley Presented by David Hovemeyer Outline ' Motivation ' How it works ' Code mappings ' External objects ' Pre

More information

Dispatch techniques and closure representations

Dispatch techniques and closure representations Dispatch techniques and closure representations Jan Midtgaard Week 3, Virtual Machines for Programming Languages Aarhus University, Q4-2011 Dispatch techniques Efficient bytecode interpreters (1/2) The

More information

Delft-Java Dynamic Translation

Delft-Java Dynamic Translation Delft-Java Dynamic Translation John Glossner 1,2 and Stamatis Vassiliadis 2 1 IBM Research DSP and Embedded Computing Yorktown Heights, NY glossner@us.ibm.com (formerly with Lucent Technologies) 2 Delft

More information

Modern Stored Procedures Using GraalVM

Modern Stored Procedures Using GraalVM Modern Stored Procedures Using raalvm Oracle Labs Matthias Brantner Safe Harbor Statement The following is intended to outline our general product direction. t is intended

More information

JOVE. An Optimizing Compiler for Java. Allen Wirfs-Brock Instantiations Inc.

JOVE. An Optimizing Compiler for Java. Allen Wirfs-Brock Instantiations Inc. An Optimizing Compiler for Java Allen Wirfs-Brock Instantiations Inc. Object-Orient Languages Provide a Breakthrough in Programmer Productivity Reusable software components Higher level abstractions Yield

More information

Copyright 2014 Oracle and/or its affiliates. All rights reserved.

Copyright 2014 Oracle and/or its affiliates. All rights reserved. Copyright 2014 Oracle and/or its affiliates. All rights reserved. On the Quest Towards Fastest (Java) Virtual Machine on the Planet! @JaroslavTulach Oracle Labs Copyright 2015 Oracle and/or its affiliates.

More information

Program Dynamic Analysis. Overview

Program Dynamic Analysis. Overview Program Dynamic Analysis Overview Dynamic Analysis JVM & Java Bytecode [2] A Java bytecode engineering library: ASM [1] 2 1 What is dynamic analysis? [3] The investigation of the properties of a running

More information

3/15/18. Overview. Program Dynamic Analysis. What is dynamic analysis? [3] Why dynamic analysis? Why dynamic analysis? [3]

3/15/18. Overview. Program Dynamic Analysis. What is dynamic analysis? [3] Why dynamic analysis? Why dynamic analysis? [3] Overview Program Dynamic Analysis Dynamic Analysis JVM & Java Bytecode [2] A Java bytecode engineering library: ASM [1] 2 What is dynamic analysis? [3] The investigation of the properties of a running

More information

Future of Java. Post-JDK 9 Candidate Features. Jan Lahoda Java compiler developer Java Product Group, Oracle September, 2017

Future of Java. Post-JDK 9 Candidate Features. Jan Lahoda Java compiler developer Java Product Group, Oracle September, 2017 Future of Java Post-JDK 9 Candidate Features Jan Lahoda Java compiler developer Java Product Group, Oracle September, 2017 Safe Harbor Statement The following is intended to outline our general product

More information

<Insert Picture Here> Symmetric multilanguage VM architecture: Running Java and JavaScript in Shared Environment on a Mobile Phone

<Insert Picture Here> Symmetric multilanguage VM architecture: Running Java and JavaScript in Shared Environment on a Mobile Phone Symmetric multilanguage VM architecture: Running Java and JavaScript in Shared Environment on a Mobile Phone Oleg Pliss Pavel Petroshenko Agenda Introduction to Monty JVM Motivation

More information

Optimising large dynamic code bases.

Optimising large dynamic code bases. Optimising large dynamic code bases. Who am I? Duncan MacGregor Lead Software Engineer on the Magik on Java project at General Electric in Cambridge Aardvark179 on twitter 2 What is Magik? Dynamic, weakly

More information

Introduction to Visual Basic and Visual C++ Introduction to Java. JDK Editions. Overview. Lesson 13. Overview

Introduction to Visual Basic and Visual C++ Introduction to Java. JDK Editions. Overview. Lesson 13. Overview Introduction to Visual Basic and Visual C++ Introduction to Java Lesson 13 Overview I154-1-A A @ Peter Lo 2010 1 I154-1-A A @ Peter Lo 2010 2 Overview JDK Editions Before you can write and run the simple

More information

FTL WebKit s LLVM based JIT

FTL WebKit s LLVM based JIT FTL WebKit s LLVM based JIT Andrew Trick, Apple Juergen Ributzka, Apple LLVM Developers Meeting 2014 San Jose, CA WebKit JS Execution Tiers OSR Entry LLInt Baseline JIT DFG FTL Interpret bytecode Profiling

More information

Welcome to the session...

Welcome to the session... Welcome to the session... Copyright 2013, Oracle and/or its affiliates. All rights reserved. 02/22/2013 1 The following is intended to outline our general product direction. It is intended for information

More information

Compiler construction 2009

Compiler construction 2009 Compiler construction 2009 Lecture 3 JVM and optimization. A first look at optimization: Peephole optimization. A simple example A Java class public class A { public static int f (int x) { int r = 3; int

More information

What the optimizer does to your code

What the optimizer does to your code 1 / 12 Miguel Garcia http://lamp.epfl.ch/~magarcia LAMP, EPFL 2012-04-18 2 / 12 Outline Things the optimizer is good at Example Pros and Cons Early inlining Parallelizing an optimization phase Further

More information

LLVM for a Managed Language What we've learned

LLVM for a Managed Language What we've learned LLVM for a Managed Language What we've learned Sanjoy Das, Philip Reames {sanjoy,preames}@azulsystems.com LLVM Developers Meeting Oct 30, 2015 This presentation describes advanced development work at Azul

More information

Portable Resource Control in Java The J-SEAL2 Approach

Portable Resource Control in Java The J-SEAL2 Approach Portable Resource Control in Java The J-SEAL2 Approach Walter Binder w.binder@coco.co.at CoCo Software Engineering GmbH Austria Jarle Hulaas Jarle.Hulaas@cui.unige.ch Alex Villazón Alex.Villazon@cui.unige.ch

More information

Space Exploration EECS /25

Space Exploration EECS /25 1/25 Space Exploration EECS 4315 www.eecs.yorku.ca/course/4315/ Nondeterminism 2/25 Nondeterministic code is code that, even for the same input, can exhibit different behaviours on different runs, as opposed

More information

Problem: Too Many Platforms!

Problem: Too Many Platforms! Compiling for Different Platforms 2 Program written in some high-level language (C, Fortran, ML,...) Compiled to intermediate form Optimized UNDE THE HOOD: THE JAVA VITUAL MACHINE Code generated for various

More information

The Java Virtual Machine. CSc 553. Principles of Compilation. 3 : The Java VM. Department of Computer Science University of Arizona

The Java Virtual Machine. CSc 553. Principles of Compilation. 3 : The Java VM. Department of Computer Science University of Arizona The Java Virtual Machine CSc 553 Principles of Compilation 3 : The Java VM Department of Computer Science University of Arizona collberg@gmail.com Copyright c 2011 Christian Collberg The Java VM has gone

More information

Java Performance: The Definitive Guide

Java Performance: The Definitive Guide Java Performance: The Definitive Guide Scott Oaks Beijing Cambridge Farnham Kbln Sebastopol Tokyo O'REILLY Table of Contents Preface ix 1. Introduction 1 A Brief Outline 2 Platforms and Conventions 2 JVM

More information

JVM Compiler Challenges

JVM Compiler Challenges JVM Compiler Challenges John Rose, JVM Architect Santa Clara JIT F2F, January 2018 Copyright 2018, Oracle and/or its affiliates. All rights reserved. 1 The following is intended to outline our general

More information

Building a Compiler with. JoeQ. Outline of this lecture. Building a compiler: what pieces we need? AKA, how to solve Homework 2

Building a Compiler with. JoeQ. Outline of this lecture. Building a compiler: what pieces we need? AKA, how to solve Homework 2 Building a Compiler with JoeQ AKA, how to solve Homework 2 Outline of this lecture Building a compiler: what pieces we need? An effective IR for Java joeq Homework hints How to Build a Compiler 1. Choose

More information

JDK 9, 变化与未来. Xuelei Fan

JDK 9, 变化与未来. Xuelei Fan 2016-4-21 JDK 9, 变化与未来 Xuelei Fan Java 20-Year Topics JDK 9 OpenJDK Community JDK 9 Schedule 2016/05/26 Feature Complete 2016/08/11 All Tests Run 2016/09/01 Rampdown Start 2016/10/20 Zero Bug Bounce 2016/12/01

More information

<Insert Picture Here> OpenJDK - When And How To Contribute To The Java SE Reference Implementation OSCON 2011, July 26th, 2011

<Insert Picture Here> OpenJDK - When And How To Contribute To The Java SE Reference Implementation OSCON 2011, July 26th, 2011 OpenJDK - When And How To Contribute To The Java SE Reference Implementation OSCON 2011, July 26th, 2011 Dalibor Topić Java F/OSS Ambassador The following is intended to outline our

More information

Java in a World of Containers

Java in a World of Containers Java in a World of Containers mikael.vidstedt@oracle.com Not-coder, JVM @MikaelVidstedt matthew.gilliard@oracle.com Coder, not-jvm @MaximumGilliard Copyright 2017, Oracle and/or its affiliates. All rights

More information

Java Internals. Frank Yellin Tim Lindholm JavaSoft

Java Internals. Frank Yellin Tim Lindholm JavaSoft Java Internals Frank Yellin Tim Lindholm JavaSoft About This Talk The JavaSoft implementation of the Java Virtual Machine (JDK 1.0.2) Some companies have tweaked our implementation Alternative implementations

More information

Java Class Loading and Bytecode Verification

Java Class Loading and Bytecode Verification Java Class Loading and Bytecode Verification Every object is a member of some class. The Class class: its members are the (definitions of) various classes that the JVM knows about. The classes can be dynamically

More information

High-Level Language VMs

High-Level Language VMs High-Level Language VMs Outline Motivation What is the need for HLL VMs? How are these different from System or Process VMs? Approach to HLL VMs Evolutionary history Pascal P-code Object oriented HLL VMs

More information

Running Mistyped Code. Lecture 19: Java Security. Running Mistyped Code. Java Security Architecture. JavaVM. Reference Monitors

Running Mistyped Code. Lecture 19: Java Security. Running Mistyped Code. Java Security Architecture. JavaVM. Reference Monitors CS16: Program and Data Representation University of Virginia Computer Science Spring 006 David Evans Lecture 19: Java Security PS6 Submission: Only to be eligible for the Byte Code Wizard awards. If the

More information

<Insert Picture Here> Maxine: A JVM Written in Java

<Insert Picture Here> Maxine: A JVM Written in Java Maxine: A JVM Written in Java Michael Haupt Oracle Labs Potsdam, Germany The following is intended to outline our general product direction. It is intended for information purposes

More information

Computer Components. Software{ User Programs. Operating System. Hardware

Computer Components. Software{ User Programs. Operating System. Hardware Computer Components Software{ User Programs Operating System Hardware What are Programs? Programs provide instructions for computers Similar to giving directions to a person who is trying to get from point

More information

Roos Instruments, Inc. RTALK - SMALLTALK ON THE JVM

Roos Instruments, Inc. RTALK - SMALLTALK ON THE JVM Roos Instruments, Inc. RTALK - SMALLTALK ON THE JVM Roos Instruments, Inc. HARDWARE AND SOFTWARE FOR IC TEST Smalltalk Basics Message Based Everything is an Object Simple syntax Fast ODA ( On Demand Assembler

More information

Java byte code verification

Java byte code verification Java byte code verification SOS Master Science Informatique U. Rennes 1 Thomas Jensen SOS Java byte code verification 1 / 26 Java security architecture Java: programming applications with code from different

More information

Notes of the course - Advanced Programming. Barbara Russo

Notes of the course - Advanced Programming. Barbara Russo Notes of the course - Advanced Programming Barbara Russo a.y. 2014-2015 Contents 1 Lecture 2 Lecture 2 - Compilation, Interpreting, and debugging........ 2 1.1 Compiling and interpreting...................

More information

VM instruction formats. Bytecode translator

VM instruction formats. Bytecode translator Implementing an Ecient Java Interpreter David Gregg 1, M. Anton Ertl 2 and Andreas Krall 2 1 Department of Computer Science, Trinity College, Dublin 2, Ireland. David.Gregg@cs.tcd.ie 2 Institut fur Computersprachen,

More information

CMSC 430 Introduction to Compilers. Spring Intermediate Representations and Bytecode Formats

CMSC 430 Introduction to Compilers. Spring Intermediate Representations and Bytecode Formats CMSC 430 Introduction to Compilers Spring 2016 Intermediate Representations and Bytecode Formats Introduction Front end Source code Lexer Parser Types AST/IR IR 2 IR n IR n.s Middle end Back end Front

More information

<Insert Picture Here> JSR-335 Update for JCP EC Meeting, January 2012

<Insert Picture Here> JSR-335 Update for JCP EC Meeting, January 2012 JSR-335 Update for JCP EC Meeting, January 2012 Alex Buckley Oracle Corporation The following is intended to outline our general product direction. It is intended for information

More information

The G1 GC in JDK 9. Erik Duveblad Senior Member of Technical Staf Oracle JVM GC Team October, 2017

The G1 GC in JDK 9. Erik Duveblad Senior Member of Technical Staf Oracle JVM GC Team October, 2017 The G1 GC in JDK 9 Erik Duveblad Senior Member of Technical Staf racle JVM GC Team ctober, 2017 Copyright 2017, racle and/or its affiliates. All rights reserved. 3 Safe Harbor Statement The following is

More information