src/share/vm/runtime/objectMonitor.inline.hpp

Tue, 11 May 2010 14:35:43 -0700

author
prr
date
Tue, 11 May 2010 14:35:43 -0700
changeset 1840
fb57d4cf76c2
parent 435
a61af66fc99e
child 1907
c18cbe5936b8
permissions
-rw-r--r--

6931180: Migration to recent versions of MS Platform SDK
6951582: Build problems on win64
Summary: Changes to enable building JDK7 with Microsoft Visual Studio 2010
Reviewed-by: ohair, art, ccheung, dcubed

     1 /*
     2  * Copyright 1998-2005 Sun Microsystems, Inc.  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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
    20  * CA 95054 USA or visit www.sun.com if you need additional information or
    21  * have any questions.
    22  *
    23  */
    25 inline intptr_t ObjectMonitor::is_entered(TRAPS) const {
    26   if (THREAD == _owner || THREAD->is_lock_owned((address) _owner)) {
    27     return 1;
    28   }
    29   return 0;
    30 }
    32 inline markOop ObjectMonitor::header() const {
    33   return _header;
    34 }
    36 inline void ObjectMonitor::set_header(markOop hdr) {
    37   _header = hdr;
    38 }
    40 inline intptr_t ObjectMonitor::count() const {
    41   return _count;
    42 }
    44 inline void ObjectMonitor::set_count(intptr_t count) {
    45   _count= count;
    46 }
    48 inline intptr_t ObjectMonitor::waiters() const {
    49   return _waiters;
    50 }
    52 inline void* ObjectMonitor::owner() const {
    53   return _owner;
    54 }
    56 inline void ObjectMonitor::clear() {
    57   assert(_header, "Fatal logic error in ObjectMonitor header!");
    58   assert(_count == 0, "Fatal logic error in ObjectMonitor count!");
    59   assert(_waiters == 0, "Fatal logic error in ObjectMonitor waiters!");
    60   assert(_recursions == 0, "Fatal logic error in ObjectMonitor recursions!");
    61   assert(_object, "Fatal logic error in ObjectMonitor object!");
    62   assert(_owner == 0, "Fatal logic error in ObjectMonitor owner!");
    64   _header = NULL;
    65   _object = NULL;
    66 }
    69 inline void* ObjectMonitor::object() const {
    70   return _object;
    71 }
    73 inline void* ObjectMonitor::object_addr() {
    74   return (void *)(&_object);
    75 }
    77 inline void ObjectMonitor::set_object(void* obj) {
    78   _object = obj;
    79 }
    81 inline bool ObjectMonitor::check(TRAPS) {
    82   if (THREAD != _owner) {
    83     if (THREAD->is_lock_owned((address) _owner)) {
    84       _owner = THREAD;  // regain ownership of inflated monitor
    85       OwnerIsThread = 1 ;
    86       assert (_recursions == 0, "invariant") ;
    87     } else {
    88       check_slow(THREAD);
    89       return false;
    90     }
    91   }
    92   return true;
    93 }
    96 // return number of threads contending for this monitor
    97 inline intptr_t ObjectMonitor::contentions() const {
    98   return _count;
    99 }
   101 inline void ObjectMonitor::set_owner(void* owner) {
   102   _owner = owner;
   103   _recursions = 0;
   104   _count = 0;
   105 }
   108 // here are the platform-dependent bodies:
   110 # include "incls/_objectMonitor_pd.inline.hpp.incl"

mercurial