JDK-6887186 : G1: Incorrect code generated for G1 pre-barrier by C1 on SPARC
  • Type: Bug
  • Component: hotspot
  • Sub-Component: gc
  • Affected Version: 6u19
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: solaris_10
  • CPU: sparc
  • Submitted: 2009-10-01
  • Updated: 2013-09-18
  • Resolved: 2009-10-13
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 6 JDK 7 Other
6u18Fixed 7Fixed hs16Fixed
Related Reports
Relates :  
Description
While investigating a G1 issue with a customer supplied test case I tried running the test case with a 32 bit client JVM on our batoka machine. The original issue is a possible race with concurrent marking so I ran the test case with ParallelMarkingThreads=1.

After around 4 hours the test case failed with an assert that the contents of an SATB buffer was not an oop.

Examining the resulting core file the value that was being triggering the assert was 0xd which may possibly be a mark word of an oop.

Comments
EVALUATION http://hg.openjdk.java.net/jdk7/hotspot-gc/hotspot/rev/a0107ba3bc53
02-10-2009

SUGGESTED FIX Potential fix: cairnapple{jc234399}:263> hg diff src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp diff -r eb058abd0562 src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp --- a/src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp Tue Sep 15 16:50:50 2009 -0700 +++ b/src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp Wed Sep 30 17:56:54 2009 -0700 @@ -668,7 +668,7 @@ void LIRGenerator::do_CompareAndSwap(Int __ add(obj.result(), offset.result(), addr); if (type == objectType) { // Write-barrier needed for Object fields. - pre_barrier(obj.result(), false, NULL); + pre_barrier(addr, false, NULL); } if (type == objectType) cairnapple{jc234399}:264> The current code generates a load from the base object to fetch the previous value (even through we are storing into obj.field) which then gets enqueued in the SATB buffer. We should be generating a load from &obj+offset(field) which is "addr" in the above code. I have made the changes and the test case ran for several days until it was killed.
01-10-2009

EVALUATION Problem is in G1 pre-barrier code generated by C1 for the Unsafe.CompareAndSwap intrinsic on Sparc.
01-10-2009