equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * 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 |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
36 BiasedLockingCounters BiasedLocking::_counters; |
36 BiasedLockingCounters BiasedLocking::_counters; |
37 |
37 |
38 static GrowableArray<Handle>* _preserved_oop_stack = NULL; |
38 static GrowableArray<Handle>* _preserved_oop_stack = NULL; |
39 static GrowableArray<markOop>* _preserved_mark_stack = NULL; |
39 static GrowableArray<markOop>* _preserved_mark_stack = NULL; |
40 |
40 |
41 static void enable_biased_locking(klassOop k) { |
41 static void enable_biased_locking(Klass* k) { |
42 Klass::cast(k)->set_prototype_header(markOopDesc::biased_locking_prototype()); |
42 Klass::cast(k)->set_prototype_header(markOopDesc::biased_locking_prototype()); |
43 } |
43 } |
44 |
44 |
45 class VM_EnableBiasedLocking: public VM_Operation { |
45 class VM_EnableBiasedLocking: public VM_Operation { |
46 private: |
46 private: |
274 // 1. Revoke the biases of all objects in the heap of this type, |
274 // 1. Revoke the biases of all objects in the heap of this type, |
275 // but allow rebiasing of those objects if unlocked. |
275 // but allow rebiasing of those objects if unlocked. |
276 // 2. Revoke the biases of all objects in the heap of this type |
276 // 2. Revoke the biases of all objects in the heap of this type |
277 // and don't allow rebiasing of these objects. Disable |
277 // and don't allow rebiasing of these objects. Disable |
278 // allocation of objects of that type with the bias bit set. |
278 // allocation of objects of that type with the bias bit set. |
279 Klass* k = o->blueprint(); |
279 Klass* k = o->klass(); |
280 jlong cur_time = os::javaTimeMillis(); |
280 jlong cur_time = os::javaTimeMillis(); |
281 jlong last_bulk_revocation_time = k->last_biased_lock_bulk_revocation_time(); |
281 jlong last_bulk_revocation_time = k->last_biased_lock_bulk_revocation_time(); |
282 int revocation_count = k->biased_lock_revocation_count(); |
282 int revocation_count = k->biased_lock_revocation_count(); |
283 if ((revocation_count >= BiasedLockingBulkRebiasThreshold) && |
283 if ((revocation_count >= BiasedLockingBulkRebiasThreshold) && |
284 (revocation_count < BiasedLockingBulkRevokeThreshold) && |
284 (revocation_count < BiasedLockingBulkRevokeThreshold) && |
328 (bulk_rebias ? "rebias" : "revoke"), |
328 (bulk_rebias ? "rebias" : "revoke"), |
329 (intptr_t) o, (intptr_t) o->mark(), Klass::cast(o->klass())->external_name()); |
329 (intptr_t) o, (intptr_t) o->mark(), Klass::cast(o->klass())->external_name()); |
330 } |
330 } |
331 |
331 |
332 jlong cur_time = os::javaTimeMillis(); |
332 jlong cur_time = os::javaTimeMillis(); |
333 o->blueprint()->set_last_biased_lock_bulk_revocation_time(cur_time); |
333 o->klass()->set_last_biased_lock_bulk_revocation_time(cur_time); |
334 |
334 |
335 |
335 |
336 klassOop k_o = o->klass(); |
336 Klass* k_o = o->klass(); |
337 Klass* klass = Klass::cast(k_o); |
337 Klass* klass = Klass::cast(k_o); |
338 |
338 |
339 if (bulk_rebias) { |
339 if (bulk_rebias) { |
340 // Use the epoch in the klass of the object to implicitly revoke |
340 // Use the epoch in the klass of the object to implicitly revoke |
341 // all biases of objects of this data type and force them to be |
341 // all biases of objects of this data type and force them to be |