RFR(S): 8183111: [MVT] java.lang.Class::isAssignableFrom() C2 intrinsic does not support value types
Tobias Hartmann
tobias.hartmann at oracle.com
Fri Jul 14 14:41:01 UTC 2017
Hi,
please review the following patch:
https://bugs.openjdk.java.net/browse/JDK-8183111
http://cr.openjdk.java.net/~thartmann/valhalla/vt_prototype/webrev.29/
The problem is that the Class::isAssignableFrom C2 intrinsic returns incorrect results for value type classes. This is because the result type of the LoadKlassNode is set to TypeKlassPtr::OBJECT_OR_NULL which is wrong for value type classes (because they are not a subtype of Object) and results in constant folding of subtype checks at compile time. I fixed this by introducing TypeKlassPtr::BOTTOM which has _klass set to NULL. I had to adjust all code that relies on _klass being initialized.
I wasn't sure about the implementation of meet if one of the KlassPtrs is BOTTOM (see changes in type.cpp) but the current implementation works for all our tests.
I added tests for Class::isAssignableFrom, Class::getSuperclass and Class::cast. I also removed the DisableIntrinsic flags added as workaround by JDK-8181425.
Thanks,
Tobias
More information about the valhalla-dev
mailing list