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