[foreign] Poor performance?

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Mon May 20 08:34:06 UTC 2019


On 20/05/2019 09:30, Jorn Vernee wrote:
> FWIW, I did find that setAccessible(true) + unreflectConstructor works 
> as well, and has the same perf.
>
> Updated: 
> http://cr.openjdk.java.net/~jvernee/panama/webrevs/getstruct/webrev.03/
>
>> In alternative
>> we could always go back to a normal Unsafe.defineClass - and then
>> replace constant pool patching with condy, which is gonna help anyway
>> if we're going at some point to start generating bindings statically.
>
> Actually, this is my first time hearing about this. Is there a plan to 
> generate bindings statically? (I guess it would save time on spinning?).

Generating binding statically is a low hanging fruit, in a way. Most of 
the code that is spinned at runtime by the binder could be spun 
statically using a right combo of indy/condy. This could be useful in 
contexts where performances are dominated by those of the binder  - or 
in cases where it's more handy to do things statically (some earlier 
experiments with Panama in the JDK seems to suggest this could be a good 
direction to explore).

Maurizio

>
> Jorn
>
> Maurizio Cimadamore schreef op 2019-05-20 10:14:
>> On 19/05/2019 16:05, Jorn Vernee wrote:
>>> The bad news... since we (apparently) can't get a MethodHandle to 
>>> the constructor of our Struct impl class without triggering an 
>>> access violation (seemingly because it's a VMAC?), I had to disable 
>>> the access checking to get these numbers.
>>
>> Thanks for the tests Jorn - and yes, this is the reason why Struct
>> handles have not been specialized. As Brian says, there is going to be
>> a more reliable way to define anonymous classes soon. In alternative
>> we could always go back to a normal Unsafe.defineClass - and then
>> replace constant pool patching with condy, which is gonna help anyway
>> if we're going at some point to start generating bindings statically.
>>
>> Maurizio


More information about the panama-dev mailing list