changeset 58:7ee622712fcf

6666698: EnableBiasedLocking with BiasedLockingStartupDelay can block Watcher thread Summary: Enqueue VM_EnableBiasedLocking operation asynchronously Reviewed-by: never, xlu, kbr, acorn
author sbohne
date Tue, 04 Mar 2008 09:44:24 -0500
parents ff0979201b06
children 887682771f69
files src/share/vm/runtime/biasedLocking.cpp
diffstat 1 files changed, 9 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/runtime/biasedLocking.cpp	Mon Mar 03 14:47:02 2008 -0500
+++ b/src/share/vm/runtime/biasedLocking.cpp	Tue Mar 04 09:44:24 2008 -0500
@@ -38,8 +38,11 @@
 
 class VM_EnableBiasedLocking: public VM_Operation {
  public:
-  VM_EnableBiasedLocking() {}
-  VMOp_Type type() const   { return VMOp_EnableBiasedLocking; }
+  VM_EnableBiasedLocking()        {}
+  VMOp_Type type() const          { return VMOp_EnableBiasedLocking; }
+  Mode evaluation_mode() const    { return _async_safepoint; }
+  bool is_cheap_allocated() const { return true; }
+
   void doit() {
     // Iterate the system dictionary enabling biased locking for all
     // currently loaded classes
@@ -62,8 +65,10 @@
   EnableBiasedLockingTask(size_t interval_time) : PeriodicTask(interval_time) {}
 
   virtual void task() {
-    VM_EnableBiasedLocking op;
-    VMThread::execute(&op);
+    // Use async VM operation to avoid blocking the Watcher thread.
+    // VM Thread will free C heap storage.
+    VM_EnableBiasedLocking *op = new VM_EnableBiasedLocking();
+    VMThread::execute(op);
 
     // Reclaim our storage and disenroll ourself
     delete this;