United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6887186 G1: Incorrect code generated for G1 pre-barrier by C1 on SPARC
JDK-6887186 : G1: Incorrect code generated for G1 pre-barrier by C1 on SPARC

Details
Type:
Bug
Submit Date:
2009-10-01
Status:
Resolved
Updated Date:
2010-04-06
Project Name:
JDK
Resolved Date:
2009-10-13
Component:
hotspot
OS:
solaris_10
Sub-Component:
gc
CPU:
sparc
Priority:
P3
Resolution:
Fixed
Affected Versions:
6u19
Fixed Versions:
hs17 (b03)

Related Reports
Backport:
Backport:
Backport:
Backport:
Relates:

Sub Tasks

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

Problem is in G1 pre-barrier code generated by C1 for the Unsafe.CompareAndSwap intrinsic on Sparc.
                                     
2009-10-01
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.
                                     
2009-10-01
EVALUATION

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



Hardware and Software, Engineered to Work Together