src/hotspot/share/runtime/interfaceSupport.cpp
changeset 57603 f9d9bed12d1a
parent 54786 ebf733a324d4
child 58527 f9cc0141574c
--- a/src/hotspot/share/runtime/interfaceSupport.cpp	Wed Jul 31 06:37:13 2019 -0400
+++ b/src/hotspot/share/runtime/interfaceSupport.cpp	Wed Jul 31 06:54:50 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2019, 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
@@ -73,6 +73,14 @@
   }
 }
 
+VMNativeEntryWrapper::VMNativeEntryWrapper() {
+  if (GCALotAtAllSafepoints) InterfaceSupport::check_gc_alot();
+}
+
+VMNativeEntryWrapper::~VMNativeEntryWrapper() {
+  if (GCALotAtAllSafepoints) InterfaceSupport::check_gc_alot();
+}
+
 long InterfaceSupport::_number_of_calls       = 0;
 long InterfaceSupport::_scavenge_alot_counter = 1;
 long InterfaceSupport::_fullgc_alot_counter   = 1;
@@ -292,40 +300,3 @@
   }
 #endif
 }
-
-#ifdef ASSERT
-// JRT_LEAF rules:
-// A JRT_LEAF method may not interfere with safepointing by
-//   1) acquiring or blocking on a Mutex or JavaLock - checked
-//   2) allocating heap memory - checked
-//   3) executing a VM operation - checked
-//   4) executing a system call (including malloc) that could block or grab a lock
-//   5) invoking GC
-//   6) reaching a safepoint
-//   7) running too long
-// Nor may any method it calls.
-JRTLeafVerifier::JRTLeafVerifier()
-  : NoSafepointVerifier(true, JRTLeafVerifier::should_verify_GC())
-{
-}
-
-JRTLeafVerifier::~JRTLeafVerifier()
-{
-}
-
-bool JRTLeafVerifier::should_verify_GC() {
-  switch (JavaThread::current()->thread_state()) {
-  case _thread_in_Java:
-    // is in a leaf routine, there must be no safepoint.
-    return true;
-  case _thread_in_native:
-    // A native thread is not subject to safepoints.
-    // Even while it is in a leaf routine, GC is ok
-    return false;
-  default:
-    // Leaf routines cannot be called from other contexts.
-    ShouldNotReachHere();
-    return false;
-  }
-}
-#endif // ASSERT