1798N/A/*
1879N/A * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
1798N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1798N/A *
1798N/A * This code is free software; you can redistribute it and/or modify it
1798N/A * under the terms of the GNU General Public License version 2 only, as
1798N/A * published by the Free Software Foundation.
1798N/A *
1798N/A * This code is distributed in the hope that it will be useful, but WITHOUT
1798N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1798N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1798N/A * version 2 for more details (a copy is included in the LICENSE file that
1798N/A * accompanied this code).
1798N/A *
1798N/A * You should have received a copy of the GNU General Public License version
1798N/A * 2 along with this work; if not, write to the Free Software Foundation,
1798N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1798N/A *
1798N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
1798N/A * or visit www.oracle.com if you need additional information or have any
1798N/A * questions.
1798N/A *
1798N/A */
1798N/A
1879N/A#ifndef SHARE_VM_RUNTIME_BASICLOCK_HPP
1879N/A#define SHARE_VM_RUNTIME_BASICLOCK_HPP
1879N/A
1879N/A#include "oops/markOop.hpp"
1879N/A#include "runtime/handles.hpp"
1879N/A#include "utilities/top.hpp"
1879N/A
1798N/Aclass BasicLock VALUE_OBJ_CLASS_SPEC {
1798N/A friend class VMStructs;
1798N/A private:
1798N/A volatile markOop _displaced_header;
1798N/A public:
1798N/A markOop displaced_header() const { return _displaced_header; }
1798N/A void set_displaced_header(markOop header) { _displaced_header = header; }
1798N/A
1798N/A void print_on(outputStream* st) const;
1798N/A
1798N/A // move a basic lock (used during deoptimization
1798N/A void move_to(oop obj, BasicLock* dest);
1798N/A
1798N/A static int displaced_header_offset_in_bytes() { return offset_of(BasicLock, _displaced_header); }
1798N/A};
1798N/A
1798N/A// A BasicObjectLock associates a specific Java object with a BasicLock.
1798N/A// It is currently embedded in an interpreter frame.
1798N/A
1798N/A// Because some machines have alignment restrictions on the control stack,
1798N/A// the actual space allocated by the interpreter may include padding words
1798N/A// after the end of the BasicObjectLock. Also, in order to guarantee
1798N/A// alignment of the embedded BasicLock objects on such machines, we
1798N/A// put the embedded BasicLock at the beginning of the struct.
1798N/A
1798N/Aclass BasicObjectLock VALUE_OBJ_CLASS_SPEC {
1798N/A friend class VMStructs;
1798N/A private:
1798N/A BasicLock _lock; // the lock, must be double word aligned
1798N/A oop _obj; // object holds the lock;
1798N/A
1798N/A public:
1798N/A // Manipulation
1798N/A oop obj() const { return _obj; }
1798N/A void set_obj(oop obj) { _obj = obj; }
1798N/A BasicLock* lock() { return &_lock; }
1798N/A
1798N/A // Note: Use frame::interpreter_frame_monitor_size() for the size of BasicObjectLocks
1798N/A // in interpreter activation frames since it includes machine-specific padding.
1798N/A static int size() { return sizeof(BasicObjectLock)/wordSize; }
1798N/A
1798N/A // GC support
1798N/A void oops_do(OopClosure* f) { f->do_oop(&_obj); }
1798N/A
1798N/A static int obj_offset_in_bytes() { return offset_of(BasicObjectLock, _obj); }
1798N/A static int lock_offset_in_bytes() { return offset_of(BasicObjectLock, _lock); }
1798N/A};
1798N/A
1879N/A
1879N/A#endif // SHARE_VM_RUNTIME_BASICLOCK_HPP