RFR(L): 8185265 [MVT] improve performance of return of value types with new calling convention

Tobias Hartmann tobias.hartmann at oracle.com
Mon Aug 21 10:48:21 UTC 2017

Hi Roland,

I was finally able to solve this. Some JCK tests failed because we were treating a klass with JVM_ACC_NATIVE (0x100) as 
value klass (since JVM_ACC_VALUE == JVM_ACC_NATIVE). The problem then is that these classes have a vtable which 
overwrites the pack and unpack handler addresses. I filed 8186439 [1] to fix this by ignoring the access flag for older 
class file versions.

For the record: In addition to Roland's changes, I will push this cleanup that moves the initialization code to the 
valueKlass constructor and converts the vtable assert to a guarantee (the JCK tests were only executed with product builds):

All tests pass.

I'm just a bit concerned about MacroAssembler::lookup_interface_method() which computes the start of the itable 
according to the size of the vtable. With value types, the vtable size is 0 although two slots are occupied by the 
handler addresses. We need to fix this if we are ever going to support invokeinterface on value types.


[1] https://bugs.openjdk.java.net/browse/JDK-8186439

On 11.08.2017 09:01, Roland Westrelin wrote:
> Thanks for investigating the failure.
>> I added some debug print statements and the klass we are deallocating is
>> javasoft/sqe/tests/vm/classfmt/clf/clfacc006/clfacc00602m1/clfacc00602m10p which is obviously not a value klass.
>> I guess the problem then is that pack_handler() is != NULL because it was never initialized to NULL and we try to free a
>> non-existing buffer blob.
>  From the stack trace you sent before we get there from:
> void ClassLoaderData::value_classes_do(void f(ValueKlass*)) {
>    // Lock-free access requires load_ptr_acquire
>    for (Klass* k = load_ptr_acquire(&_klasses); k != NULL; k = k->next_link()) {
>      if (k->is_value()) {
>        f(ValueKlass::cast(k));
>      }
>      assert(k != k->next_link(), "no loops!");
>    }
> }
> Why does is_value() returns true for this klass?
> Roland.

More information about the valhalla-dev mailing list