Thursday Feb 25, 2010

First invokedynamic call on SPARC

Today I successfully executed an invokedynamic call on SPARC for the first time.  Excellent!

$ bin/jruby.gamma -J-XX:+UseSerialGC -J-Djruby.compile.invokedynamic=true -J-Xint -J-XX:+UnlockExperimentalVMOptions -J-XX:+EnableMethodHandles -J-XX:+EnableInvokeDynamic bench/bench_fib_recursive.rb 
OpenJDK Server VM (17.0-b08-internal-jvmg) for solaris-sparc JRE (1.7.0), built on Feb 25 2010 04:35:47 by "ct232829" with Workshop 5.9
VM option '+UseSerialGC'
VM option '+UnlockExperimentalVMOptions'
VM option '+EnableMethodHandles'
VM option '+EnableInvokeDynamic'
 52.813000   0.000000  52.813000 ( 52.296000)
 52.824000   0.000000  52.824000 ( 52.823000)
 51.808000   0.000000  51.808000 ( 51.808000)
 49.740000   0.000000  49.740000 ( 49.740000)
 49.450000   0.000000  49.450000 ( 49.450000)

MethodHandle calls already work since a couple of days and I can run the JDK MethodHandlesTest without any errors:

$ gamma -Xinternalversion
OpenJDK Server VM (17.0-b08-internal-jvmg) for solaris-sparc JRE (1.7.0), built on Feb 25 2010 04:35:47 by "ct232829" with Workshop 5.9
$ gamma -Xint -XX:+UnlockExperimentalVMOptions -XX:+EnableMethodHandles -classpath /java/devtools/share/junit/latest/junit.jar:. org.junit.runner.JUnitCore MethodHandlesTestVM option '+UnlockExperimentalVMOptions'
VM option '+EnableMethodHandles'
JUnit version 4.4
OpenJDK Server VM warning: JSR 292 invokedynamic is disabled in this JVM.  Use -XX:+UnlockExperimentalVMOptions -XX:+EnableInvokeDynamic to enable.
.exactInvoker, genericInvoker, varargsInvoker, dynamicInvoker

Time: 7.984

OK (23 tests)

JSR 292 SPARC support is on its way...

Friday Jan 22, 2010

JSR 292 server compiler support in JDK 7 b80

About two weeks ago I pushed the remaining changes (6894206, 6893081, 6829187, 6893268) for C2 invokedynamic support on x86 which were integrated into HotSpot 17 b07.  Meanwhile HS17b07 has been integrated into JDK 7 b80 and the latter has been released.

With two changesets John Rose pushed lately (6891770, 6914665), which have been integrated into JDK 7 b79, you can run now invokedynamic enabled programs with decent performance.  Additionally we tuned inlining heuristics a little (6912063) to be able to use inline-related switches in a product VM and to not count generated MethodHandle adapters.

And here is how it works (gwt is a simple testcase for guardWithTest):

$ java -server -XX:+UnlockExperimentalVMOptions -XX:+EnableMethodHandles -XX:+EnableInvokeDynamic gwt

You can also run JRuby benchmarks, like bench_fractal.rb which prints a nice fractal (we need to tune inlining heuristics a little to get good performance):

$ bin/jruby --server -J-Djruby.compile.invokedynamic=true -J-XX:+UnlockExperimentalVMOptions -J-XX:+EnableMethodHandles -J-XX:+EnableInvokeDynamic -J-XX:InlineSmallCode=2500 -J-XX:MaxInlineSize=50 bench/bench_fractal.rb

(To see the fractal you have to try it yourself :-)

The next thing will be C1 support.  I'm currently working on it and it's almost finished.

Tuesday Jan 12, 2010


It's exactly one year ago that I started to work for Sun.  Nice!  I wasn't sure that I will make the anniversary facing the merger with Oracle.  Anyway, I learned a lot in this first year and I'm really looking forward to the next years at Sun (or whatever the company will be called then).

Wednesday Sep 09, 2009

JSR 292 work update

I'm still working on HotSpot compiler support for JSR 292.  The progress is actually very good and inlining is already working in C2.  Although there are still some problems with scavenging oops in nmethods and you have to stick to UseSerialGC if you want to give it a try.  But John Rose is working on a fix for that.

While not working on inlining I started porting JSR 292 support to x86_64.  I've already commited the interpreter support and compiler support is in the works and almost finished.

In the meantime Charles Nutter introduced another dynamic language, called Surinx, which uses invokedynamic and "the solid performance of Surinx bodes very well for JRuby's future."  That sounds good.

Thursday May 07, 2009

More bit-twiddling intrinsics

Today I pushed the changes for 6823354 which adds intrinsics for {Integer,Long}.{numberOfLeadingZeros,numberOfTrailingZeros}() methods.  The speedups are quite good:

Integer Long
numberOfLeadingZeros numberOfTrailingZeros numberOfLeadingZeros numberOfTrailingZeros
Intel Nehalem 32-bit 3.18 3.96 1.36 1.90
64-bit 3.83 3.74 2.02 2.17
AMD Shanghai 32-bit 1.94 3.55 0.98 2.44
32-bit w/ lzcnt 4.90 - 1.46 -
64-bit 2.52 3.09 1.86 3.26
64-bit w/ lzcnt 6.77 - 3.71 -
UltraSparc T2 32/64-bit 2.01 2.22 1.55 1.91

"w/ lzcnt" in the table means the numbers are using AMD's LZCNT (count leading zeros) instruction which is part of SSE4a.

The SPARC intrinsics need a hardware implementation of the POPC instruction.

Yet I haven't found a real-world application that uses these methods extensively (including bitCount), but if anyone knows one, please let me know.

Tuesday Feb 03, 2009

My first bugfix

Today I pushed my first bugfix.  To be honest, I had a little help from Tom Rodriguez who pointed me to the right function.  I hope someday the time will come when I can help you, Tom :-)

Wednesday Jan 28, 2009

My first commit

Yesterday I was able, after some trouble with Mercurial queues, to push my first commit to the HotSpot repository.  The changeset is actually uninspiring but hey, it's my first one!

Wednesday Jan 14, 2009

Into the Sun

Those of you who have wondered what I will do in the future: I'm now part of the HotSpot team at Sun Microsystems and I will work on the C2 (server) compiler.

Actually today is my third day but only now my account is working.  I'm really looking forward to tackle the challenges that will come up.

And as I always said, I will not leave the Free Java Community...


Random posts from a HotSpot engineer.


« July 2016