jextract fails to compile generated source

Remi Forax forax at univ-mlv.fr
Sun Jun 28 20:34:20 UTC 2020


----- Mail original -----
> De: "Ty Young" <youngty1997 at gmail.com>
> À: "panama-dev at openjdk.java.net'" <panama-dev at openjdk.java.net>
> Envoyé: Dimanche 28 Juin 2020 22:11:16
> Objet: jextract fails to compile generated source

> Hi,
> 

Hi !,

[...]

> 
> A question though: is there any advantages to using MethodHandle's
> invokeExact vs. invoke? I randomly came across a StackOverflow(IIRC)
> post awhile ago where supposedly invokeExact is marginally faster but
> I'm not sure how true that is. I don't do benchmarking but if it's a
> noticeable speedup I'll change my code to use it.

invokeExact() is not faster than invoke(), they work differently,
if the method handle type if different from the method type inferred by the compiler from the invokeExact call site, invokeExact() throw a WrongMethodTypeException while invoke() try to use to widening, boxing (and may be varargs) conversions.

So if the method types are the same (for both Hotspot and J9, it's just a pointer check), there is no perf difference, if the method types are different, it depends if you want to pay the price of doing the boxing or if you prefer to prepare the method handle in advance so it should never fail.

regards,
Rémi


More information about the panama-dev mailing list