SlideShare ist ein Scribd-Unternehmen logo
1 von 62
JDK7: Improved support for dynamic
                         languages

                               Sander Mak
                                 Info Support




Wednesday, November 11, 2009
Overview


     •   JVM Languages
     •   Problems for dynamic languages
     •   MLVM: Multi Language Virtual Machine
     •   Method handles
     •   Invokedynamic
     •   Wrap-up


Wednesday, November 11, 2009
The Java Platform

          The JVM has become a complex beast...
       1.0                      1996
          1.1
            1.2
              1.3
                1.4
                  1.5
                    1.6         2009


      •    Performance
      •    Binary compatibility
      •    Safety
      •    Platform independence
Wednesday, November 11, 2009
The Java Platform




Wednesday, November 11, 2009
The Java Platform




                     Java language
        JVM




            Java libraries




Wednesday, November 11, 2009
The Java Platform

  • More expressiveness:
       – ‘Pure’ OO                                         Java
                                                               JRuby
       – Blocks/Closures/                                            Scala
                                              JVM
         Higher order functions                                        Groovy

       – Dynamic typing                                                Clojure

       – Metaprogramming                                               JavaFX


                                                    Java libraries
  • Proven VM
  • Interop with Java ‘legacy’
Wednesday, November 11, 2009
JVM Languages




                                    Java


Wednesday, November 11, 2009
JVM Languages



                               Groovy      Clojure

                 JRuby              Java        JavaFX
                                        Scala


Wednesday, November 11, 2009
JVM Languages
 jProlog                        Pizza                          MultiJava
                                                    Fan


   JLog
                               Groovy            Clojure          MetaJ



                 JRuby                  Java             JavaFX     Jaskell


                               Rhino        Scala          JBasic
 Aardappel
                                                Funnel
                         Jacl                                     Drools
                                       Jython
Wednesday, November 11, 2009
JVM Languages




                      240+
                      Languages
Wednesday, November 11, 2009
JVM Languages

‘Language
   fictions’
                 JVM


          Exceptions
          Primitive types
          Objects
          Access control
          Garbage coll.
          Threading
          Memory model

Wednesday, November 11, 2009
JVM Languages

‘Language
   fictions’
                                         Java

                                    Enums
                                    Checked exc.
                 JVM                Generics


          Exceptions                Exceptions
          Primitive types           Primitive types
          Objects                   Objects
          Access control            Access control
          Garbage coll.             Garbage coll.
          Threading                 Threading.
          Memory model              Memory model

Wednesday, November 11, 2009
JVM Languages
                                                           JRuby


‘Language                                             Open classes
                                                      Dynamic typing

   fictions’
                                         Java         Closures

                                    Enums             Enums
                                    Checked exc.      Checked exc.
                 JVM                Generics          Generics


          Exceptions                Exceptions        Exceptions
          Primitive types           Primitive types   Primitive types
          Objects                   Objects           Objects
          Access control            Access control    Access control
          Garbage coll.             Garbage coll.     Garbage coll.
          Threading                 Threading.        Threading
          Memory model              Memory model      Memory model

Wednesday, November 11, 2009
JVM Languages
                                                           JRuby


‘Language                                             Open classes
                                                      Dynamic typing

   fictions’
                                         Java         Closures

                                    Enums             Enums
                                    Checked exc.      Checked exc.
                 JVM                Generics          Generics


          Exceptions                Exceptions        Exceptions
          Primitive types           Primitive types   Primitive types
          Objects                   Objects           Objects
          Access control            Access control    Access control
          Garbage coll.             Garbage coll.     Garbage coll.
          Threading                 Threading.        Threading
          Memory model              Memory model      Memory model

Wednesday, November 11, 2009
Compiling dynamic languages

                                   Performance




                                   Smaller = better for Java


Wednesday, November 11, 2009
Compiling dynamic languages

                                   Performance
                    (in fairness: JRuby compares well to Ruby)




                                    Smaller = better for JRuby



Wednesday, November 11, 2009
Compiling dynamic languages

     First: statically typed Java

                                                        Java
    public class Test {
        public static void main(String[] args) {
            ArrayList<String> names =
                  new ArrayList<String>();
            names.add("John");
            names.add("Pete");
            Collections.sort(names);
        }
    }

Wednesday, November 11, 2009
Compiling dynamic languages



                                                        Java
    public class Test {
        public static void main(String[] args) {
            ArrayList<String> names =
                  new ArrayList<String>();
            names.add("John");
            names.add("Pete");
            Collections.sort(names);
        }
    }

Wednesday, November 11, 2009
Compiling dynamic languages
                                 Where are the types?
                                                                    Bytecode
       0:
   new
 #2; //class java/util/ArrayList
       3:
   dup
       4:
   invokespecial
    #3; //Method java/util/ArrayList."<init>":()V
       7:
   astore_1
       8:
   aload_1
       9:
   ldc
 #4; //String John
       11:
 invokevirtual
     #5; //Method java/util/ArrayList.add:(Ljava/lang/
    Object;)Z
       14:
 pop
       15:
 aload_1
       16:
 ldc
 #6; //String Pete
       18:
 invokevirtual
     #5; //Method java/util/ArrayList.add:(Ljava/lang/
    Object;)Z
       21:
 pop
       22:
 aload_1
       23:
 invokestatic
#7; //Method java/util/Collections.sort:(Ljava/util/
    List;)V
       26:
 return

Wednesday, November 11, 2009
Compiling dynamic languages
                                 At the callsites!
                                                                    Bytecode
       0:
   new
 #2; //class java/util/ArrayList
       3:
   dup
       4:
   invokespecial
    #3; //Method java/util/ArrayList."<init>":()V
       7:
   astore_1
       8:
   aload_1
       9:
   ldc
 #4; //String John
       11:
 invokevirtual
     #5; //Method java/util/ArrayList.add:(Ljava/lang/
    Object;)Z
       14:
 pop
       15:
 aload_1
       16:
 ldc
 #6; //String Pete
       18:
 invokevirtual
     #5; //Method java/util/ArrayList.add:(Ljava/lang/
    Object;)Z
       21:
 pop
       22:
 aload_1
       23:
 invokestatic
#7; //Method java/util/Collections.sort:(Ljava/util/
    List;)V
       26:
 return

Wednesday, November 11, 2009
Compiling dynamic languages
                                 At the callsites!in JVM
                                     Invocation
                                                                    Bytecode
                   Bytecode         Example
       0:
   new
 #2; //class java/util/ArrayList
       3:
   dupinvokestatic     Collections.sort(list)
       4:
   invokespecial
    #3; //Method java/util/ArrayList."<init>":()V
       7:
   astore_1
                invokevirtual    list.add(element) list :: java.util.ArrayList
       8:
   aload_1
       9:
   ldc
 #4; //String John
                invokeinterface list.add(element) list :: java.util.List
       11:
 invokevirtual
     #5; //Method java/util/ArrayList.add:(Ljava/lang/
    Object;)Z invokespecial      constructor call, i.e.: new ArrayList()
       14:
 pop
       15:
 aload_1
       16:
 ldc
 #6; //String Pete
       18:
 invokevirtual
     #5; //Method java/util/ArrayList.add:(Ljava/lang/
    Object;)Z
       21:
 pop
       22:
 aload_1
       23:
 invokestatic
#7; //Method java/util/Collections.sort:(Ljava/util/
    List;)V
       26:
 return

Wednesday, November 11, 2009
Compiling dynamic languages

     • JVM ‘more dynamic’ than Java
     • Exception: method calls
          – Signature at callsite must match exactly
                                            TargetClass        Name    Method descriptor
 18:
 invokevirtual
           #5; //Method java/util/ArrayList.add:(Ljava/lang/Object;)Z


          – Dispatch on static type of call and
            dynamic type of receiver
          – Method must exist at compile time
          – Link to target is fixed, no relinking
Wednesday, November 11, 2009
Compiling dynamic languages

        Again, where are the types?
                                                        JRuby
      names = ["John", "Pete"]
      puts names.sort



      •    Type inference not feasible
      •    Types may be constructed @ runtime
      •    Types may change @ runtime
      •    Invocation of closures constructed @ runtime
Wednesday, November 11, 2009
Compiling dynamic languages

    Compiling 2 lines of JRuby ...
        ... yields >80 bytecode instructions
                                                                                            Bytecode
    public class Test_dot_ruby extends org/jruby/ast/executable/AbstractScript   {


      public <init>()V
        ANEWARRAY org/jruby/runtime/CallSite
        ICONST_1
        LDC "sort"
        INVOKESTATIC Test_dot_ruby.setCallSite ([Lorg/jruby/runtime/CallSite;ILjava/lang/String;)[Lorg/jruby/
    runtime/CallSite;
        ICONST_0
        LDC "puts"
        INVOKESTATIC Test_dot_ruby.setFunctionalCallSite ([Lorg/jruby/runtime/CallSite;ILjava/lang/String;)
    [Lorg/jruby/runtime/CallSite;
        PUTFIELD Test_dot_ruby.callSites : [Lorg/jruby/runtime/CallSite;
        ALOAD 0
        ICONST_2
        INVOKEVIRTUAL Test_dot_ruby.initStrings (I)[Lorg/jruby/util/ByteList;
        LDC 1
        LDC "Pete"
        INVOKESTATIC org/jruby/ast/executable/AbstractScript.createByteList ([Lorg/jruby/util/ByteList;ILjava/



Wednesday, November 11, 2009
Compiling dynamic languages

    Compiling 2 lines of JRuby ... details
                       Method call
        ... yields >80 bytecode instructions
         Lorg/jruby/runtime/builtin/IRubyObject
                                                                                            Bytecode
                LDC “sort”
    public class Test_dot_ruby extends org/jruby/ast/executable/AbstractScript
                                                 {
                INVOKESTATIC Test_dot_ruby.setCallSite ...
      public <init>()V
        ANEWARRAY org/jruby/runtime/CallSite
        ICONST_1INVOKEVIRTUAL org/jruby/runtime/CallSite.call
        LDC "sort"
                  ...
        INVOKESTATIC Test_dot_ruby.setCallSite ([Lorg/jruby/runtime/CallSite;ILjava/lang/String;)[Lorg/jruby/
    runtime/CallSite;
        ICONST_0                           ‘Fat call paths’
        LDC "puts"
        INVOKESTATIC Test_dot_ruby.setFunctionalCallSite ([Lorg/jruby/runtime/CallSite;ILjava/lang/String;)
    [Lorg/jruby/runtime/CallSite;
        PUTFIELD Test_dot_ruby.callSites : [Lorg/jruby/runtime/CallSite;
        ALOAD 0
        ICONST_2
        INVOKEVIRTUAL Test_dot_ruby.initStrings (I)[Lorg/jruby/util/ByteList;
        LDC 1
        LDC "Pete"
        INVOKESTATIC org/jruby/ast/executable/AbstractScript.createByteList ([Lorg/jruby/util/ByteList;ILjava/



Wednesday, November 11, 2009
Compiling dynamic languages

     • Common solutions:
                - Don’t compile, interpret (sometimes
                  unavoidable)
                - AOT compilation into specialized invoker
                  classes (suitable for core methods)
                - AOT compilation, then use reflection (for user
                  defined types)
                - JIT bytecode generation of small stub methods


        Either way: abundance of synthetic types and
        bytecode hard to optimize for JVM
Wednesday, November 11, 2009
MLVM

     • Change of direction @ Sun
          – Introduction of JavaFX
          – Fortress language
          – Officially supporting JRuby
          – Open sourcing JDK (compiler & VM)
     • Still, JVM remains Java-centric

     • Enter: the MLVM and JSR-292
                  Multi Language VM
                  Da Vinci Machine
Wednesday, November 11, 2009
MLVM

                               John Rose @ Sun:
   Language implementers know what they want
     (and know how to simulate it with 100x slowdown)  
   VM implementers know what VMs can do
     (and know how to make their favorite language sing)




         Let's bring them together.

          (JSR 292 ‘invokedynamic’)

Wednesday, November 11, 2009
JSR-292

            So what do dynamic languages want?
                               Binding                                  Marker
                         Delay binding as long                       Indicate in bytecode
                         as possible. Hide                           that a dynamic call
                         exact destination of                        should be made
                         call @ compiletime




                                                 Adaptation
                                             Language should be
                                             able to implement its
                                             own coercion rules
                                             when matching type
                                             signatures


Wednesday, November 11, 2009
Method handles

     • Lightweight, safe method pointers
     • Like java.lang.reflect.Method, but:
          –   No argument boxing/unboxing
          –   Access checks only at creation time
          –   Leaner, and as fast as direct call
          –   No wrapping of exceptions




Wednesday, November 11, 2009
Method handles

     • Lightweight, safe method pointers
     • Like java.lang.reflect.Method, but:
          –   No argument boxing/unboxing
          –   Access checks only at creation time
          –   Leaner, and as fast as direct call
          –   No wrapping of exceptions             Java 7
    MethodHandle mh = MethodHandles.lookup().findStatic(
      Enclosing.class, “methodName”,
      MethodType.make(String.class, int.class,
         String.class) )
    mh.<String>invoke(1, “2”)

Wednesday, November 11, 2009
Method handles

     • Lightweight, safe method pointers
     • Like java.lang.reflect.Method, but:
          –   No argument boxing/unboxing
          –   Access checks only at creation time
          –   Leaner, and as fast as direct call
          –   No wrapping of exceptions
                                                    Bytecode
    59:
 aload
4
    61:
 invokevirtual
 #11;
      //Method java/dyn/MethodHandle.invoke:(I;Ljava/
      lang/String;)Ljava/lang/String

Wednesday, November 11, 2009
Method handles

     • Instance methods: first arg is receiver




Wednesday, November 11, 2009
Method handles

     • Instance methods: first arg is receiver
                                                 Java 7
    MethodHandle mh = MethodHandles.lookup().findVirtual(
      Enclosing.class, “methodName”,
      MethodType.make(String.class, int.class,
         String.class)
    )
    mh.<String>invoke(receiver, 1, “2”)

   • Receiver may be pre-bound to MH
   • Faster than normal ‘invokevirtual’!
   • Method Handles prepare for closures...
Wednesday, November 11, 2009
Method handles

     • Immutable: MH has one function type
     • Signature polymorphism for invoke
     • Can be composed and/or adapted:
          – Add or drop arguments
          – Guard with test
          – Convert arguments

                   JVM ‘knows’ Method Handles:
     • Can inline (chains of) method handles
Wednesday, November 11, 2009
Method handles

     • Immutable: MH has one function type
               MH Chain example:   Test MH

     • Signature polymorphism for invoke
                             Guard
          Originalcomposed and/or adapted:
     • Can be       Insert
                             with  Success MH
               MH                arg.
                              test
          – Add or drop arguments
          – Guard with test
                                                Fallback MH
           mh.invoke(..)
          – Convert arguments

                   JVM ‘knows’ Method Handles:
     • Can inline (chains of) method handles
Wednesday, November 11, 2009
Anonymous classloading

     Create unnamed classes from byte[]
     • Garbage collectible
          Class not in system dictionary, Class.forName() won’t work

     • Inherit access & security from host
          Host class is caller of Anon. classloader

     • Create patchable template classes
          Specialize classes by patching constant pool @ loadtime



     Vastly improves runtime code generation
Wednesday, November 11, 2009
Anonymous classloading
                                                             Java 7
     Create unnamed classes from byte[]
    MethodType methodType = MethodType.make(int.class,
     • Garbage collectible
      int.class, int.class);
          Class not in system dictionary, Class.forName() won’t work
    ExprBuilder builder = new ExprBuilder(methodType);
     • Inherit access & security from host
    Var a = builder.parameter(0);
    Var b = builder.parameter(1);
       Host class is caller of Anon. classloader
    builder.
     • Create patchable template classes
        load(a).
        load(b).
       Specialize classes by patching constant pool @ loadtime
        add();

    MethodHandle mh =
      builder.createMethodHandle(Main.class);
    Vastly improves runtime code generation
    System.out.println(mh.invoke(2, 3));
Wednesday, November 11, 2009
Anonymous classloading
                                                             Java 7
     Create unnamed classes from byte[]
    MethodType methodType = MethodType.make(int.class,
     • Garbage collectible
      int.class, int.class);
          Class not in system dictionary, Class.forName() won’t work
    ExprBuilder builder = new ExprBuilder(methodType);
     • Inherit access & security from host
    Var a = builder.parameter(0);
    Var b = builder.parameter(1);
       Host class is caller of Anon. classloader
    builder.
     • Create patchable template classes
        load(a).
        load(b).
       Specialize classes by patching constant pool @ loadtime
        add();

    MethodHandle mh =
      builder.createMethodHandle(Main.class);
    Vastly improves runtime code generation
    System.out.println(mh.invoke(2, 3));
Wednesday, November 11, 2009
Anonymous classloading
                                                             Java 7
     Create unnamed classes from byte[]
    MethodType methodType = MethodType.make(int.class,
     • Garbage collectible
      int.class, int.class);
          Class not in system dictionary, Class.forName() won’t work
    ExprBuilder builder = new ExprBuilder(methodType);
     • Inherit access & security from host
    Var a = builder.parameter(0);
    Var b = builder.parameter(1);
       Host class is caller of Anon. classloader
    builder.
     • Create patchable template classes
        load(a).
        load(b).
       Specialize classes by patching constant pool @ loadtime
        add();

    MethodHandle mh =
      builder.createMethodHandle(Main.class);
    Vastly improves runtime code generation
    System.out.println(mh.invoke(2, 3));
Wednesday, November 11, 2009
JSR-292

            So what do dynamic languages want?
                           Binding                                        Marker
                       Delay binding as long                           Indicate in bytecode
                       as possible. Hide                               that a dynamic call
                       exact destination of                            should be made
                       call @ compiletime




                                                Adaptation
                                               Language should be
                                               able to implement its
                                               own coercion rules
                                               when matching type
                                               signatures



Wednesday, November 11, 2009
JSR-292

            So what do dynamic languages want?

       Adaptation                   MH can be chained to add
     Language should be
     able to implement its          custom conversion rules
     own coercion rules
     when matching type
     signatures                     Argument list can be
                                    adjusted



Wednesday, November 11, 2009
JSR-292

            So what do dynamic languages want?

         Binding                   MH is a flexible, adaptable
     Delay binding as long
     as possible. Hide
                                   pointer to methods
     exact destination of
     call @ compiletime
                                   Invocation overhead low


                                   Invocation binds directly to
                                   single method handle
Wednesday, November 11, 2009
Invokedynamic

 New bytecode, last piece of JSR-292 puzzle:
                                                 Name    Method descriptor
   18:
 invokedynamic
         #5; //NameAndType addInts:(II)I



     • Invocation without reference to actual
       method descriptor
     • Instead, symbolic name and type
     • No receiver: all arguments are equal

                                What is the target?
Wednesday, November 11, 2009
Invokedynamic - bootstrap

   Bootstrap method receives dynamic calls
                                                           Java 7
    static {
      Linkage.registerBootstrapMethod(
         "bootstrapID");
    }

    static CallSite bootstrapID(Class<?> callerClass,
      String methodName, MethodType methodType) {
               MethodHandle target = ..
               CallSite site = new CallSite(callerClass,
                  methodName, methodType);
               site.setTarget(target);
               return site;
    }

Wednesday, November 11, 2009
Invokedynamic - bootstrap

   Bootstrap method receives dynamic calls
                                                           Java 7
    static {
      Linkage.registerBootstrapMethod(
         "bootstrapID");
    }

    static CallSite bootstrapID(Class<?> callerClass,
      String methodName, MethodType methodType) {
               MethodHandle target = ..
               CallSite site = new CallSite(callerClass,
                  methodName, methodType);
               site.setTarget(target);
               return site;
    }

Wednesday, November 11, 2009
Invokedynamic - bootstrap

   Bootstrap method receives dynamic calls
                                                           Java 7
    static {
      Linkage.registerBootstrapMethod(
         "bootstrapID");
    }

    static CallSite bootstrapID(Class<?> callerClass,
      String methodName, MethodType methodType) {
               MethodHandle target = ..
               CallSite site = new CallSite(callerClass,
                  methodName, methodType);
               site.setTarget(target);
               return site;
    }

Wednesday, November 11, 2009
Invokedynamic - bootstrap

   Bootstrap method receives dynamic calls
                                                           Java 7
    static {
      Linkage.registerBootstrapMethod(
         "bootstrapID");
    }

    static CallSite bootstrapID(Class<?> callerClass,
      String methodName, MethodType methodType) {
               MethodHandle target = ..
               CallSite site = new CallSite(callerClass,
                  methodName, methodType);
               site.setTarget(target);
               return site;
    }

Wednesday, November 11, 2009
Invokedynamic - bootstrap

     • CallSite immutable, except for target
     • After installing target, invokedynamic invokes MH
       directly
          DynamicInvokerClass                         ImplementationClass

       aload_1;
       invokedyn. meth:Type;                      implementation(Type) {
       return;                                       result = ..
                                                     return result

                                                  }

      bootstrap( .. ) {
         ..lookup..
         return CallSite

      }

Wednesday, November 11, 2009
Invokedynamic - bootstrap

     • CallSite immutable, except for target
     • After installing target, invokedynamic invokes MH
       directly
          DynamicInvokerClass                         ImplementationClass

       aload_1;
       invokedyn. meth:Type;                      implementation(Type) {
       return;                                       result = ..
                                                     return result

                                                  }

      bootstrap( .. ) {
         ..lookup..
         return CallSite

      }

Wednesday, November 11, 2009
Invokedynamic - bootstrap

     • CallSite immutable, except for target
     • After installing target, invokedynamic invokes MH
       directly
          DynamicInvokerClass                         ImplementationClass

       aload_1;
       invokedyn. meth:Type;                      implementation(Type) {
       return;                                       result = ..
                                                     return result

                                                  }

      bootstrap( .. ) {
         ..lookup..
         return CallSite

      }

Wednesday, November 11, 2009
Invokedynamic - bootstrap

     • CallSite immutable, except for target
     • After installing target, invokedynamic invokes MH
       directly
          DynamicInvokerClass                                ImplementationClass

       aload_1;
       invokedyn. meth:Type;                             implementation(Type) {
       return;                                              result = ..
                                                            return result

                                     CallSite is         }

      bootstrap( .. ) {              sub-classable
         ..lookup..
         return CallSite
                                     MH can be guarded
      }
                                     with test
Wednesday, November 11, 2009
Invokedynamic - bootstrap

     • CallSite immutable, except for target
     • After installing target, invokedynamic invokes MH
       directly
          DynamicInvokerClass                              ImplementationClass

       aload_1;
       invokedyn. meth:Type;              Method       implementation(Type) {
       return;                            Handle(s)       result = ..
                                                          return result

                                                       }
                                     CallSite target
      bootstrap( .. ) {              may be changed
         ..lookup..
         return CallSite             later!
      }

Wednesday, November 11, 2009
Project coin: JSR-292 syntax
                                                         Java 7
    import java.dyn.*;

    public class HelloSimple {
        public static void main(String... args) {
          greeter.<void>invoke(args[0]); // Direct MH
           InvokeDynamic.sayIt(args[0]); // invokedynamic
        }

            public static void greeter(String x) { .. println }

            static MethodHandle greeter
                = MethodHandles.lookup().findStatic(
                    Hello.class, "greeter",
                    MethodType.make(void.class, String.class));

             // bootstrap: link “sayIt” to greeter MH

Wednesday, November 11, 2009
Project coin: JSR-292 syntax
                                                         Java 7
    import java.dyn.*;

    public class HelloSimple {
        public static void main(String... args) {
          greeter.<void>invoke(args[0]); // Direct MH
           InvokeDynamic.sayIt(args[0]); // invokedynamic
        }

            public static void greeter(String x) { .. println }

            static MethodHandle greeter
                = MethodHandles.lookup().findStatic(
                    Hello.class, "greeter",
                    MethodType.make(void.class, String.class));

             // bootstrap: link “sayIt” to greeter MH

Wednesday, November 11, 2009
Project coin: JSR-292 syntax
                                                         Java 7
    import java.dyn.*;

    public class HelloSimple {
        public static void main(String... args) {
          greeter.<void>invoke(args[0]); // Direct MH
           InvokeDynamic.sayIt(args[0]); // invokedynamic
        }

            public static void greeter(String x) { .. println }

            static MethodHandle greeter
                = MethodHandles.lookup().findStatic(
                    Hello.class, "greeter",
                    MethodType.make(void.class, String.class));

             // bootstrap: link “sayIt” to greeter MH

Wednesday, November 11, 2009
Invokedynamic


      • Invokedynamic + bootstrap method
        allow language to up-call from VM to
        custom code for linking/calling.

      Not impossible before, but hard and slow.
       JVM now fully optimizes dynamic calls.


Wednesday, November 11, 2009
JSR-292

            So what do dynamic languages want?
                           Binding                                        Marker
                       Delay binding as long                           Indicate in bytecode
                       as possible. Hide                               that a dynamic call
                       exact destination of                            should be made
                       call @ compiletime




                                                Adaptation
                                               Language should be
                                               able to implement its
                                               own coercion rules
                                               when matching type
                                               signatures



Wednesday, November 11, 2009
JSR-292

            So what do dynamic languages want?
                                            Marker

         invokedynamic bytecode          Indicate in bytecode
                                         that a dynamic call
                                         should be made




                                             Binding
         bootstrap mechanism and         Delay binding as long
                                         as possible. Hide
         method handles                  exact destination of
                                         call @ compiletime



Wednesday, November 11, 2009
Wrap-up


     • JSR-292 invokedynamic features:
          – Language implementors can avoid tricks
          – Level the playing ground, speedwise
          – Allow existing VM optimizations to be
            applied to new paradigms
     • JSR292/invokedynamic will be
       backported

Wednesday, November 11, 2009
Wrap-up


     • JRuby, Groovy actively working on
       JSR-292 support
     • For example, JRuby can cut 80% of
       linking/calling code in runtime
     • Unfortunately no real benchmarks, but:
          – Surinx preliminary testing: up to 5-fold
            increase on naive fibonacci testcase
     • JDK7 due 1st quarter 2010
Wednesday, November 11, 2009
Questions




Wednesday, November 11, 2009

Weitere ähnliche Inhalte

Andere mochten auch (20)

West E Port
West E PortWest E Port
West E Port
 
Jack Eport Term 4
Jack Eport Term 4Jack Eport Term 4
Jack Eport Term 4
 
Webinar2
Webinar2Webinar2
Webinar2
 
Using Innovation Games To Prioritize Technical Debt Pub
Using Innovation Games To Prioritize Technical Debt PubUsing Innovation Games To Prioritize Technical Debt Pub
Using Innovation Games To Prioritize Technical Debt Pub
 
Certified Sales and Marketing Professional Program
Certified Sales and Marketing Professional ProgramCertified Sales and Marketing Professional Program
Certified Sales and Marketing Professional Program
 
Unenclosable
UnenclosableUnenclosable
Unenclosable
 
Capodian Investment Management
Capodian Investment ManagementCapodian Investment Management
Capodian Investment Management
 
Klimatkontoret i Örebro
Klimatkontoret i ÖrebroKlimatkontoret i Örebro
Klimatkontoret i Örebro
 
02 the necto_application_ready
02 the necto_application_ready02 the necto_application_ready
02 the necto_application_ready
 
Klimatstrategimall
KlimatstrategimallKlimatstrategimall
Klimatstrategimall
 
mele's Eport-folio
mele's Eport-foliomele's Eport-folio
mele's Eport-folio
 
____,___
____,_______,___
____,___
 
Allmänt om Klimatkommunerna
Allmänt om KlimatkommunernaAllmänt om Klimatkommunerna
Allmänt om Klimatkommunerna
 
Unenclosable
UnenclosableUnenclosable
Unenclosable
 
Unenclosable
UnenclosableUnenclosable
Unenclosable
 
Business Intelligence Meets Big Data Variety
Business Intelligence Meets Big Data VarietyBusiness Intelligence Meets Big Data Variety
Business Intelligence Meets Big Data Variety
 
Wereldwinkelsvoorlichtingenfairtrade
WereldwinkelsvoorlichtingenfairtradeWereldwinkelsvoorlichtingenfairtrade
Wereldwinkelsvoorlichtingenfairtrade
 
Online sourceselementary
Online sourceselementaryOnline sourceselementary
Online sourceselementary
 
08 necto working_with_kpi_ready
08 necto working_with_kpi_ready08 necto working_with_kpi_ready
08 necto working_with_kpi_ready
 
VU University Amsterdam - The Social Web 2016 - Lecture 3
VU University Amsterdam - The Social Web 2016 - Lecture 3VU University Amsterdam - The Social Web 2016 - Lecture 3
VU University Amsterdam - The Social Web 2016 - Lecture 3
 

Ähnlich wie JDK7: Improved support for dynamic languages

Java 7: Fork/Join, Invokedynamic and the future
Java 7: Fork/Join, Invokedynamic and the futureJava 7: Fork/Join, Invokedynamic and the future
Java 7: Fork/Join, Invokedynamic and the futureSander Mak (@Sander_Mak)
 
JVM Interop - Functional Conf 2019
JVM Interop - Functional Conf 2019JVM Interop - Functional Conf 2019
JVM Interop - Functional Conf 2019Ravindra Jaju
 
JVM: A Platform for Multiple Languages
JVM: A Platform for Multiple LanguagesJVM: A Platform for Multiple Languages
JVM: A Platform for Multiple LanguagesKris Mok
 
JRuby: What's Different (RORO Melbourne October 2011)
JRuby: What's Different (RORO Melbourne October 2011)JRuby: What's Different (RORO Melbourne October 2011)
JRuby: What's Different (RORO Melbourne October 2011)Charles Nutter
 
JVM ecosystem languages and the future of JVM
JVM ecosystem languages and the future of JVMJVM ecosystem languages and the future of JVM
JVM ecosystem languages and the future of JVMMizanur Rahman Khan
 
JVM Ecosystem Languages And The Future of JVM
JVM Ecosystem Languages And The Future of JVMJVM Ecosystem Languages And The Future of JVM
JVM Ecosystem Languages And The Future of JVMSazzadur Rahaman
 
Jvm ecosystem languages and the future of jvm
Jvm ecosystem languages  and  the future of jvmJvm ecosystem languages  and  the future of jvm
Jvm ecosystem languages and the future of jvmJUGBD
 
Visual COBOL Development for Unix and Java
Visual COBOL Development for Unix and JavaVisual COBOL Development for Unix and Java
Visual COBOL Development for Unix and JavaMicro Focus
 
Why JRuby? - RubyConf 2012
Why JRuby? - RubyConf 2012Why JRuby? - RubyConf 2012
Why JRuby? - RubyConf 2012Charles Nutter
 
Ruby On Rails pizza training
Ruby On Rails pizza trainingRuby On Rails pizza training
Ruby On Rails pizza trainingdavid_alphen
 
Using Java from Ruby with JRuby IRB
Using Java from Ruby with JRuby IRBUsing Java from Ruby with JRuby IRB
Using Java from Ruby with JRuby IRBHiro Asari
 
TorqueBox - Ultrapassando a fronteira entre Java e Ruby
TorqueBox - Ultrapassando a fronteira entre Java e RubyTorqueBox - Ultrapassando a fronteira entre Java e Ruby
TorqueBox - Ultrapassando a fronteira entre Java e RubyBruno Oliveira
 
JRuby - The Best of Java and Ruby
JRuby - The Best of Java and RubyJRuby - The Best of Java and Ruby
JRuby - The Best of Java and RubyEvgeny Rahman
 
Why JVM will outlive java?
Why JVM will outlive java?Why JVM will outlive java?
Why JVM will outlive java?Ram Lakshmanan
 
What Your Jvm Has Been Trying To Tell You
What Your Jvm Has Been Trying To Tell YouWhat Your Jvm Has Been Trying To Tell You
What Your Jvm Has Been Trying To Tell YouJohn Pape
 

Ähnlich wie JDK7: Improved support for dynamic languages (20)

Java 7: Fork/Join, Invokedynamic and the future
Java 7: Fork/Join, Invokedynamic and the futureJava 7: Fork/Join, Invokedynamic and the future
Java 7: Fork/Join, Invokedynamic and the future
 
JVM Interop - Functional Conf 2019
JVM Interop - Functional Conf 2019JVM Interop - Functional Conf 2019
JVM Interop - Functional Conf 2019
 
JVM: A Platform for Multiple Languages
JVM: A Platform for Multiple LanguagesJVM: A Platform for Multiple Languages
JVM: A Platform for Multiple Languages
 
JRuby: What's Different (RORO Melbourne October 2011)
JRuby: What's Different (RORO Melbourne October 2011)JRuby: What's Different (RORO Melbourne October 2011)
JRuby: What's Different (RORO Melbourne October 2011)
 
JVM ecosystem languages and the future of JVM
JVM ecosystem languages and the future of JVMJVM ecosystem languages and the future of JVM
JVM ecosystem languages and the future of JVM
 
JVM Ecosystem Languages And The Future of JVM
JVM Ecosystem Languages And The Future of JVMJVM Ecosystem Languages And The Future of JVM
JVM Ecosystem Languages And The Future of JVM
 
Jvm ecosystem languages and the future of jvm
Jvm ecosystem languages  and  the future of jvmJvm ecosystem languages  and  the future of jvm
Jvm ecosystem languages and the future of jvm
 
Visual COBOL Development for Unix and Java
Visual COBOL Development for Unix and JavaVisual COBOL Development for Unix and Java
Visual COBOL Development for Unix and Java
 
Why JRuby? - RubyConf 2012
Why JRuby? - RubyConf 2012Why JRuby? - RubyConf 2012
Why JRuby? - RubyConf 2012
 
Euruko 2012 - JRuby
Euruko 2012 - JRubyEuruko 2012 - JRuby
Euruko 2012 - JRuby
 
Ruby On Rails pizza training
Ruby On Rails pizza trainingRuby On Rails pizza training
Ruby On Rails pizza training
 
จาวา
จาวาจาวา
จาวา
 
Using Java from Ruby with JRuby IRB
Using Java from Ruby with JRuby IRBUsing Java from Ruby with JRuby IRB
Using Java from Ruby with JRuby IRB
 
TorqueBox - Ultrapassando a fronteira entre Java e Ruby
TorqueBox - Ultrapassando a fronteira entre Java e RubyTorqueBox - Ultrapassando a fronteira entre Java e Ruby
TorqueBox - Ultrapassando a fronteira entre Java e Ruby
 
Simple insites into JVM
Simple insites into JVMSimple insites into JVM
Simple insites into JVM
 
JRuby - The Best of Java and Ruby
JRuby - The Best of Java and RubyJRuby - The Best of Java and Ruby
JRuby - The Best of Java and Ruby
 
Why JVM will outlive java?
Why JVM will outlive java?Why JVM will outlive java?
Why JVM will outlive java?
 
Libra: a Library OS for a JVM
Libra: a Library OS for a JVMLibra: a Library OS for a JVM
Libra: a Library OS for a JVM
 
RubyConf 2009
RubyConf 2009RubyConf 2009
RubyConf 2009
 
What Your Jvm Has Been Trying To Tell You
What Your Jvm Has Been Trying To Tell YouWhat Your Jvm Has Been Trying To Tell You
What Your Jvm Has Been Trying To Tell You
 

Mehr von Sander Mak (@Sander_Mak)

TypeScript: coding JavaScript without the pain
TypeScript: coding JavaScript without the painTypeScript: coding JavaScript without the pain
TypeScript: coding JavaScript without the painSander Mak (@Sander_Mak)
 
The Ultimate Dependency Manager Shootout (QCon NY 2014)
The Ultimate Dependency Manager Shootout (QCon NY 2014)The Ultimate Dependency Manager Shootout (QCon NY 2014)
The Ultimate Dependency Manager Shootout (QCon NY 2014)Sander Mak (@Sander_Mak)
 
Cross-Build Injection attacks: how safe is your Java build?
Cross-Build Injection attacks: how safe is your Java build?Cross-Build Injection attacks: how safe is your Java build?
Cross-Build Injection attacks: how safe is your Java build?Sander Mak (@Sander_Mak)
 
Hibernate Performance Tuning (JEEConf 2012)
Hibernate Performance Tuning (JEEConf 2012)Hibernate Performance Tuning (JEEConf 2012)
Hibernate Performance Tuning (JEEConf 2012)Sander Mak (@Sander_Mak)
 

Mehr von Sander Mak (@Sander_Mak) (20)

Scalable Application Development @ Picnic
Scalable Application Development @ PicnicScalable Application Development @ Picnic
Scalable Application Development @ Picnic
 
Coding Your Way to Java 13
Coding Your Way to Java 13Coding Your Way to Java 13
Coding Your Way to Java 13
 
Coding Your Way to Java 12
Coding Your Way to Java 12Coding Your Way to Java 12
Coding Your Way to Java 12
 
Java Modularity: the Year After
Java Modularity: the Year AfterJava Modularity: the Year After
Java Modularity: the Year After
 
Desiging for Modularity with Java 9
Desiging for Modularity with Java 9Desiging for Modularity with Java 9
Desiging for Modularity with Java 9
 
Modules or microservices?
Modules or microservices?Modules or microservices?
Modules or microservices?
 
Migrating to Java 9 Modules
Migrating to Java 9 ModulesMigrating to Java 9 Modules
Migrating to Java 9 Modules
 
Java 9 Modularity in Action
Java 9 Modularity in ActionJava 9 Modularity in Action
Java 9 Modularity in Action
 
Java modularity: life after Java 9
Java modularity: life after Java 9Java modularity: life after Java 9
Java modularity: life after Java 9
 
Provisioning the IoT
Provisioning the IoTProvisioning the IoT
Provisioning the IoT
 
Event-sourced architectures with Akka
Event-sourced architectures with AkkaEvent-sourced architectures with Akka
Event-sourced architectures with Akka
 
TypeScript: coding JavaScript without the pain
TypeScript: coding JavaScript without the painTypeScript: coding JavaScript without the pain
TypeScript: coding JavaScript without the pain
 
The Ultimate Dependency Manager Shootout (QCon NY 2014)
The Ultimate Dependency Manager Shootout (QCon NY 2014)The Ultimate Dependency Manager Shootout (QCon NY 2014)
The Ultimate Dependency Manager Shootout (QCon NY 2014)
 
Modular JavaScript
Modular JavaScriptModular JavaScript
Modular JavaScript
 
Modularity in the Cloud
Modularity in the CloudModularity in the Cloud
Modularity in the Cloud
 
Cross-Build Injection attacks: how safe is your Java build?
Cross-Build Injection attacks: how safe is your Java build?Cross-Build Injection attacks: how safe is your Java build?
Cross-Build Injection attacks: how safe is your Java build?
 
Scala & Lift (JEEConf 2012)
Scala & Lift (JEEConf 2012)Scala & Lift (JEEConf 2012)
Scala & Lift (JEEConf 2012)
 
Hibernate Performance Tuning (JEEConf 2012)
Hibernate Performance Tuning (JEEConf 2012)Hibernate Performance Tuning (JEEConf 2012)
Hibernate Performance Tuning (JEEConf 2012)
 
Akka (BeJUG)
Akka (BeJUG)Akka (BeJUG)
Akka (BeJUG)
 
Fork Join (BeJUG 2012)
Fork Join (BeJUG 2012)Fork Join (BeJUG 2012)
Fork Join (BeJUG 2012)
 

Kürzlich hochgeladen

Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 

Kürzlich hochgeladen (20)

Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 

JDK7: Improved support for dynamic languages

  • 1. JDK7: Improved support for dynamic languages Sander Mak Info Support Wednesday, November 11, 2009
  • 2. Overview • JVM Languages • Problems for dynamic languages • MLVM: Multi Language Virtual Machine • Method handles • Invokedynamic • Wrap-up Wednesday, November 11, 2009
  • 3. The Java Platform The JVM has become a complex beast... 1.0 1996 1.1 1.2 1.3 1.4 1.5 1.6 2009 • Performance • Binary compatibility • Safety • Platform independence Wednesday, November 11, 2009
  • 4. The Java Platform Wednesday, November 11, 2009
  • 5. The Java Platform Java language JVM Java libraries Wednesday, November 11, 2009
  • 6. The Java Platform • More expressiveness: – ‘Pure’ OO Java JRuby – Blocks/Closures/ Scala JVM Higher order functions Groovy – Dynamic typing Clojure – Metaprogramming JavaFX Java libraries • Proven VM • Interop with Java ‘legacy’ Wednesday, November 11, 2009
  • 7. JVM Languages Java Wednesday, November 11, 2009
  • 8. JVM Languages Groovy Clojure JRuby Java JavaFX Scala Wednesday, November 11, 2009
  • 9. JVM Languages jProlog Pizza MultiJava Fan JLog Groovy Clojure MetaJ JRuby Java JavaFX Jaskell Rhino Scala JBasic Aardappel Funnel Jacl Drools Jython Wednesday, November 11, 2009
  • 10. JVM Languages 240+ Languages Wednesday, November 11, 2009
  • 11. JVM Languages ‘Language fictions’ JVM Exceptions Primitive types Objects Access control Garbage coll. Threading Memory model Wednesday, November 11, 2009
  • 12. JVM Languages ‘Language fictions’ Java Enums Checked exc. JVM Generics Exceptions Exceptions Primitive types Primitive types Objects Objects Access control Access control Garbage coll. Garbage coll. Threading Threading. Memory model Memory model Wednesday, November 11, 2009
  • 13. JVM Languages JRuby ‘Language Open classes Dynamic typing fictions’ Java Closures Enums Enums Checked exc. Checked exc. JVM Generics Generics Exceptions Exceptions Exceptions Primitive types Primitive types Primitive types Objects Objects Objects Access control Access control Access control Garbage coll. Garbage coll. Garbage coll. Threading Threading. Threading Memory model Memory model Memory model Wednesday, November 11, 2009
  • 14. JVM Languages JRuby ‘Language Open classes Dynamic typing fictions’ Java Closures Enums Enums Checked exc. Checked exc. JVM Generics Generics Exceptions Exceptions Exceptions Primitive types Primitive types Primitive types Objects Objects Objects Access control Access control Access control Garbage coll. Garbage coll. Garbage coll. Threading Threading. Threading Memory model Memory model Memory model Wednesday, November 11, 2009
  • 15. Compiling dynamic languages Performance Smaller = better for Java Wednesday, November 11, 2009
  • 16. Compiling dynamic languages Performance (in fairness: JRuby compares well to Ruby) Smaller = better for JRuby Wednesday, November 11, 2009
  • 17. Compiling dynamic languages First: statically typed Java Java public class Test { public static void main(String[] args) { ArrayList<String> names = new ArrayList<String>(); names.add("John"); names.add("Pete"); Collections.sort(names); } } Wednesday, November 11, 2009
  • 18. Compiling dynamic languages Java public class Test { public static void main(String[] args) { ArrayList<String> names = new ArrayList<String>(); names.add("John"); names.add("Pete"); Collections.sort(names); } } Wednesday, November 11, 2009
  • 19. Compiling dynamic languages Where are the types? Bytecode 0: new #2; //class java/util/ArrayList 3: dup 4: invokespecial #3; //Method java/util/ArrayList."<init>":()V 7: astore_1 8: aload_1 9: ldc #4; //String John 11: invokevirtual #5; //Method java/util/ArrayList.add:(Ljava/lang/ Object;)Z 14: pop 15: aload_1 16: ldc #6; //String Pete 18: invokevirtual #5; //Method java/util/ArrayList.add:(Ljava/lang/ Object;)Z 21: pop 22: aload_1 23: invokestatic #7; //Method java/util/Collections.sort:(Ljava/util/ List;)V 26: return Wednesday, November 11, 2009
  • 20. Compiling dynamic languages At the callsites! Bytecode 0: new #2; //class java/util/ArrayList 3: dup 4: invokespecial #3; //Method java/util/ArrayList."<init>":()V 7: astore_1 8: aload_1 9: ldc #4; //String John 11: invokevirtual #5; //Method java/util/ArrayList.add:(Ljava/lang/ Object;)Z 14: pop 15: aload_1 16: ldc #6; //String Pete 18: invokevirtual #5; //Method java/util/ArrayList.add:(Ljava/lang/ Object;)Z 21: pop 22: aload_1 23: invokestatic #7; //Method java/util/Collections.sort:(Ljava/util/ List;)V 26: return Wednesday, November 11, 2009
  • 21. Compiling dynamic languages At the callsites!in JVM Invocation Bytecode Bytecode Example 0: new #2; //class java/util/ArrayList 3: dupinvokestatic Collections.sort(list) 4: invokespecial #3; //Method java/util/ArrayList."<init>":()V 7: astore_1 invokevirtual list.add(element) list :: java.util.ArrayList 8: aload_1 9: ldc #4; //String John invokeinterface list.add(element) list :: java.util.List 11: invokevirtual #5; //Method java/util/ArrayList.add:(Ljava/lang/ Object;)Z invokespecial constructor call, i.e.: new ArrayList() 14: pop 15: aload_1 16: ldc #6; //String Pete 18: invokevirtual #5; //Method java/util/ArrayList.add:(Ljava/lang/ Object;)Z 21: pop 22: aload_1 23: invokestatic #7; //Method java/util/Collections.sort:(Ljava/util/ List;)V 26: return Wednesday, November 11, 2009
  • 22. Compiling dynamic languages • JVM ‘more dynamic’ than Java • Exception: method calls – Signature at callsite must match exactly TargetClass Name Method descriptor 18: invokevirtual #5; //Method java/util/ArrayList.add:(Ljava/lang/Object;)Z – Dispatch on static type of call and dynamic type of receiver – Method must exist at compile time – Link to target is fixed, no relinking Wednesday, November 11, 2009
  • 23. Compiling dynamic languages Again, where are the types? JRuby names = ["John", "Pete"] puts names.sort • Type inference not feasible • Types may be constructed @ runtime • Types may change @ runtime • Invocation of closures constructed @ runtime Wednesday, November 11, 2009
  • 24. Compiling dynamic languages Compiling 2 lines of JRuby ... ... yields >80 bytecode instructions Bytecode public class Test_dot_ruby extends org/jruby/ast/executable/AbstractScript { public <init>()V ANEWARRAY org/jruby/runtime/CallSite ICONST_1 LDC "sort" INVOKESTATIC Test_dot_ruby.setCallSite ([Lorg/jruby/runtime/CallSite;ILjava/lang/String;)[Lorg/jruby/ runtime/CallSite; ICONST_0 LDC "puts" INVOKESTATIC Test_dot_ruby.setFunctionalCallSite ([Lorg/jruby/runtime/CallSite;ILjava/lang/String;) [Lorg/jruby/runtime/CallSite; PUTFIELD Test_dot_ruby.callSites : [Lorg/jruby/runtime/CallSite; ALOAD 0 ICONST_2 INVOKEVIRTUAL Test_dot_ruby.initStrings (I)[Lorg/jruby/util/ByteList; LDC 1 LDC "Pete" INVOKESTATIC org/jruby/ast/executable/AbstractScript.createByteList ([Lorg/jruby/util/ByteList;ILjava/ Wednesday, November 11, 2009
  • 25. Compiling dynamic languages Compiling 2 lines of JRuby ... details Method call ... yields >80 bytecode instructions Lorg/jruby/runtime/builtin/IRubyObject Bytecode LDC “sort” public class Test_dot_ruby extends org/jruby/ast/executable/AbstractScript { INVOKESTATIC Test_dot_ruby.setCallSite ... public <init>()V ANEWARRAY org/jruby/runtime/CallSite ICONST_1INVOKEVIRTUAL org/jruby/runtime/CallSite.call LDC "sort" ... INVOKESTATIC Test_dot_ruby.setCallSite ([Lorg/jruby/runtime/CallSite;ILjava/lang/String;)[Lorg/jruby/ runtime/CallSite; ICONST_0 ‘Fat call paths’ LDC "puts" INVOKESTATIC Test_dot_ruby.setFunctionalCallSite ([Lorg/jruby/runtime/CallSite;ILjava/lang/String;) [Lorg/jruby/runtime/CallSite; PUTFIELD Test_dot_ruby.callSites : [Lorg/jruby/runtime/CallSite; ALOAD 0 ICONST_2 INVOKEVIRTUAL Test_dot_ruby.initStrings (I)[Lorg/jruby/util/ByteList; LDC 1 LDC "Pete" INVOKESTATIC org/jruby/ast/executable/AbstractScript.createByteList ([Lorg/jruby/util/ByteList;ILjava/ Wednesday, November 11, 2009
  • 26. Compiling dynamic languages • Common solutions: - Don’t compile, interpret (sometimes unavoidable) - AOT compilation into specialized invoker classes (suitable for core methods) - AOT compilation, then use reflection (for user defined types) - JIT bytecode generation of small stub methods Either way: abundance of synthetic types and bytecode hard to optimize for JVM Wednesday, November 11, 2009
  • 27. MLVM • Change of direction @ Sun – Introduction of JavaFX – Fortress language – Officially supporting JRuby – Open sourcing JDK (compiler & VM) • Still, JVM remains Java-centric • Enter: the MLVM and JSR-292 Multi Language VM Da Vinci Machine Wednesday, November 11, 2009
  • 28. MLVM John Rose @ Sun: Language implementers know what they want   (and know how to simulate it with 100x slowdown)   VM implementers know what VMs can do   (and know how to make their favorite language sing) Let's bring them together. (JSR 292 ‘invokedynamic’) Wednesday, November 11, 2009
  • 29. JSR-292 So what do dynamic languages want? Binding Marker Delay binding as long Indicate in bytecode as possible. Hide that a dynamic call exact destination of should be made call @ compiletime Adaptation Language should be able to implement its own coercion rules when matching type signatures Wednesday, November 11, 2009
  • 30. Method handles • Lightweight, safe method pointers • Like java.lang.reflect.Method, but: – No argument boxing/unboxing – Access checks only at creation time – Leaner, and as fast as direct call – No wrapping of exceptions Wednesday, November 11, 2009
  • 31. Method handles • Lightweight, safe method pointers • Like java.lang.reflect.Method, but: – No argument boxing/unboxing – Access checks only at creation time – Leaner, and as fast as direct call – No wrapping of exceptions Java 7 MethodHandle mh = MethodHandles.lookup().findStatic( Enclosing.class, “methodName”, MethodType.make(String.class, int.class, String.class) ) mh.<String>invoke(1, “2”) Wednesday, November 11, 2009
  • 32. Method handles • Lightweight, safe method pointers • Like java.lang.reflect.Method, but: – No argument boxing/unboxing – Access checks only at creation time – Leaner, and as fast as direct call – No wrapping of exceptions Bytecode 59: aload 4 61: invokevirtual #11; //Method java/dyn/MethodHandle.invoke:(I;Ljava/ lang/String;)Ljava/lang/String Wednesday, November 11, 2009
  • 33. Method handles • Instance methods: first arg is receiver Wednesday, November 11, 2009
  • 34. Method handles • Instance methods: first arg is receiver Java 7 MethodHandle mh = MethodHandles.lookup().findVirtual( Enclosing.class, “methodName”, MethodType.make(String.class, int.class, String.class) ) mh.<String>invoke(receiver, 1, “2”) • Receiver may be pre-bound to MH • Faster than normal ‘invokevirtual’! • Method Handles prepare for closures... Wednesday, November 11, 2009
  • 35. Method handles • Immutable: MH has one function type • Signature polymorphism for invoke • Can be composed and/or adapted: – Add or drop arguments – Guard with test – Convert arguments JVM ‘knows’ Method Handles: • Can inline (chains of) method handles Wednesday, November 11, 2009
  • 36. Method handles • Immutable: MH has one function type MH Chain example: Test MH • Signature polymorphism for invoke Guard Originalcomposed and/or adapted: • Can be Insert with Success MH MH arg. test – Add or drop arguments – Guard with test Fallback MH mh.invoke(..) – Convert arguments JVM ‘knows’ Method Handles: • Can inline (chains of) method handles Wednesday, November 11, 2009
  • 37. Anonymous classloading Create unnamed classes from byte[] • Garbage collectible Class not in system dictionary, Class.forName() won’t work • Inherit access & security from host Host class is caller of Anon. classloader • Create patchable template classes Specialize classes by patching constant pool @ loadtime Vastly improves runtime code generation Wednesday, November 11, 2009
  • 38. Anonymous classloading Java 7 Create unnamed classes from byte[] MethodType methodType = MethodType.make(int.class, • Garbage collectible int.class, int.class); Class not in system dictionary, Class.forName() won’t work ExprBuilder builder = new ExprBuilder(methodType); • Inherit access & security from host Var a = builder.parameter(0); Var b = builder.parameter(1); Host class is caller of Anon. classloader builder. • Create patchable template classes load(a). load(b). Specialize classes by patching constant pool @ loadtime add(); MethodHandle mh = builder.createMethodHandle(Main.class); Vastly improves runtime code generation System.out.println(mh.invoke(2, 3)); Wednesday, November 11, 2009
  • 39. Anonymous classloading Java 7 Create unnamed classes from byte[] MethodType methodType = MethodType.make(int.class, • Garbage collectible int.class, int.class); Class not in system dictionary, Class.forName() won’t work ExprBuilder builder = new ExprBuilder(methodType); • Inherit access & security from host Var a = builder.parameter(0); Var b = builder.parameter(1); Host class is caller of Anon. classloader builder. • Create patchable template classes load(a). load(b). Specialize classes by patching constant pool @ loadtime add(); MethodHandle mh = builder.createMethodHandle(Main.class); Vastly improves runtime code generation System.out.println(mh.invoke(2, 3)); Wednesday, November 11, 2009
  • 40. Anonymous classloading Java 7 Create unnamed classes from byte[] MethodType methodType = MethodType.make(int.class, • Garbage collectible int.class, int.class); Class not in system dictionary, Class.forName() won’t work ExprBuilder builder = new ExprBuilder(methodType); • Inherit access & security from host Var a = builder.parameter(0); Var b = builder.parameter(1); Host class is caller of Anon. classloader builder. • Create patchable template classes load(a). load(b). Specialize classes by patching constant pool @ loadtime add(); MethodHandle mh = builder.createMethodHandle(Main.class); Vastly improves runtime code generation System.out.println(mh.invoke(2, 3)); Wednesday, November 11, 2009
  • 41. JSR-292 So what do dynamic languages want? Binding Marker Delay binding as long Indicate in bytecode as possible. Hide that a dynamic call exact destination of should be made call @ compiletime Adaptation Language should be able to implement its own coercion rules when matching type signatures Wednesday, November 11, 2009
  • 42. JSR-292 So what do dynamic languages want? Adaptation MH can be chained to add Language should be able to implement its custom conversion rules own coercion rules when matching type signatures Argument list can be adjusted Wednesday, November 11, 2009
  • 43. JSR-292 So what do dynamic languages want? Binding MH is a flexible, adaptable Delay binding as long as possible. Hide pointer to methods exact destination of call @ compiletime Invocation overhead low Invocation binds directly to single method handle Wednesday, November 11, 2009
  • 44. Invokedynamic New bytecode, last piece of JSR-292 puzzle: Name Method descriptor 18: invokedynamic #5; //NameAndType addInts:(II)I • Invocation without reference to actual method descriptor • Instead, symbolic name and type • No receiver: all arguments are equal What is the target? Wednesday, November 11, 2009
  • 45. Invokedynamic - bootstrap Bootstrap method receives dynamic calls Java 7 static { Linkage.registerBootstrapMethod( "bootstrapID"); } static CallSite bootstrapID(Class<?> callerClass, String methodName, MethodType methodType) { MethodHandle target = .. CallSite site = new CallSite(callerClass, methodName, methodType); site.setTarget(target); return site; } Wednesday, November 11, 2009
  • 46. Invokedynamic - bootstrap Bootstrap method receives dynamic calls Java 7 static { Linkage.registerBootstrapMethod( "bootstrapID"); } static CallSite bootstrapID(Class<?> callerClass, String methodName, MethodType methodType) { MethodHandle target = .. CallSite site = new CallSite(callerClass, methodName, methodType); site.setTarget(target); return site; } Wednesday, November 11, 2009
  • 47. Invokedynamic - bootstrap Bootstrap method receives dynamic calls Java 7 static { Linkage.registerBootstrapMethod( "bootstrapID"); } static CallSite bootstrapID(Class<?> callerClass, String methodName, MethodType methodType) { MethodHandle target = .. CallSite site = new CallSite(callerClass, methodName, methodType); site.setTarget(target); return site; } Wednesday, November 11, 2009
  • 48. Invokedynamic - bootstrap Bootstrap method receives dynamic calls Java 7 static { Linkage.registerBootstrapMethod( "bootstrapID"); } static CallSite bootstrapID(Class<?> callerClass, String methodName, MethodType methodType) { MethodHandle target = .. CallSite site = new CallSite(callerClass, methodName, methodType); site.setTarget(target); return site; } Wednesday, November 11, 2009
  • 49. Invokedynamic - bootstrap • CallSite immutable, except for target • After installing target, invokedynamic invokes MH directly DynamicInvokerClass ImplementationClass aload_1; invokedyn. meth:Type; implementation(Type) { return; result = .. return result } bootstrap( .. ) { ..lookup.. return CallSite } Wednesday, November 11, 2009
  • 50. Invokedynamic - bootstrap • CallSite immutable, except for target • After installing target, invokedynamic invokes MH directly DynamicInvokerClass ImplementationClass aload_1; invokedyn. meth:Type; implementation(Type) { return; result = .. return result } bootstrap( .. ) { ..lookup.. return CallSite } Wednesday, November 11, 2009
  • 51. Invokedynamic - bootstrap • CallSite immutable, except for target • After installing target, invokedynamic invokes MH directly DynamicInvokerClass ImplementationClass aload_1; invokedyn. meth:Type; implementation(Type) { return; result = .. return result } bootstrap( .. ) { ..lookup.. return CallSite } Wednesday, November 11, 2009
  • 52. Invokedynamic - bootstrap • CallSite immutable, except for target • After installing target, invokedynamic invokes MH directly DynamicInvokerClass ImplementationClass aload_1; invokedyn. meth:Type; implementation(Type) { return; result = .. return result CallSite is } bootstrap( .. ) { sub-classable ..lookup.. return CallSite MH can be guarded } with test Wednesday, November 11, 2009
  • 53. Invokedynamic - bootstrap • CallSite immutable, except for target • After installing target, invokedynamic invokes MH directly DynamicInvokerClass ImplementationClass aload_1; invokedyn. meth:Type; Method implementation(Type) { return; Handle(s) result = .. return result } CallSite target bootstrap( .. ) { may be changed ..lookup.. return CallSite later! } Wednesday, November 11, 2009
  • 54. Project coin: JSR-292 syntax Java 7 import java.dyn.*; public class HelloSimple { public static void main(String... args) { greeter.<void>invoke(args[0]); // Direct MH InvokeDynamic.sayIt(args[0]); // invokedynamic } public static void greeter(String x) { .. println } static MethodHandle greeter = MethodHandles.lookup().findStatic( Hello.class, "greeter", MethodType.make(void.class, String.class)); // bootstrap: link “sayIt” to greeter MH Wednesday, November 11, 2009
  • 55. Project coin: JSR-292 syntax Java 7 import java.dyn.*; public class HelloSimple { public static void main(String... args) { greeter.<void>invoke(args[0]); // Direct MH InvokeDynamic.sayIt(args[0]); // invokedynamic } public static void greeter(String x) { .. println } static MethodHandle greeter = MethodHandles.lookup().findStatic( Hello.class, "greeter", MethodType.make(void.class, String.class)); // bootstrap: link “sayIt” to greeter MH Wednesday, November 11, 2009
  • 56. Project coin: JSR-292 syntax Java 7 import java.dyn.*; public class HelloSimple { public static void main(String... args) { greeter.<void>invoke(args[0]); // Direct MH InvokeDynamic.sayIt(args[0]); // invokedynamic } public static void greeter(String x) { .. println } static MethodHandle greeter = MethodHandles.lookup().findStatic( Hello.class, "greeter", MethodType.make(void.class, String.class)); // bootstrap: link “sayIt” to greeter MH Wednesday, November 11, 2009
  • 57. Invokedynamic • Invokedynamic + bootstrap method allow language to up-call from VM to custom code for linking/calling. Not impossible before, but hard and slow. JVM now fully optimizes dynamic calls. Wednesday, November 11, 2009
  • 58. JSR-292 So what do dynamic languages want? Binding Marker Delay binding as long Indicate in bytecode as possible. Hide that a dynamic call exact destination of should be made call @ compiletime Adaptation Language should be able to implement its own coercion rules when matching type signatures Wednesday, November 11, 2009
  • 59. JSR-292 So what do dynamic languages want? Marker invokedynamic bytecode Indicate in bytecode that a dynamic call should be made Binding bootstrap mechanism and Delay binding as long as possible. Hide method handles exact destination of call @ compiletime Wednesday, November 11, 2009
  • 60. Wrap-up • JSR-292 invokedynamic features: – Language implementors can avoid tricks – Level the playing ground, speedwise – Allow existing VM optimizations to be applied to new paradigms • JSR292/invokedynamic will be backported Wednesday, November 11, 2009
  • 61. Wrap-up • JRuby, Groovy actively working on JSR-292 support • For example, JRuby can cut 80% of linking/calling code in runtime • Unfortunately no real benchmarks, but: – Surinx preliminary testing: up to 5-fold increase on naive fibonacci testcase • JDK7 due 1st quarter 2010 Wednesday, November 11, 2009

Hinweis der Redaktion

  1. * Groot deel tijd kijken naar probleem wat opgelost ipv alleen naar &amp;#x2018;coole nieuwe features&amp;#x2019; kijken * Nadruk niet op API details, zijn nog in ontwikkeling * gaan ook niet de discussie aan of dynamische talen beter/slechter zijn, het is een gegeven.
  2. * First: just Java, interpreted, grew into optimizing JIT compiler * Java language/platform was extended many times though JVM bytecode format nearly unchanged * However JVM grew very mature (JIT, optimize/deoptimize)
  3. * Dynamic language: hard to define, but here: dynamically typed languages like Ruby/Python, with strong meta-programming * Java language/platform was extended many times though JVM bytecode format nearly unchanged * However JVM grew very mature (JIT, optimize/deoptimize) (same is going on for the .Net CLR)
  4. * Dynamic language: hard to define, but here: dynamically typed languages like Ruby/Python, with strong meta-programming * Java language/platform was extended many times though JVM bytecode format nearly unchanged * However JVM grew very mature (JIT, optimize/deoptimize) (same is going on for the .Net CLR)
  5. * Dynamic language: hard to define, but here: dynamically typed languages like Ruby/Python, with strong meta-programming * Java language/platform was extended many times though JVM bytecode format nearly unchanged * However JVM grew very mature (JIT, optimize/deoptimize) (same is going on for the .Net CLR)
  6. * Dynamic language: hard to define, but here: dynamically typed languages like Ruby/Python, with strong meta-programming * Java language/platform was extended many times though JVM bytecode format nearly unchanged * However JVM grew very mature (JIT, optimize/deoptimize) (same is going on for the .Net CLR)
  7. Interessante ontwikkeling is dat Sun dit steunt (JavaFX, maar ook JRuby/Jython) Waarom zoveel talen? Ze bieden allemaal hun eigen &amp;#x2018;werkelijkheid&amp;#x2019; (volgende slide)
  8. Interessante ontwikkeling is dat Sun dit steunt (JavaFX, maar ook JRuby/Jython) Waarom zoveel talen? Ze bieden allemaal hun eigen &amp;#x2018;werkelijkheid&amp;#x2019; (volgende slide)
  9. Interessante ontwikkeling is dat Sun dit steunt (JavaFX, maar ook JRuby/Jython) Waarom zoveel talen? Ze bieden allemaal hun eigen &amp;#x2018;werkelijkheid&amp;#x2019; (volgende slide)
  10. Interessante ontwikkeling is dat Sun dit steunt (JavaFX, maar ook JRuby/Jython) Waarom zoveel talen? Ze bieden allemaal hun eigen &amp;#x2018;werkelijkheid&amp;#x2019; (volgende slide)
  11. Interessante ontwikkeling is dat Sun dit steunt (JavaFX, maar ook JRuby/Jython) Waarom zoveel talen? Ze bieden allemaal hun eigen &amp;#x2018;werkelijkheid&amp;#x2019; (volgende slide)
  12. Interessante ontwikkeling is dat Sun dit steunt (JavaFX, maar ook JRuby/Jython) Waarom zoveel talen? Ze bieden allemaal hun eigen &amp;#x2018;werkelijkheid&amp;#x2019; (volgende slide)
  13. Interessante ontwikkeling is dat Sun dit steunt (JavaFX, maar ook JRuby/Jython) Waarom zoveel talen? Ze bieden allemaal hun eigen &amp;#x2018;werkelijkheid&amp;#x2019; (volgende slide)
  14. Interessante ontwikkeling is dat Sun dit steunt (JavaFX, maar ook JRuby/Jython) Waarom zoveel talen? Ze bieden allemaal hun eigen &amp;#x2018;werkelijkheid&amp;#x2019; (volgende slide)
  15. Interessante ontwikkeling is dat Sun dit steunt (JavaFX, maar ook JRuby/Jython) Waarom zoveel talen? Ze bieden allemaal hun eigen &amp;#x2018;werkelijkheid&amp;#x2019; (volgende slide)
  16. Interessante ontwikkeling is dat Sun dit steunt (JavaFX, maar ook JRuby/Jython) Waarom zoveel talen? Ze bieden allemaal hun eigen &amp;#x2018;werkelijkheid&amp;#x2019; (volgende slide)
  17. Interessante ontwikkeling is dat Sun dit steunt (JavaFX, maar ook JRuby/Jython) Waarom zoveel talen? Ze bieden allemaal hun eigen &amp;#x2018;werkelijkheid&amp;#x2019; (volgende slide)
  18. Interessante ontwikkeling is dat Sun dit steunt (JavaFX, maar ook JRuby/Jython) Waarom zoveel talen? Ze bieden allemaal hun eigen &amp;#x2018;werkelijkheid&amp;#x2019; (volgende slide)
  19. Interessante ontwikkeling is dat Sun dit steunt (JavaFX, maar ook JRuby/Jython) Waarom zoveel talen? Ze bieden allemaal hun eigen &amp;#x2018;werkelijkheid&amp;#x2019; (volgende slide)
  20. Interessante ontwikkeling is dat Sun dit steunt (JavaFX, maar ook JRuby/Jython) Waarom zoveel talen? Ze bieden allemaal hun eigen &amp;#x2018;werkelijkheid&amp;#x2019; (volgende slide)
  21. Interessante ontwikkeling is dat Sun dit steunt (JavaFX, maar ook JRuby/Jython) Waarom zoveel talen? Ze bieden allemaal hun eigen &amp;#x2018;werkelijkheid&amp;#x2019; (volgende slide)
  22. Interessante ontwikkeling is dat Sun dit steunt (JavaFX, maar ook JRuby/Jython) Waarom zoveel talen? Ze bieden allemaal hun eigen &amp;#x2018;werkelijkheid&amp;#x2019; (volgende slide)
  23. Interessante ontwikkeling is dat Sun dit steunt (JavaFX, maar ook JRuby/Jython) Waarom zoveel talen? Ze bieden allemaal hun eigen &amp;#x2018;werkelijkheid&amp;#x2019; (volgende slide)
  24. Interessante ontwikkeling is dat Sun dit steunt (JavaFX, maar ook JRuby/Jython) Waarom zoveel talen? Ze bieden allemaal hun eigen &amp;#x2018;werkelijkheid&amp;#x2019; (volgende slide)
  25. Interessante ontwikkeling is dat Sun dit steunt (JavaFX, maar ook JRuby/Jython) Waarom zoveel talen? Ze bieden allemaal hun eigen &amp;#x2018;werkelijkheid&amp;#x2019; (volgende slide)
  26. Interessante ontwikkeling is dat Sun dit steunt (JavaFX, maar ook JRuby/Jython) Waarom zoveel talen? Ze bieden allemaal hun eigen &amp;#x2018;werkelijkheid&amp;#x2019; (volgende slide)
  27. Interessante ontwikkeling is dat Sun dit steunt (JavaFX, maar ook JRuby/Jython) Waarom zoveel talen? Ze bieden allemaal hun eigen &amp;#x2018;werkelijkheid&amp;#x2019; (volgende slide)
  28. Interessante ontwikkeling is dat Sun dit steunt (JavaFX, maar ook JRuby/Jython) Waarom zoveel talen? Ze bieden allemaal hun eigen &amp;#x2018;werkelijkheid&amp;#x2019; (volgende slide)
  29. Interessante ontwikkeling is dat Sun dit steunt (JavaFX, maar ook JRuby/Jython) Waarom zoveel talen? Ze bieden allemaal hun eigen &amp;#x2018;werkelijkheid&amp;#x2019; (volgende slide)
  30. Interessante ontwikkeling is dat Sun dit steunt (JavaFX, maar ook JRuby/Jython) Waarom zoveel talen? Ze bieden allemaal hun eigen &amp;#x2018;werkelijkheid&amp;#x2019; (volgende slide)
  31. Interessante ontwikkeling is dat Sun dit steunt (JavaFX, maar ook JRuby/Jython) Waarom zoveel talen? Ze bieden allemaal hun eigen &amp;#x2018;werkelijkheid&amp;#x2019; (volgende slide)
  32. Interessante ontwikkeling is dat Sun dit steunt (JavaFX, maar ook JRuby/Jython) Waarom zoveel talen? Ze bieden allemaal hun eigen &amp;#x2018;werkelijkheid&amp;#x2019; (volgende slide)
  33. Interessante ontwikkeling is dat Sun dit steunt (JavaFX, maar ook JRuby/Jython) Waarom zoveel talen? Ze bieden allemaal hun eigen &amp;#x2018;werkelijkheid&amp;#x2019; (volgende slide)
  34. Interessante ontwikkeling is dat Sun dit steunt (JavaFX, maar ook JRuby/Jython) Waarom zoveel talen? Ze bieden allemaal hun eigen &amp;#x2018;werkelijkheid&amp;#x2019; (volgende slide)
  35. Interessante ontwikkeling is dat Sun dit steunt (JavaFX, maar ook JRuby/Jython) Waarom zoveel talen? Ze bieden allemaal hun eigen &amp;#x2018;werkelijkheid&amp;#x2019; (volgende slide)
  36. Interessante ontwikkeling is dat Sun dit steunt (JavaFX, maar ook JRuby/Jython) Waarom zoveel talen? Ze bieden allemaal hun eigen &amp;#x2018;werkelijkheid&amp;#x2019; (volgende slide)
  37. Interessante ontwikkeling is dat Sun dit steunt (JavaFX, maar ook JRuby/Jython) Waarom zoveel talen? Ze bieden allemaal hun eigen &amp;#x2018;werkelijkheid&amp;#x2019; (volgende slide)
  38. Interessante ontwikkeling is dat Sun dit steunt (JavaFX, maar ook JRuby/Jython) Waarom zoveel talen? Ze bieden allemaal hun eigen &amp;#x2018;werkelijkheid&amp;#x2019; (volgende slide)
  39. Interessante ontwikkeling is dat Sun dit steunt (JavaFX, maar ook JRuby/Jython) Waarom zoveel talen? Ze bieden allemaal hun eigen &amp;#x2018;werkelijkheid&amp;#x2019; (volgende slide)
  40. Interessante ontwikkeling is dat Sun dit steunt (JavaFX, maar ook JRuby/Jython) Waarom zoveel talen? Ze bieden allemaal hun eigen &amp;#x2018;werkelijkheid&amp;#x2019; (volgende slide)
  41. Interessante ontwikkeling is dat Sun dit steunt (JavaFX, maar ook JRuby/Jython) Waarom zoveel talen? Ze bieden allemaal hun eigen &amp;#x2018;werkelijkheid&amp;#x2019; (volgende slide)
  42. Interessante ontwikkeling is dat Sun dit steunt (JavaFX, maar ook JRuby/Jython) Waarom zoveel talen? Ze bieden allemaal hun eigen &amp;#x2018;werkelijkheid&amp;#x2019; (volgende slide)
  43. Interessante ontwikkeling is dat Sun dit steunt (JavaFX, maar ook JRuby/Jython) Waarom zoveel talen? Ze bieden allemaal hun eigen &amp;#x2018;werkelijkheid&amp;#x2019; (volgende slide)
  44. Interessante ontwikkeling is dat Sun dit steunt (JavaFX, maar ook JRuby/Jython) Waarom zoveel talen? Ze bieden allemaal hun eigen &amp;#x2018;werkelijkheid&amp;#x2019; (volgende slide)
  45. Interessante ontwikkeling is dat Sun dit steunt (JavaFX, maar ook JRuby/Jython) Waarom zoveel talen? Ze bieden allemaal hun eigen &amp;#x2018;werkelijkheid&amp;#x2019; (volgende slide)
  46. Interessante ontwikkeling is dat Sun dit steunt (JavaFX, maar ook JRuby/Jython) Waarom zoveel talen? Ze bieden allemaal hun eigen &amp;#x2018;werkelijkheid&amp;#x2019; (volgende slide)
  47. * Java (taal) bevat ook ficties! * Schoen gaat wringen wanneer language fictions realiteit van JVM moeten gaan verbergen/opleuken * Zelfs in Java (Generics) is dat merkbaar... dat is waar tradeoffs (snelheid/bruikaarheid/correctheid) ontstaan Focus on JRuby in this pres. since very active in JSR-292
  48. * Java (taal) bevat ook ficties! * Schoen gaat wringen wanneer language fictions realiteit van JVM moeten gaan verbergen/opleuken * Zelfs in Java (Generics) is dat merkbaar... dat is waar tradeoffs (snelheid/bruikaarheid/correctheid) ontstaan Focus on JRuby in this pres. since very active in JSR-292
  49. * Java (taal) bevat ook ficties! * Schoen gaat wringen wanneer language fictions realiteit van JVM moeten gaan verbergen/opleuken * Zelfs in Java (Generics) is dat merkbaar... dat is waar tradeoffs (snelheid/bruikaarheid/correctheid) ontstaan Focus on JRuby in this pres. since very active in JSR-292
  50. The language benchmark game (combinatie benchmarks, zeer veel talen te vergelijken)
  51. The language benchmark game (combinatie benchmarks, zeer veel talen te vergelijken)
  52. The language benchmark game (combinatie benchmarks, zeer veel talen te vergelijken)
  53. * Primitives have typed operations, locals are untyped, stack * Method call bytecodes very close to Java Language, only overloading and generics are solved in javac * Linking and method selection very rigid: exact matching, no adaptation
  54. * locals can by untyped, stack manipulation largely untyped, treating everything as object goes a long way * except for method calls! * JVM bytecode verifier locks everything down as well
  55. Also, not even an enclosing type (class), just a script
  56. *&amp;#x2018;Java&amp;#x2019; objects must be converted to IRubyObject * Java objects on Heap for JRuby programs are &amp;#x2018;bags of methods&amp;#x2019;
  57. * for core types specialized invokers may be packaged with ruby (but: wasteful, 100s of small classes)
  58. * Started 2007/2008 * Open-ended experiment from Sun. Wild ideas considered, but must prove useful to reach Java SE 7 We are extending the JVM with first-class&amp;#xA0;architectural support for languages other than Java, especially dynamic languages.
  59. Again, we focus on improving call speed. There are many other wishes (some may even be granted), but this one is really important for performance
  60. * Signature polymorphism (there is no actual invoke method conforming to the MethodType) * results in invokevirtual call on MethodHandle class, which then dispatches to the correct code (if type sig matches!) * pass target object as first param when virtual method is concerned
  61. * Signature polymorphism (there is no actual invoke method conforming to the MethodType) * results in invokevirtual call on MethodHandle class, which then dispatches to the correct code (if type sig matches!) * pass target object as first param when virtual method is concerned
  62. * Signature polymorphism (there is no actual invoke method conforming to the MethodType) * results in invokevirtual call on MethodHandle class, which then dispatches to the correct code (if type sig matches!) * pass target object as first param when virtual method is concerned
  63. PermGen space is safe again! proof-of-concept van JDK ontwikkelaar. Bytecode generatie moet een laatste redmiddel blijven! voorbeeld: &amp;#x2018;lambda&amp;#x2019;s bouwen met builder pattern&amp;#x2019; en direct invoken (soort DLR expression tree!) example uses ASM bytecode AST builder
  64. PermGen space is safe again! proof-of-concept van JDK ontwikkelaar. Bytecode generatie moet een laatste redmiddel blijven! voorbeeld: &amp;#x2018;lambda&amp;#x2019;s bouwen met builder pattern&amp;#x2019; en direct invoken (soort DLR expression tree!) example uses ASM bytecode AST builder
  65. PermGen space is safe again! proof-of-concept van JDK ontwikkelaar. Bytecode generatie moet een laatste redmiddel blijven! voorbeeld: &amp;#x2018;lambda&amp;#x2019;s bouwen met builder pattern&amp;#x2019; en direct invoken (soort DLR expression tree!) example uses ASM bytecode AST builder
  66. PermGen space is safe again! proof-of-concept van JDK ontwikkelaar. Bytecode generatie moet een laatste redmiddel blijven! voorbeeld: &amp;#x2018;lambda&amp;#x2019;s bouwen met builder pattern&amp;#x2019; en direct invoken (soort DLR expression tree!) example uses ASM bytecode AST builder
  67. Static typing, static call sites vs Dynamic typing, very late binding (typechecks at runtime), eval&amp;#x2019;ing code (only possible by reflection, or interpretation).
  68. Static typing, static call sites vs Dynamic typing, very late binding (typechecks at runtime), eval&amp;#x2019;ing code (only possible by reflection, or interpretation).
  69. Static typing, static call sites vs Dynamic typing, very late binding (typechecks at runtime), eval&amp;#x2019;ing code (only possible by reflection, or interpretation).
  70. This was already possible (hence the existing JVM languages), but is now architecturally supported. Therefore: easier to implement, more speed through optimizations etc.