hotspot/src/share/vm/runtime/vmThread.cpp
changeset 15235 0a73bc0920e5
parent 14583 d70ee55535f4
child 17006 b9bfa72b7dda
--- a/hotspot/src/share/vm/runtime/vmThread.cpp	Tue Jan 22 05:56:42 2013 -0800
+++ b/hotspot/src/share/vm/runtime/vmThread.cpp	Tue Jan 22 05:57:18 2013 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2013, 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
@@ -570,7 +570,11 @@
   if (!t->is_VM_thread()) {
     SkipGCALot sgcalot(t);    // avoid re-entrant attempts to gc-a-lot
     // JavaThread or WatcherThread
-    t->check_for_valid_safepoint_state(true);
+    bool concurrent = op->evaluate_concurrently();
+    // only blocking VM operations need to verify the caller's safepoint state:
+    if (!concurrent) {
+      t->check_for_valid_safepoint_state(true);
+    }
 
     // New request from Java thread, evaluate prologue
     if (!op->doit_prologue()) {
@@ -582,7 +586,6 @@
 
     // It does not make sense to execute the epilogue, if the VM operation object is getting
     // deallocated by the VM thread.
-    bool concurrent     = op->evaluate_concurrently();
     bool execute_epilog = !op->is_cheap_allocated();
     assert(!concurrent || op->is_cheap_allocated(), "concurrent => cheap_allocated");