1 /* 2 * Copyright (c) 2005, 2009, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 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 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 * 23 */ 24 25 # include "incls/_precompiled.incl" 26 # include "incls/_biasedLocking.cpp.incl" 27 28 static bool _biased_locking_enabled = false; 29 BiasedLockingCounters BiasedLocking::_counters; 30 31 static GrowableArray<Handle>* _preserved_oop_stack = NULL; 32 static GrowableArray<markOop>* _preserved_mark_stack = NULL; 33 34 static void enable_biased_locking(klassOop k) { 35 Klass::cast(k)->set_prototype_header(markOopDesc::biased_locking_prototype()); 36 } 37 38 class VM_EnableBiasedLocking: public VM_Operation { 39 private: 40 bool _is_cheap_allocated; 41 public: 42 VM_EnableBiasedLocking(bool is_cheap_allocated) { _is_cheap_allocated = is_cheap_allocated; } 43 VMOp_Type type() const { return VMOp_EnableBiasedLocking; } 44 Mode evaluation_mode() const { return _is_cheap_allocated ? _async_safepoint : _safepoint; } 45 bool is_cheap_allocated() const { return _is_cheap_allocated; } 46 | 1 /* 2 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 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 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 * 23 */ 24 25 #include "precompiled.hpp" 26 #include "oops/klass.inline.hpp" 27 #include "oops/markOop.hpp" 28 #include "runtime/basicLock.hpp" 29 #include "runtime/biasedLocking.hpp" 30 #include "runtime/task.hpp" 31 #include "runtime/vframe.hpp" 32 #include "runtime/vmThread.hpp" 33 #include "runtime/vm_operations.hpp" 34 35 static bool _biased_locking_enabled = false; 36 BiasedLockingCounters BiasedLocking::_counters; 37 38 static GrowableArray<Handle>* _preserved_oop_stack = NULL; 39 static GrowableArray<markOop>* _preserved_mark_stack = NULL; 40 41 static void enable_biased_locking(klassOop k) { 42 Klass::cast(k)->set_prototype_header(markOopDesc::biased_locking_prototype()); 43 } 44 45 class VM_EnableBiasedLocking: public VM_Operation { 46 private: 47 bool _is_cheap_allocated; 48 public: 49 VM_EnableBiasedLocking(bool is_cheap_allocated) { _is_cheap_allocated = is_cheap_allocated; } 50 VMOp_Type type() const { return VMOp_EnableBiasedLocking; } 51 Mode evaluation_mode() const { return _is_cheap_allocated ? _async_safepoint : _safepoint; } 52 bool is_cheap_allocated() const { return _is_cheap_allocated; } 53 |