[aarch64-port-dev ] Fwd: 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
Mon Nov 4 15:21:32 UTC 2019


Hi,

could some aarch64 people please take a quick look at this small patch?

The aarch64 part is really tiny, but I have no possibility to test this.

Last webrev:
http://cr.openjdk.java.net/~stuefe/webrevs/8233019--c1-intrinsic-for-java.lang.class.isprimitive()-does-32bit-compare/webrev.01/webrev/
Issue: https://bugs.openjdk.java.net/browse/JDK-8233019

Thank you,

Thomas

---------- Forwarded message ---------
From: Thomas Stüfe <thomas.stuefe at gmail.com>
Date: Wed, Oct 30, 2019 at 11:47 AM
Subject: RFR(xs): 8233019: java.lang.Class.isPrimitive() (C1) returns wrong
result if Klass* is aligned to 32bit
To: hotspot compiler <hotspot-compiler-dev at openjdk.java.net>
Cc: Doerr, Martin <martin.doerr at sap.com>, Schmidt, Lutz <
lutz.schmidt at sap.com>


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 aarch64-port-dev mailing list