[foreign] some JMH benchmarks

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Fri Sep 14 18:04:09 UTC 2018

> I'm wondering if the 5 native end points for an arity of 5 are enough. 
> Don't you also need 5 for when the function returns a long and 5 more 
> for when the function returns a double?
This is an example with arity 5 and return void. Don't take this too 
literally :-)

Things will become clearer once you see the webrev, which I'm about to 
> I have a suggestion to bypass having to write out all the permutations 
> though. What if, on the Java side, whenever there is a method that has 
> a shape that can be optimized in this way (which is ABI dependent), 
> spin and load a class which defines a single static native method with 
> the needed signature, and annotate it. Then, in NativeLookup::lookup, 
> detect this annotation, and instead of trying to look up the symbol in 
> a loaded library generate a forwarding stub and link the native method 
> to that instead. Then you can take a MethodHandle to the native method 
> in the anonymous class and use that in the backing implementation.
This is a good suggestion, although for now I'd like to keep things 
simple. In principle I agree, with some spinning (and some VM fixup) we 
could be able to get there. You also need to spin upcalls entry points 
too :-)

> I'm not sure if it's all that easy though, what do you think?
> Jorn

More information about the panama-dev mailing list