src/share/vm/runtime/basicLock.hpp

changeset 2233
fa83ab460c54
child 2314
f95d63e2154a
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/share/vm/runtime/basicLock.hpp	Fri Oct 22 15:59:34 2010 -0400
     1.3 @@ -0,0 +1,72 @@
     1.4 +/*
     1.5 + * Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved.
     1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.7 + *
     1.8 + * This code is free software; you can redistribute it and/or modify it
     1.9 + * under the terms of the GNU General Public License version 2 only, as
    1.10 + * published by the Free Software Foundation.
    1.11 + *
    1.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
    1.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    1.15 + * version 2 for more details (a copy is included in the LICENSE file that
    1.16 + * accompanied this code).
    1.17 + *
    1.18 + * You should have received a copy of the GNU General Public License version
    1.19 + * 2 along with this work; if not, write to the Free Software Foundation,
    1.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    1.21 + *
    1.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    1.23 + * or visit www.oracle.com if you need additional information or have any
    1.24 + * questions.
    1.25 + *
    1.26 + */
    1.27 +
    1.28 +class BasicLock VALUE_OBJ_CLASS_SPEC {
    1.29 +  friend class VMStructs;
    1.30 + private:
    1.31 +  volatile markOop _displaced_header;
    1.32 + public:
    1.33 +  markOop      displaced_header() const               { return _displaced_header; }
    1.34 +  void         set_displaced_header(markOop header)   { _displaced_header = header; }
    1.35 +
    1.36 +  void print_on(outputStream* st) const;
    1.37 +
    1.38 +  // move a basic lock (used during deoptimization
    1.39 +  void move_to(oop obj, BasicLock* dest);
    1.40 +
    1.41 +  static int displaced_header_offset_in_bytes()       { return offset_of(BasicLock, _displaced_header); }
    1.42 +};
    1.43 +
    1.44 +// A BasicObjectLock associates a specific Java object with a BasicLock.
    1.45 +// It is currently embedded in an interpreter frame.
    1.46 +
    1.47 +// Because some machines have alignment restrictions on the control stack,
    1.48 +// the actual space allocated by the interpreter may include padding words
    1.49 +// after the end of the BasicObjectLock.  Also, in order to guarantee
    1.50 +// alignment of the embedded BasicLock objects on such machines, we
    1.51 +// put the embedded BasicLock at the beginning of the struct.
    1.52 +
    1.53 +class BasicObjectLock VALUE_OBJ_CLASS_SPEC {
    1.54 +  friend class VMStructs;
    1.55 + private:
    1.56 +  BasicLock _lock;                                    // the lock, must be double word aligned
    1.57 +  oop       _obj;                                     // object holds the lock;
    1.58 +
    1.59 + public:
    1.60 +  // Manipulation
    1.61 +  oop      obj() const                                { return _obj;  }
    1.62 +  void set_obj(oop obj)                               { _obj = obj; }
    1.63 +  BasicLock* lock()                                   { return &_lock; }
    1.64 +
    1.65 +  // Note: Use frame::interpreter_frame_monitor_size() for the size of BasicObjectLocks
    1.66 +  //       in interpreter activation frames since it includes machine-specific padding.
    1.67 +  static int size()                                   { return sizeof(BasicObjectLock)/wordSize; }
    1.68 +
    1.69 +  // GC support
    1.70 +  void oops_do(OopClosure* f) { f->do_oop(&_obj); }
    1.71 +
    1.72 +  static int obj_offset_in_bytes()                    { return offset_of(BasicObjectLock, _obj);  }
    1.73 +  static int lock_offset_in_bytes()                   { return offset_of(BasicObjectLock, _lock); }
    1.74 +};
    1.75 +

mercurial