RFR(xs): 8233019: java.lang.Class.isPrimitive() (C1) returns wrong result if Klass* is aligned to 32bit
Thomas Stüfe
thomas.stuefe at gmail.com
Wed Oct 30 10:47:30 UTC 2019
Hi all,
second attempt at a fix (please find first review thread here:
https://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/2019-October/035608.html
)
Issue: https://bugs.openjdk.java.net/browse/JDK-8233019
webrev:
http://cr.openjdk.java.net/~stuefe/webrevs/8233019--c1-intrinsic-for-java.lang.class.isprimitive()-does-32bit-compare/webrev.00/webrev/
In short, C1 intrinsic for jlC::isPrimitive does a compare with the Klass*
pointer for the class to find out if its NULL and hence a primitive type.
That compare is done using 32bit cmp and so it gives wrong results when the
Klass* pointer is aligned to 32bit.
In the generator I changed the comparison constant type from intConst(0) to
metadataConst(0) and implemented the missing code paths for all CPUs. Since
on most architectures we do not seem to have a comparison with a 64bit
immediate (at least I could not find one) I kept the change simple and only
implemented comparison with NULL for now.
I tested the fix in our nightlies (jtreg tier1, jck and others) as well as
manually testing it.
I did not test on aarch64 and arm though and would be thankful if someone
knowledgeable to these platforms could take a look.
Thanks to Martin and Lutz for eyeballing the ppc and s390 parts.
Thanks, Thomas
More information about the hotspot-compiler-dev
mailing list