8156548: gc/gctests/StringInternSyncWithGC2 fails with Test level exit status: 151
authorkbarrett
Wed, 25 May 2016 13:46:05 -0400
changeset 38704 eb96c446c3a5
parent 38703 d3906fec707e
child 38706 01e5e74d3e4e
8156548: gc/gctests/StringInternSyncWithGC2 fails with Test level exit status: 151 Summary: Avoid repeated verification. Reviewed-by: jmasa, drwhite
hotspot/src/share/vm/gc/cms/concurrentMarkSweepGeneration.cpp
hotspot/src/share/vm/gc/cms/concurrentMarkSweepGeneration.hpp
hotspot/src/share/vm/opto/macroArrayCopy.cpp
hotspot/src/share/vm/prims/jni.cpp
hotspot/src/share/vm/utilities/macros.hpp
--- a/hotspot/src/share/vm/gc/cms/concurrentMarkSweepGeneration.cpp	Tue May 24 12:42:43 2016 -0500
+++ b/hotspot/src/share/vm/gc/cms/concurrentMarkSweepGeneration.cpp	Wed May 25 13:46:05 2016 -0400
@@ -6096,19 +6096,23 @@
           size = CompactibleFreeListSpace::adjustObjectSize(
                    p->oop_iterate_size(_scanningClosure));
         }
-        #ifdef ASSERT
-          size_t direct_size =
-            CompactibleFreeListSpace::adjustObjectSize(p->size());
-          assert(size == direct_size, "Inconsistency in size");
-          assert(size >= 3, "Necessary for Printezis marks to work");
-          if (!_bitMap->isMarked(addr+1)) {
-            _bitMap->verifyNoOneBitsInRange(addr+2, addr+size);
-          } else {
-            _bitMap->verifyNoOneBitsInRange(addr+2, addr+size-1);
-            assert(_bitMap->isMarked(addr+size-1),
-                   "inconsistent Printezis mark");
-          }
-        #endif // ASSERT
+      #ifdef ASSERT
+        size_t direct_size =
+          CompactibleFreeListSpace::adjustObjectSize(p->size());
+        assert(size == direct_size, "Inconsistency in size");
+        assert(size >= 3, "Necessary for Printezis marks to work");
+        HeapWord* start_pbit = addr + 1;
+        HeapWord* end_pbit = addr + size - 1;
+        assert(_bitMap->isMarked(start_pbit) == _bitMap->isMarked(end_pbit),
+               "inconsistent Printezis mark");
+        // Verify inner mark bits (between Printezis bits) are clear,
+        // but don't repeat if there are multiple dirty regions for
+        // the same object, to avoid potential O(N^2) performance.
+        if (addr != _last_scanned_object) {
+          _bitMap->verifyNoOneBitsInRange(start_pbit + 1, end_pbit);
+          _last_scanned_object = addr;
+        }
+      #endif // ASSERT
     } else {
       // An uninitialized object.
       assert(_bitMap->isMarked(addr+1), "missing Printezis mark?");
--- a/hotspot/src/share/vm/gc/cms/concurrentMarkSweepGeneration.hpp	Tue May 24 12:42:43 2016 -0500
+++ b/hotspot/src/share/vm/gc/cms/concurrentMarkSweepGeneration.hpp	Wed May 25 13:46:05 2016 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1501,6 +1501,7 @@
   CMSBitMap*                     _bitMap;
   CMSMarkStack*                  _markStack;
   MarkRefsIntoAndScanClosure*    _scanningClosure;
+  DEBUG_ONLY(HeapWord*           _last_scanned_object;)
 
  public:
   ScanMarkedObjectsAgainCarefullyClosure(CMSCollector* collector,
@@ -1514,8 +1515,9 @@
     _yield(should_yield),
     _bitMap(bitMap),
     _markStack(markStack),
-    _scanningClosure(cl) {
-  }
+    _scanningClosure(cl)
+    DEBUG_ONLY(COMMA _last_scanned_object(NULL))
+  { }
 
   void do_object(oop p) {
     guarantee(false, "call do_object_careful instead");
--- a/hotspot/src/share/vm/opto/macroArrayCopy.cpp	Tue May 24 12:42:43 2016 -0500
+++ b/hotspot/src/share/vm/opto/macroArrayCopy.cpp	Wed May 25 13:46:05 2016 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -235,7 +235,6 @@
   return StubRoutines::select_arraycopy_function(t, aligned, disjoint, name, dest_uninitialized);
 }
 
-#define COMMA ,
 #define XTOP LP64_ONLY(COMMA top())
 
 // Generate an optimized call to arraycopy.
--- a/hotspot/src/share/vm/prims/jni.cpp	Tue May 24 12:42:43 2016 -0500
+++ b/hotspot/src/share/vm/prims/jni.cpp	Wed May 25 13:46:05 2016 -0400
@@ -163,8 +163,6 @@
 #define FP_SELECT(TypeName, intcode, fpcode) \
   FP_SELECT_##TypeName(intcode, fpcode)
 
-#define COMMA ,
-
 // Choose DT_RETURN_MARK macros  based on the type: float/double -> void
 // (dtrace doesn't do FP yet)
 #define DT_RETURN_MARK_DECL_FOR(TypeName, name, type, probe)    \
--- a/hotspot/src/share/vm/utilities/macros.hpp	Tue May 24 12:42:43 2016 -0500
+++ b/hotspot/src/share/vm/utilities/macros.hpp	Wed May 25 13:46:05 2016 -0400
@@ -34,6 +34,9 @@
 // Makes a string of the macro expansion of a
 #define XSTR(a) STR(a)
 
+// Allow commas in macro arguments.
+#define COMMA ,
+
 // Apply pre-processor token pasting to the expansions of x and y.
 // The token pasting operator (##) prevents its arguments from being
 // expanded.  This macro allows expansion of its arguments before the