< prev index next >

src/share/vm/runtime/jniHandles.cpp

Print this page
rev 13287 : 8175318: Performance issue regarding local JNI references
Summary: Avoid unnecessary repeated clears.
Reviewed-by:

@@ -442,10 +442,19 @@
     for (JNIHandleBlock* current = _next; current != NULL;
          current = current->_next) {
       assert(current->_last == NULL, "only first block should have _last set");
       assert(current->_free_list == NULL,
              "only first block should have _free_list set");
+      if (current->_top == 0) {
+        // All blocks after the first clear trailing block are already cleared.
+#ifdef ASSERT
+        for ( ; current != NULL; current = current->_next) {
+          assert(current->_top == 0, "trailing blocks must already be cleared");
+        }
+#endif
+        break;
+      }
       current->_top = 0;
       if (ZapJNIHandleArea) current->zap();
     }
     // Clear initial block
     _free_list = NULL;
< prev index next >