Looks good to me.

Thanks,
Vladimir K

On 2/15/16 11:01 AM, Vladimir Ivanov wrote:
http://cr.openjdk.java.net/~vlivanov/8148518/webrev.00/
https://bugs.openjdk.java.net/browse/JDK-8148518

Current Unsafe::getCharUnaligned Java implementation isn't fully optimized by 
C2: it never constant folds such loads
from char fields.

C2 matches the types of a load and a location and does constant folding only if 
they match. For getCharUnaligned it sees
a load of a short value, but the field is of type char.

The fix is to call Unsafe::getChar when offset is aligned. It doesn't matter 
what is used for unaligned case, so I
decided to keep makeShort().

Testing: failing test, JPRT.

Best regards,
Vladimir Ivanov

PS: I don't update the test because it was refactored in Jigsaw [1]. To avoid 
unnecessary conflicts during merges, I
filed an RFE [2] to adjust the test once the fix and Jake are integrated.

[1] 
http://hg.openjdk.java.net/jigsaw/jake/hotspot/file/f6daf3633512/test/compiler/unsafe/UnsafeGetConstantField.java

[2] https://bugs.openjdk.java.net/browse/JDK-8149844

Reply via email to