JDK-8148518 : Unsafe.getCharUnaligned() loads aren't folded in case of -XX:-UseUnalignedAccesses
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 9
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2016-01-29
  • Updated: 2016-05-05
  • Resolved: 2016-02-17
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9
9 b108Fixed
Related Reports
Blocks :  
Relates :  
Relates :  
Description
working on JDK-8134102 I've slightly improved hotspot/test/compiler/unsafe/UnsafeGetConstantField.java test: now it also checks that even if field's value is changed, testDirect and testUnsafe return the previous value.
those changes revealed that Unsafe.getCharUnaligned() loads for @Stable and final fields aren't folded in case JVM is started w/ -XX:-UseUnalignedAccesses
Comments
attached is the changed test.
29-01-2016

type=Char flags=0 stable=true default=false post=Unaligned dumping test class to /private/tmp/run/JTwork/scratch/./TestCharUnaligned__f=0__s=true__d=false.class java.lang.RuntimeException: (assert failed: \uffff == \u0000) -- type=Char flags=8 stable=true default=false post=Unaligned dumping test class to /private/tmp/run/JTwork/scratch/./TestCharUnaligned__f=8__s=true__d=false.class java.lang.RuntimeException: (assert failed: \uffff == \u0000) -- type=Char flags=16 stable=false default=false post=Unaligned dumping test class to /private/tmp/run/JTwork/scratch/./TestCharUnaligned__f=16__s=false__d=false.class java.lang.RuntimeException: (assert failed: \uffff == \u0000) -- type=Char flags=16 stable=true default=false post=Unaligned dumping test class to /private/tmp/run/JTwork/scratch/./TestCharUnaligned__f=16__s=true__d=false.class java.lang.RuntimeException: (assert failed: \uffff == \u0000) -- type=Char flags=24 stable=false default=false post=Unaligned dumping test class to /private/tmp/run/JTwork/scratch/./TestCharUnaligned__f=24__s=false__d=false.class java.lang.RuntimeException: (assert failed: \uffff == \u0000) -- type=Char flags=24 stable=true default=false post=Unaligned dumping test class to /private/tmp/run/JTwork/scratch/./TestCharUnaligned__f=24__s=true__d=false.class java.lang.RuntimeException: (assert failed: \uffff == \u0000)
29-01-2016