JDK-8038440 : backport few C2 fixes
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 6-rev-pool,7-rev-pool
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2014-03-27
  • Updated: 2014-12-23
  • Resolved: 2014-04-09
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 7
7u76Fixed
Description
During working on 8031320 I found few C2 problems and fixed them as part of 8031320.
Dan suggested to backport them in previous releases.
8031320 was backported into 8u20. We  need to backport these fixes into 7u and 6u.

1. Move disabling UseOptoBiasInlining after the last change to UseBiasedLocking:

src/share/vm/runtime/arguments.cpp
@@ -3748,9 +3748,6 @@
 #endif // CC_INTERP
 
 #ifdef COMPILER2
-  if (!UseBiasedLocking || EmitSync != 0) {
-    UseOptoBiasInlining = false;
-  }
   if (!EliminateLocks) {
     EliminateNestedLocks = false;
   }
@@ -3811,6 +3808,11 @@
       UseBiasedLocking = false;
     }
   }
+#ifdef COMPILER2
+  if (!UseBiasedLocking || EmitSync != 0) {
+    UseOptoBiasInlining = false;
+  }
+#endif


2. cmpxchg may fail first time when new named counter is added. It triggers assert in set_next() because _next is set already.
   Fix it by resetting _next for each attempt:

src/share/vm/opto/runtime.cpp
@@ -1346,6 +1356,7 @@
   // add counters so this is safe.
   NamedCounter* head;
   do {
+    c->set_next(NULL);
     head = _named_counters;
     c->set_next(head);
   } while (Atomic::cmpxchg_ptr(c, &_named_counters, head) != head);

src/share/vm/opto/runtime.hpp
@@ -85,7 +87,7 @@
 
   NamedCounter* next() const    { return _next; }
   void set_next(NamedCounter* next) {
-    assert(_next == NULL, "already set");
+    assert(_next == NULL || next == NULL, "already set");
     _next = next;
   }


Comments
These changes were pushed into 8u20 as part of 8031320 fix: http://hg.openjdk.java.net/jdk8u/jdk8u/hotspot/rev/606acabe7b5c
09-04-2014

Poonam, please reassign it to right person. Thanks.
27-03-2014