Wooooosh

Attila Szegedi szegedia at gmail.com
Thu Jun 18 08:08:22 PDT 2009


Rémi, you rock.

Attila.

On 2009.06.18., at 15:37, Rémi Forax wrote:

> Christian has sent his first patch to enable compiler support of
> invokedynamic today,
> I've worked late last night to do the same for the backport.
>
> I am please to announce that the jsr292 backport now comes with a  
> JIT (a
> kind of) that
> recompiles at runtime a tree of method handle adapters to a single  
> blob
> of byte code.
>
> Just a small test: with jdk7
> [forax at localhost sandbox]$ /usr/jdk/jdk1.7.0/bin/java
> -XX:+EnableInvokeDynamic JITTest
> value 100000
> elapsed 30250982 ns
>
> with jdk5 + backport without JIT:
> [forax at localhost sandbox]$ java -javaagent:../lib/jsr292-backport.jar
> -Dallow.JIT=false JITTest
> value 100000
> elapsed 30997166 ns
>
> with jdk5 + backport JIT enable
> [forax at localhost sandbox]$ java -javaagent:../lib/jsr292-backport.jar
> JITTest
> value 100000
> elapsed 14863411 ns
>
> Wooosh, it's faster :)
>
> I hope to come with the complete support of invokedynamic is the next
> milestone.
>
> Enjoy,
> Rémi
>
> ----------------------------------------------------------------------------------------------------------
> JITTest.java:
> import java.dyn.MethodHandle;
> import java.dyn.MethodHandles;
> import java.dyn.MethodType;
>
> public class JITTest {
>    public static class Test {
>        public static int inc(int value) {
>        return value + 1;
>        }
>    }
>
>    public static void main(String[] args) {
>    MethodHandle mh=MethodHandles.lookup().findStatic(Test.class,  
> "inc",
>        MethodType.make(int.class, int.class));
>
>    long start = System.nanoTime();
>
>    int value = 0;
>    for(int i=0;i<100000;i++) {
>      value = mh.<int>invoke(value);
>    }
>
>    long end = System.nanoTime();
>
>    //jsr292.weaver.jit.JIT.debugCounter(Test.class);
>
>    System.out.println("value " + value);
>    System.out.println("elapsed " + (end - start) + " ns");
>    }
> }



More information about the mlvm-dev mailing list