< prev index next >
src/share/vm/runtime/biasedLocking.cpp
Print this page
@@ -40,13 +40,17 @@
BiasedLockingCounters BiasedLocking::_counters;
static GrowableArray<Handle>* _preserved_oop_stack = NULL;
static GrowableArray<markOop>* _preserved_mark_stack = NULL;
-static void enable_biased_locking(Klass* k) {
+class EnableBiasedLocking : public KlassClosure {
+ void do_klass(Klass* k) {
+ if (k->is_instance_klass()) {
k->set_prototype_header(markOopDesc::biased_locking_prototype());
-}
+ }
+ }
+};
class VM_EnableBiasedLocking: public VM_Operation {
private:
bool _is_cheap_allocated;
public:
@@ -56,11 +60,12 @@
bool is_cheap_allocated() const { return _is_cheap_allocated; }
void doit() {
// Iterate the system dictionary enabling biased locking for all
// currently loaded classes
- SystemDictionary::classes_do(enable_biased_locking);
+ EnableBiasedLocking enable_biased_locking;
+ ClassLoaderDataGraph::loaded_classes_do(&enable_biased_locking);
// Indicate that future instances should enable it as well
_biased_locking_enabled = true;
log_info(biasedlocking)("Biased locking enabled");
}
< prev index next >