Nice, it works well on some my small test suites (MethodHandle and indy).

About perf, dynamic calls are a little less efficient than their static couterparts, it seems that neither c1 nor c2 inline a method handle call or an invokedynamic.
Should I have set these inline flags that are now in product VM ?

BTW, in case of an indy call because the only way to change it is to call
CallSite.setTarget() (after bootstraping),
I think it's better to don't test the target method handle at call site
but instead to deopt if the target change.
That what the backport does, and that why, I think, it still wins some of my benchs :)
Perhaps this optimisation can only be done after implementing invalidation.

Rémi


Le 27/01/2010 15:54, Charles Oliver Nutter a écrit :
On Wed, Jan 27, 2010 at 11:22 AM, Christian Thalinger
<christian.thalin...@sun.com>  wrote:
Hi!

Yesterday I committed the first draft of the x86 C1 implementation for
JSR 292.

I did some testing on Linux and Solaris with the JRuby tests and
benchmarks.  The current implementation can run all but one benchmarks
(bench/bench_fib_stack_depth.rb, I still have to look into it)
successfully and finishes all 214 tests (test/test*.rb).  The latter
means that all tests run to its end and do not crash or assert, I have
no comparison yet if they finish successfully.
Very nice! The fib stack bench basically ends up generating a stack
error, so that's probably the place to start looking. It is intended
to blow up but show roughly how deep it got before the stack error.

Great to hear that the other tests are all working. I'll have to get
back into indy mode and get a recent build made that I can play with!

It would be very helpful if people out there would test their indy'fied
language implementation or just simple MH or invokedynamic testcases
with the client compiler.  It would also be very helpful to get pointers
to other testsuites than JRuby.  The more tests, the better.

The easiest way to give it a try is to only build HotSpot and copy the
libjvm into a JDK 7 b80 download (given you are on Windows, Linux or
Solaris).

Thanks for you help!

-- Christian

_______________________________________________
mlvm-dev mailing list
mlvm-dev@openjdk.java.net
http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev

_______________________________________________
mlvm-dev mailing list
mlvm-dev@openjdk.java.net
http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev

import java.dyn.MethodHandle;
import java.dyn.MethodHandles;
import java.dyn.MethodType;

public class Test2 {

    private static int N = 100000;

    public static void runDirect() {
        long begin = System.nanoTime();
        int value = 0;
        for (int i = 0; i < N; i++) {
            value = increment(value);
        }
        long end = System.nanoTime();
        System.out.println("Direct (" + value + "): " + (end - begin) / N);
    }

    public static int increment(int value) {
        return value + 1;
    }

    public static void runHandle() {
        long begin = System.nanoTime();
        final MethodType type = MethodType.methodType(int.class, int.class);
        MethodHandle increment = 
MethodHandles.publicLookup().findStatic(Test2.class, "increment", type);
        int value = 0;
        for (int i = 0; i < N; i++) {
            value = increment.<int>invoke(value);
        }
        long end = System.nanoTime();
        System.out.println("Handle (" + value + "): " + (end - begin) / N);
    }

    public static void main(String[] args) {
        for(int i=0; i<100; i++) {
          runDirect();
          runHandle();
        }
    }
}

_______________________________________________
mlvm-dev mailing list
mlvm-dev@openjdk.java.net
http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev

Reply via email to