RFR (S) 8150180: String.value contents should be trusted
Aleksey Shipilev
aleksey.shipilev at oracle.com
Fri Feb 19 11:55:34 UTC 2016
Hi,
Please review a simple performance improvement in Strings:
https://bugs.openjdk.java.net/browse/JDK-8150180
In short, we want VM to trust constant String contents, so that
"Foo".charAt(0) is folded. As far as current Hotspot goes, this is only
achievable with @Stable -- we need to trust the array contents:
http://cr.openjdk.java.net/~shade/8150180/webrev.jdk.01/
This, however, steps into the compiler bug caused by StringUTF16.getChar
intrinsic producing a mismatched load, that is then folded incorrectly.
So we instead rely on Java level folding in cases like these:
http://cr.openjdk.java.net/~shade/8150180/webrev.hs.01/
...and it works:
http://cr.openjdk.java.net/~shade/8150180/notes.txt
While VM change looks like a workaround, Vladimir I. and me concluded
that @Stable folding code should just reject folding mismatched loads to
begin with. So, getChar intrinsic change is the actual fix. Vladimir I.
ought to add more assertions in @Stable folding code separately:
https://bugs.openjdk.java.net/browse/JDK-8150186
Since this issue might trigger compiler bugs, I would like to push
through hs-comp to pass compiler nightlies.
Cheers,
-Aleksey
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/attachments/20160219/5d13b243/signature.asc>
More information about the hotspot-compiler-dev
mailing list