Mercurial > hg > graal-compiler
comparison src/share/vm/runtime/biasedLocking.cpp @ 84:6e085831cad7
6692235: Fix for 6666698 broke -XX:BiasedLockingStartupDelay=0
Summary: Stack allocated VM_EnableBiasedLocking op must be marked as such
Reviewed-by: xlu, acorn, never, dholmes
author | sbohne |
---|---|
date | Thu, 10 Apr 2008 15:49:29 -0400 |
parents | 7ee622712fcf |
children | d1605aabd0a1 |
comparison
equal
deleted
inserted
replaced
83:d3cd40645d0d | 84:6e085831cad7 |
---|---|
1 | |
2 /* | 1 /* |
3 * Copyright 2005-2007 Sun Microsystems, Inc. All Rights Reserved. | 2 * Copyright 2005-2007 Sun Microsystems, Inc. All Rights Reserved. |
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
5 * | 4 * |
6 * This code is free software; you can redistribute it and/or modify it | 5 * This code is free software; you can redistribute it and/or modify it |
35 static void enable_biased_locking(klassOop k) { | 34 static void enable_biased_locking(klassOop k) { |
36 Klass::cast(k)->set_prototype_header(markOopDesc::biased_locking_prototype()); | 35 Klass::cast(k)->set_prototype_header(markOopDesc::biased_locking_prototype()); |
37 } | 36 } |
38 | 37 |
39 class VM_EnableBiasedLocking: public VM_Operation { | 38 class VM_EnableBiasedLocking: public VM_Operation { |
39 private: | |
40 bool _is_cheap_allocated; | |
40 public: | 41 public: |
41 VM_EnableBiasedLocking() {} | 42 VM_EnableBiasedLocking(bool is_cheap_allocated) { _is_cheap_allocated = is_cheap_allocated; } |
42 VMOp_Type type() const { return VMOp_EnableBiasedLocking; } | 43 VMOp_Type type() const { return VMOp_EnableBiasedLocking; } |
43 Mode evaluation_mode() const { return _async_safepoint; } | 44 Mode evaluation_mode() const { return _is_cheap_allocated ? _async_safepoint : _safepoint; } |
44 bool is_cheap_allocated() const { return true; } | 45 bool is_cheap_allocated() const { return _is_cheap_allocated; } |
45 | 46 |
46 void doit() { | 47 void doit() { |
47 // Iterate the system dictionary enabling biased locking for all | 48 // Iterate the system dictionary enabling biased locking for all |
48 // currently loaded classes | 49 // currently loaded classes |
49 SystemDictionary::classes_do(enable_biased_locking); | 50 SystemDictionary::classes_do(enable_biased_locking); |
65 EnableBiasedLockingTask(size_t interval_time) : PeriodicTask(interval_time) {} | 66 EnableBiasedLockingTask(size_t interval_time) : PeriodicTask(interval_time) {} |
66 | 67 |
67 virtual void task() { | 68 virtual void task() { |
68 // Use async VM operation to avoid blocking the Watcher thread. | 69 // Use async VM operation to avoid blocking the Watcher thread. |
69 // VM Thread will free C heap storage. | 70 // VM Thread will free C heap storage. |
70 VM_EnableBiasedLocking *op = new VM_EnableBiasedLocking(); | 71 VM_EnableBiasedLocking *op = new VM_EnableBiasedLocking(true); |
71 VMThread::execute(op); | 72 VMThread::execute(op); |
72 | 73 |
73 // Reclaim our storage and disenroll ourself | 74 // Reclaim our storage and disenroll ourself |
74 delete this; | 75 delete this; |
75 } | 76 } |
87 if (UseBiasedLocking) { | 88 if (UseBiasedLocking) { |
88 if (BiasedLockingStartupDelay > 0) { | 89 if (BiasedLockingStartupDelay > 0) { |
89 EnableBiasedLockingTask* task = new EnableBiasedLockingTask(BiasedLockingStartupDelay); | 90 EnableBiasedLockingTask* task = new EnableBiasedLockingTask(BiasedLockingStartupDelay); |
90 task->enroll(); | 91 task->enroll(); |
91 } else { | 92 } else { |
92 VM_EnableBiasedLocking op; | 93 VM_EnableBiasedLocking op(false); |
93 VMThread::execute(&op); | 94 VMThread::execute(&op); |
94 } | 95 } |
95 } | 96 } |
96 } | 97 } |
97 | 98 |