[9] RFR (XS): 8131675: EA fails with assert(false) failed: not unsafe or G1 barrier raw StoreP

Vladimir Ivanov vladimir.x.ivanov at oracle.com
Tue Jul 21 18:20:10 UTC 2015


Newly introduced UnsafeGetConstantField test revealed an uncovered case 
in EA for unsafe accesses.

The following code:

   U.putAddress(nativeAddr, 0x12345678L);

   static final long nativeAddr = U.allocateMemory(16);
   static final Unsafe U = Unsafe.getUnsafe();

is parsed into the following IR:

   StoreP (ctrl) (mem) ConP ConP

But EA doesn't expect to see a constant address and falls through the 
unsafe access detection logic hitting the assert right away.

The fix is to treat all stores to raw pointers (except G1 barriers) as 
unsafe accesses and mark stored values as escaped.

Testing: failed test, jprt

Best regards,
Vladimir Ivanov

[1] test/compiler/unsafe/UnsafeGetConstantField.java

More information about the hotspot-compiler-dev mailing list