Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/src/share/vm/runtime/basicLock.hpp
32285 views
/*1* Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*22*/2324#ifndef SHARE_VM_RUNTIME_BASICLOCK_HPP25#define SHARE_VM_RUNTIME_BASICLOCK_HPP2627#include "oops/markOop.hpp"28#include "runtime/handles.hpp"29#include "utilities/top.hpp"3031class BasicLock VALUE_OBJ_CLASS_SPEC {32friend class VMStructs;33private:34volatile markOop _displaced_header;35public:36markOop displaced_header() const { return _displaced_header; }37void set_displaced_header(markOop header) { _displaced_header = header; }3839void print_on(outputStream* st) const;4041// move a basic lock (used during deoptimization42void move_to(oop obj, BasicLock* dest);4344static int displaced_header_offset_in_bytes() { return offset_of(BasicLock, _displaced_header); }45};4647// A BasicObjectLock associates a specific Java object with a BasicLock.48// It is currently embedded in an interpreter frame.4950// Because some machines have alignment restrictions on the control stack,51// the actual space allocated by the interpreter may include padding words52// after the end of the BasicObjectLock. Also, in order to guarantee53// alignment of the embedded BasicLock objects on such machines, we54// put the embedded BasicLock at the beginning of the struct.5556class BasicObjectLock VALUE_OBJ_CLASS_SPEC {57friend class VMStructs;58private:59BasicLock _lock; // the lock, must be double word aligned60oop _obj; // object holds the lock;6162public:63// Manipulation64oop obj() const { return _obj; }65void set_obj(oop obj) { _obj = obj; }66BasicLock* lock() { return &_lock; }6768// Note: Use frame::interpreter_frame_monitor_size() for the size of BasicObjectLocks69// in interpreter activation frames since it includes machine-specific padding.70static int size() { return sizeof(BasicObjectLock)/wordSize; }7172// GC support73void oops_do(OopClosure* f) { f->do_oop(&_obj); }7475static int obj_offset_in_bytes() { return offset_of(BasicObjectLock, _obj); }76static int lock_offset_in_bytes() { return offset_of(BasicObjectLock, _lock); }77};787980#endif // SHARE_VM_RUNTIME_BASICLOCK_HPP818283