src/share/vm/runtime/basicLock.hpp

Fri, 28 Mar 2014 10:13:37 -0700

author
vlivanov
date
Fri, 28 Mar 2014 10:13:37 -0700
changeset 6528
248ff38d2950
parent 2314
f95d63e2154a
child 6876
710a3c8b516e
permissions
-rw-r--r--

8035828: Turn on @Stable support in VM
Reviewed-by: jrose, twisti

acorn@2233 1 /*
stefank@2314 2 * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
acorn@2233 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
acorn@2233 4 *
acorn@2233 5 * This code is free software; you can redistribute it and/or modify it
acorn@2233 6 * under the terms of the GNU General Public License version 2 only, as
acorn@2233 7 * published by the Free Software Foundation.
acorn@2233 8 *
acorn@2233 9 * This code is distributed in the hope that it will be useful, but WITHOUT
acorn@2233 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
acorn@2233 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
acorn@2233 12 * version 2 for more details (a copy is included in the LICENSE file that
acorn@2233 13 * accompanied this code).
acorn@2233 14 *
acorn@2233 15 * You should have received a copy of the GNU General Public License version
acorn@2233 16 * 2 along with this work; if not, write to the Free Software Foundation,
acorn@2233 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
acorn@2233 18 *
acorn@2233 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
acorn@2233 20 * or visit www.oracle.com if you need additional information or have any
acorn@2233 21 * questions.
acorn@2233 22 *
acorn@2233 23 */
acorn@2233 24
stefank@2314 25 #ifndef SHARE_VM_RUNTIME_BASICLOCK_HPP
stefank@2314 26 #define SHARE_VM_RUNTIME_BASICLOCK_HPP
stefank@2314 27
stefank@2314 28 #include "oops/markOop.hpp"
stefank@2314 29 #include "runtime/handles.hpp"
stefank@2314 30 #include "utilities/top.hpp"
stefank@2314 31
acorn@2233 32 class BasicLock VALUE_OBJ_CLASS_SPEC {
acorn@2233 33 friend class VMStructs;
acorn@2233 34 private:
acorn@2233 35 volatile markOop _displaced_header;
acorn@2233 36 public:
acorn@2233 37 markOop displaced_header() const { return _displaced_header; }
acorn@2233 38 void set_displaced_header(markOop header) { _displaced_header = header; }
acorn@2233 39
acorn@2233 40 void print_on(outputStream* st) const;
acorn@2233 41
acorn@2233 42 // move a basic lock (used during deoptimization
acorn@2233 43 void move_to(oop obj, BasicLock* dest);
acorn@2233 44
acorn@2233 45 static int displaced_header_offset_in_bytes() { return offset_of(BasicLock, _displaced_header); }
acorn@2233 46 };
acorn@2233 47
acorn@2233 48 // A BasicObjectLock associates a specific Java object with a BasicLock.
acorn@2233 49 // It is currently embedded in an interpreter frame.
acorn@2233 50
acorn@2233 51 // Because some machines have alignment restrictions on the control stack,
acorn@2233 52 // the actual space allocated by the interpreter may include padding words
acorn@2233 53 // after the end of the BasicObjectLock. Also, in order to guarantee
acorn@2233 54 // alignment of the embedded BasicLock objects on such machines, we
acorn@2233 55 // put the embedded BasicLock at the beginning of the struct.
acorn@2233 56
acorn@2233 57 class BasicObjectLock VALUE_OBJ_CLASS_SPEC {
acorn@2233 58 friend class VMStructs;
acorn@2233 59 private:
acorn@2233 60 BasicLock _lock; // the lock, must be double word aligned
acorn@2233 61 oop _obj; // object holds the lock;
acorn@2233 62
acorn@2233 63 public:
acorn@2233 64 // Manipulation
acorn@2233 65 oop obj() const { return _obj; }
acorn@2233 66 void set_obj(oop obj) { _obj = obj; }
acorn@2233 67 BasicLock* lock() { return &_lock; }
acorn@2233 68
acorn@2233 69 // Note: Use frame::interpreter_frame_monitor_size() for the size of BasicObjectLocks
acorn@2233 70 // in interpreter activation frames since it includes machine-specific padding.
acorn@2233 71 static int size() { return sizeof(BasicObjectLock)/wordSize; }
acorn@2233 72
acorn@2233 73 // GC support
acorn@2233 74 void oops_do(OopClosure* f) { f->do_oop(&_obj); }
acorn@2233 75
acorn@2233 76 static int obj_offset_in_bytes() { return offset_of(BasicObjectLock, _obj); }
acorn@2233 77 static int lock_offset_in_bytes() { return offset_of(BasicObjectLock, _lock); }
acorn@2233 78 };
acorn@2233 79
stefank@2314 80
stefank@2314 81 #endif // SHARE_VM_RUNTIME_BASICLOCK_HPP

mercurial