src/hotspot/share/runtime/objectMonitor.hpp
author dcubed
Wed, 20 Nov 2019 09:10:02 -0500
changeset 59156 14fa9e70ae71
parent 58488 165b193b30dd
permissions -rw-r--r--
8230876: baseline cleanups from Async Monitor Deflation v2.0[789] Reviewed-by: dholmes, kvn
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 51960
diff changeset
     2
 * Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1
diff changeset
    21
 * questions.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 51960
diff changeset
    25
#ifndef SHARE_RUNTIME_OBJECTMONITOR_HPP
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 51960
diff changeset
    26
#define SHARE_RUNTIME_OBJECTMONITOR_HPP
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6975
diff changeset
    27
48157
7c4d43c26352 8192061: Clean up allocation.inline.hpp includes
stefank
parents: 48115
diff changeset
    28
#include "memory/allocation.hpp"
27165
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
    29
#include "memory/padded.hpp"
57811
947252a54b98 8229838: Rename markOop files to markWord
stefank
parents: 57777
diff changeset
    30
#include "oops/markWord.hpp"
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6975
diff changeset
    31
#include "runtime/os.hpp"
7408
c04a5c989f26 7003125: precompiled.hpp is included when precompiled headers are not used
stefank
parents: 7397
diff changeset
    32
#include "runtime/park.hpp"
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6975
diff changeset
    33
#include "runtime/perfData.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6975
diff changeset
    34
49449
ef5d5d343e2a 8199263: Split interfaceSupport.hpp to not require including .inline.hpp files
coleenp
parents: 49038
diff changeset
    35
class ObjectMonitor;
ef5d5d343e2a 8199263: Split interfaceSupport.hpp to not require including .inline.hpp files
coleenp
parents: 49038
diff changeset
    36
6975
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
    37
// ObjectWaiter serves as a "proxy" or surrogate thread.
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
    38
// TODO-FIXME: Eliminate ObjectWaiter and use the thread-specific
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
    39
// ParkEvent instead.  Beware, however, that the JVMTI code
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
    40
// knows about ObjectWaiters, so we'll have to reconcile that code.
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
    41
// See next_waiter(), first_waiter(), etc.
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
    42
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
    43
class ObjectWaiter : public StackObj {
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
    44
 public:
25064
244218e6ec0a 8046758: cleanup non-indent white space issues prior to Contended Locking cleanup bucket
dcubed
parents: 22551
diff changeset
    45
  enum TStates { TS_UNDEF, TS_READY, TS_RUN, TS_WAIT, TS_ENTER, TS_CXQ };
57906
e17f768b3b71 8230184: rename, whitespace, indent and comments changes in preparation for lock free Monitor lists
dcubed
parents: 57811
diff changeset
    46
  ObjectWaiter* volatile _next;
e17f768b3b71 8230184: rename, whitespace, indent and comments changes in preparation for lock free Monitor lists
dcubed
parents: 57811
diff changeset
    47
  ObjectWaiter* volatile _prev;
6975
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
    48
  Thread*       _thread;
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents: 17376
diff changeset
    49
  jlong         _notifier_tid;
6975
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
    50
  ParkEvent *   _event;
25064
244218e6ec0a 8046758: cleanup non-indent white space issues prior to Contended Locking cleanup bucket
dcubed
parents: 22551
diff changeset
    51
  volatile int  _notified;
244218e6ec0a 8046758: cleanup non-indent white space issues prior to Contended Locking cleanup bucket
dcubed
parents: 22551
diff changeset
    52
  volatile TStates TState;
244218e6ec0a 8046758: cleanup non-indent white space issues prior to Contended Locking cleanup bucket
dcubed
parents: 22551
diff changeset
    53
  bool          _active;           // Contention monitoring is enabled
6975
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
    54
 public:
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
    55
  ObjectWaiter(Thread* thread);
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
    56
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
    57
  void wait_reenter_begin(ObjectMonitor *mon);
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
    58
  void wait_reenter_end(ObjectMonitor *mon);
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
    59
};
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
    60
27165
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
    61
// The ObjectMonitor class implements the heavyweight version of a
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
    62
// JavaMonitor. The lightweight BasicLock/stack lock version has been
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
    63
// inflated into an ObjectMonitor. This inflation is typically due to
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
    64
// contention or use of Object.wait().
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
    65
//
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
    66
// WARNING: This is a very sensitive and fragile class. DO NOT make any
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
    67
// changes unless you are fully aware of the underlying semantics.
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
    68
//
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
    69
// ObjectMonitor Layout Overview/Highlights/Restrictions:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
//
27165
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
    71
// - The _header field must be at offset 0 because the displaced header
57811
947252a54b98 8229838: Rename markOop files to markWord
stefank
parents: 57777
diff changeset
    72
//   from markWord is stored there. We do not want markWord.hpp to include
27165
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
    73
//   ObjectMonitor.hpp to avoid exposing ObjectMonitor everywhere. This
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
    74
//   means that ObjectMonitor cannot inherit from any other class nor can
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
    75
//   it use any virtual member functions. This restriction is critical to
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
    76
//   the proper functioning of the VM.
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
    77
// - The _header and _owner fields should be separated by enough space
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
    78
//   to avoid false sharing due to parallel access by different threads.
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
    79
//   This is an advisory recommendation.
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
    80
// - The general layout of the fields in ObjectMonitor is:
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
    81
//     _header
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
    82
//     <lightly_used_fields>
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
    83
//     <optional padding>
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
    84
//     _owner
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
    85
//     <remaining_fields>
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
    86
// - The VM assumes write ordering and machine word alignment with
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
    87
//   respect to the _owner field and the <remaining_fields> that can
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
    88
//   be read in parallel by other threads.
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
    89
// - Generally fields that are accessed closely together in time should
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
    90
//   be placed proximally in space to promote data cache locality. That
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
    91
//   is, temporal locality should condition spatial locality.
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
    92
// - We have to balance avoiding false sharing with excessive invalidation
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
    93
//   from coherence traffic. As such, we try to cluster fields that tend
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
    94
//   to be _written_ at approximately the same time onto the same data
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
    95
//   cache line.
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
    96
// - We also have to balance the natural tension between minimizing
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
    97
//   single threaded capacity misses with excessive multi-threaded
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
    98
//   coherency misses. There is no single optimal layout for both
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
    99
//   single-threaded and multi-threaded environments.
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
   100
//
51258
2ce72467c4e8 8171157: Convert ObjectMonitor_test to GTest
dcubed
parents: 50113
diff changeset
   101
// - See TEST_VM(ObjectMonitor, sanity) gtest for how critical restrictions are
2ce72467c4e8 8171157: Convert ObjectMonitor_test to GTest
dcubed
parents: 50113
diff changeset
   102
//   enforced.
27165
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
   103
// - Adjacent ObjectMonitors should be separated by enough space to avoid
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
   104
//   false sharing. This is handled by the ObjectMonitor allocation code
51258
2ce72467c4e8 8171157: Convert ObjectMonitor_test to GTest
dcubed
parents: 50113
diff changeset
   105
//   in synchronizer.cpp. Also see TEST_VM(SynchronizerTest, sanity) gtest.
27165
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
   106
//
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
   107
// Futures notes:
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
   108
//   - Separating _owner from the <remaining_fields> by enough space to
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
   109
//     avoid false sharing might be profitable. Given
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
   110
//     http://blogs.oracle.com/dave/entry/cas_and_cache_trivia_invalidate
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
   111
//     we know that the CAS in monitorenter will invalidate the line
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
   112
//     underlying _owner. We want to avoid an L1 data cache miss on that
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
   113
//     same line for monitorexit. Putting these <remaining_fields>:
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
   114
//     _recursions, _EntryList, _cxq, and _succ, all of which may be
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
   115
//     fetched in the inflated unlock path, on a different cache line
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
   116
//     would make them immune to CAS-based invalidation from the _owner
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
   117
//     field.
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
   118
//
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
   119
//   - The _recursions field should be of type int, or int32_t but not
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
   120
//     intptr_t. There's no reason to use a 64-bit type for this field
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
   121
//     in a 64-bit JVM.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
class ObjectMonitor {
27165
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
   124
  friend class ObjectSynchronizer;
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
   125
  friend class ObjectWaiter;
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
   126
  friend class VMStructs;
54732
2d012a75d35c 8223332: Update JVMCI
kvn
parents: 54725
diff changeset
   127
  JVMCI_ONLY(friend class JVMCIVMStructs;)
27165
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
   128
57906
e17f768b3b71 8230184: rename, whitespace, indent and comments changes in preparation for lock free Monitor lists
dcubed
parents: 57811
diff changeset
   129
  // The sync code expects the header field to be at offset zero (0).
e17f768b3b71 8230184: rename, whitespace, indent and comments changes in preparation for lock free Monitor lists
dcubed
parents: 57811
diff changeset
   130
  // Enforced by the assert() in header_addr().
e17f768b3b71 8230184: rename, whitespace, indent and comments changes in preparation for lock free Monitor lists
dcubed
parents: 57811
diff changeset
   131
  volatile markWord _header;        // displaced object header word - mark
e17f768b3b71 8230184: rename, whitespace, indent and comments changes in preparation for lock free Monitor lists
dcubed
parents: 57811
diff changeset
   132
  void* volatile _object;           // backward object pointer - strong root
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
 public:
57906
e17f768b3b71 8230184: rename, whitespace, indent and comments changes in preparation for lock free Monitor lists
dcubed
parents: 57811
diff changeset
   134
  ObjectMonitor* _next_om;          // Next ObjectMonitor* linkage
27165
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
   135
 private:
57906
e17f768b3b71 8230184: rename, whitespace, indent and comments changes in preparation for lock free Monitor lists
dcubed
parents: 57811
diff changeset
   136
  // Separate _header and _owner on different cache lines since both can
e17f768b3b71 8230184: rename, whitespace, indent and comments changes in preparation for lock free Monitor lists
dcubed
parents: 57811
diff changeset
   137
  // have busy multi-threaded access. _header and _object are set at
e17f768b3b71 8230184: rename, whitespace, indent and comments changes in preparation for lock free Monitor lists
dcubed
parents: 57811
diff changeset
   138
  // initial inflation and _object doesn't change until deflation so
e17f768b3b71 8230184: rename, whitespace, indent and comments changes in preparation for lock free Monitor lists
dcubed
parents: 57811
diff changeset
   139
  // _object is a good choice to share the cache line with _header.
e17f768b3b71 8230184: rename, whitespace, indent and comments changes in preparation for lock free Monitor lists
dcubed
parents: 57811
diff changeset
   140
  // _next_om shares _header's cache line for pre-monitor list historical
e17f768b3b71 8230184: rename, whitespace, indent and comments changes in preparation for lock free Monitor lists
dcubed
parents: 57811
diff changeset
   141
  // reasons. _next_om only changes if the next ObjectMonitor is deflated.
27165
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
   142
  DEFINE_PAD_MINUS_SIZE(0, DEFAULT_CACHE_LINE_SIZE,
57906
e17f768b3b71 8230184: rename, whitespace, indent and comments changes in preparation for lock free Monitor lists
dcubed
parents: 57811
diff changeset
   143
                        sizeof(volatile markWord) + sizeof(void* volatile) +
27165
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
   144
                        sizeof(ObjectMonitor *));
57906
e17f768b3b71 8230184: rename, whitespace, indent and comments changes in preparation for lock free Monitor lists
dcubed
parents: 57811
diff changeset
   145
  void* volatile _owner;            // pointer to owning thread OR BasicLock
27165
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
   146
  volatile jlong _previous_owner_tid;  // thread id of the previous owner of the monitor
59156
14fa9e70ae71 8230876: baseline cleanups from Async Monitor Deflation v2.0[789]
dcubed
parents: 58488
diff changeset
   147
  volatile intx _recursions;        // recursion count, 0 for first entry
57906
e17f768b3b71 8230184: rename, whitespace, indent and comments changes in preparation for lock free Monitor lists
dcubed
parents: 57811
diff changeset
   148
  ObjectWaiter* volatile _EntryList;  // Threads blocked on entry or reentry.
27165
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
   149
                                      // The list is actually composed of WaitNodes,
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
   150
                                      // acting as proxies for Threads.
58488
165b193b30dd 8231289: Disentangle JvmtiRawMonitor from ObjectMonitor and clean it up
dholmes
parents: 57906
diff changeset
   151
57906
e17f768b3b71 8230184: rename, whitespace, indent and comments changes in preparation for lock free Monitor lists
dcubed
parents: 57811
diff changeset
   152
  ObjectWaiter* volatile _cxq;      // LL of recently-arrived threads blocked on entry.
e17f768b3b71 8230184: rename, whitespace, indent and comments changes in preparation for lock free Monitor lists
dcubed
parents: 57811
diff changeset
   153
  Thread* volatile _succ;           // Heir presumptive thread - used for futile wakeup throttling
e17f768b3b71 8230184: rename, whitespace, indent and comments changes in preparation for lock free Monitor lists
dcubed
parents: 57811
diff changeset
   154
  Thread* volatile _Responsible;
27165
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
   155
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
   156
  volatile int _Spinner;            // for exit->spinner handoff optimization
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
   157
  volatile int _SpinDuration;
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
   158
54609
04857e2cd509 8222295: more baseline cleanups from Async Monitor Deflation project
dcubed
parents: 53557
diff changeset
   159
  volatile jint  _contentions;      // Number of active contentions in enter(). It is used by is_busy()
04857e2cd509 8222295: more baseline cleanups from Async Monitor Deflation project
dcubed
parents: 53557
diff changeset
   160
                                    // along with other fields to determine if an ObjectMonitor can be
04857e2cd509 8222295: more baseline cleanups from Async Monitor Deflation project
dcubed
parents: 53557
diff changeset
   161
                                    // deflated. See ObjectSynchronizer::deflate_monitor().
27165
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
   162
 protected:
57906
e17f768b3b71 8230184: rename, whitespace, indent and comments changes in preparation for lock free Monitor lists
dcubed
parents: 57811
diff changeset
   163
  ObjectWaiter* volatile _WaitSet;  // LL of threads wait()ing on the monitor
27165
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
   164
  volatile jint  _waiters;          // number of waiting threads
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
   165
 private:
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
   166
  volatile int _WaitSetLock;        // protects Wait Queue - simple spinlock
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
   167
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
   168
 public:
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
   169
  static void Initialize();
32614
b7b2407bc7e5 8049304: race between VM_Exit and _sync_FutileWakeups->inc()
dcubed
parents: 31856
diff changeset
   170
b7b2407bc7e5 8049304: race between VM_Exit and _sync_FutileWakeups->inc()
dcubed
parents: 31856
diff changeset
   171
  // Only perform a PerfData operation if the PerfData object has been
b7b2407bc7e5 8049304: race between VM_Exit and _sync_FutileWakeups->inc()
dcubed
parents: 31856
diff changeset
   172
  // allocated and if the PerfDataManager has not freed the PerfData
b7b2407bc7e5 8049304: race between VM_Exit and _sync_FutileWakeups->inc()
dcubed
parents: 31856
diff changeset
   173
  // objects which can happen at normal VM shutdown.
b7b2407bc7e5 8049304: race between VM_Exit and _sync_FutileWakeups->inc()
dcubed
parents: 31856
diff changeset
   174
  //
b7b2407bc7e5 8049304: race between VM_Exit and _sync_FutileWakeups->inc()
dcubed
parents: 31856
diff changeset
   175
  #define OM_PERFDATA_OP(f, op_str)              \
b7b2407bc7e5 8049304: race between VM_Exit and _sync_FutileWakeups->inc()
dcubed
parents: 31856
diff changeset
   176
    do {                                         \
b7b2407bc7e5 8049304: race between VM_Exit and _sync_FutileWakeups->inc()
dcubed
parents: 31856
diff changeset
   177
      if (ObjectMonitor::_sync_ ## f != NULL &&  \
b7b2407bc7e5 8049304: race between VM_Exit and _sync_FutileWakeups->inc()
dcubed
parents: 31856
diff changeset
   178
          PerfDataManager::has_PerfData()) {     \
b7b2407bc7e5 8049304: race between VM_Exit and _sync_FutileWakeups->inc()
dcubed
parents: 31856
diff changeset
   179
        ObjectMonitor::_sync_ ## f->op_str;      \
b7b2407bc7e5 8049304: race between VM_Exit and _sync_FutileWakeups->inc()
dcubed
parents: 31856
diff changeset
   180
      }                                          \
b7b2407bc7e5 8049304: race between VM_Exit and _sync_FutileWakeups->inc()
dcubed
parents: 31856
diff changeset
   181
    } while (0)
b7b2407bc7e5 8049304: race between VM_Exit and _sync_FutileWakeups->inc()
dcubed
parents: 31856
diff changeset
   182
27165
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
   183
  static PerfCounter * _sync_ContendedLockAttempts;
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
   184
  static PerfCounter * _sync_FutileWakeups;
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
   185
  static PerfCounter * _sync_Parks;
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
   186
  static PerfCounter * _sync_Notifications;
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
   187
  static PerfCounter * _sync_Inflations;
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
   188
  static PerfCounter * _sync_Deflations;
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
   189
  static PerfLongVariable * _sync_MonExtant;
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
   190
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
   191
  static int Knob_SpinLimit;
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
   192
48157
7c4d43c26352 8192061: Clean up allocation.inline.hpp includes
stefank
parents: 48115
diff changeset
   193
  void* operator new (size_t size) throw();
7c4d43c26352 8192061: Clean up allocation.inline.hpp includes
stefank
parents: 48115
diff changeset
   194
  void* operator new[] (size_t size) throw();
7c4d43c26352 8192061: Clean up allocation.inline.hpp includes
stefank
parents: 48115
diff changeset
   195
  void operator delete(void* p);
57906
e17f768b3b71 8230184: rename, whitespace, indent and comments changes in preparation for lock free Monitor lists
dcubed
parents: 57811
diff changeset
   196
  void operator delete[] (void* p);
27165
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
   197
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
  // TODO-FIXME: the "offset" routines should return a type of off_t instead of int ...
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
  // ByteSize would also be an appropriate type.
26684
d1221849ea3d 8057109: manual cleanup of white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 26683
diff changeset
   200
  static int header_offset_in_bytes()      { return offset_of(ObjectMonitor, _header); }
d1221849ea3d 8057109: manual cleanup of white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 26683
diff changeset
   201
  static int object_offset_in_bytes()      { return offset_of(ObjectMonitor, _object); }
d1221849ea3d 8057109: manual cleanup of white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 26683
diff changeset
   202
  static int owner_offset_in_bytes()       { return offset_of(ObjectMonitor, _owner); }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   203
  static int recursions_offset_in_bytes()  { return offset_of(ObjectMonitor, _recursions); }
26684
d1221849ea3d 8057109: manual cleanup of white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 26683
diff changeset
   204
  static int cxq_offset_in_bytes()         { return offset_of(ObjectMonitor, _cxq); }
d1221849ea3d 8057109: manual cleanup of white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 26683
diff changeset
   205
  static int succ_offset_in_bytes()        { return offset_of(ObjectMonitor, _succ); }
d1221849ea3d 8057109: manual cleanup of white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 26683
diff changeset
   206
  static int EntryList_offset_in_bytes()   { return offset_of(ObjectMonitor, _EntryList); }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   207
57777
90ead0febf56 8229258: Rework markOop and markOopDesc into a simpler mark word value carrier
stefank
parents: 57734
diff changeset
   208
  // ObjectMonitor references can be ORed with markWord::monitor_value
27608
80d91e264baf 8062851: cleanup ObjectMonitor offset adjustments
dcubed
parents: 27165
diff changeset
   209
  // as part of the ObjectMonitor tagging mechanism. When we combine an
80d91e264baf 8062851: cleanup ObjectMonitor offset adjustments
dcubed
parents: 27165
diff changeset
   210
  // ObjectMonitor reference with an offset, we need to remove the tag
80d91e264baf 8062851: cleanup ObjectMonitor offset adjustments
dcubed
parents: 27165
diff changeset
   211
  // value in order to generate the proper address.
80d91e264baf 8062851: cleanup ObjectMonitor offset adjustments
dcubed
parents: 27165
diff changeset
   212
  //
80d91e264baf 8062851: cleanup ObjectMonitor offset adjustments
dcubed
parents: 27165
diff changeset
   213
  // We can either adjust the ObjectMonitor reference and then add the
80d91e264baf 8062851: cleanup ObjectMonitor offset adjustments
dcubed
parents: 27165
diff changeset
   214
  // offset or we can adjust the offset that is added to the ObjectMonitor
80d91e264baf 8062851: cleanup ObjectMonitor offset adjustments
dcubed
parents: 27165
diff changeset
   215
  // reference. The latter avoids an AGI (Address Generation Interlock)
80d91e264baf 8062851: cleanup ObjectMonitor offset adjustments
dcubed
parents: 27165
diff changeset
   216
  // stall so the helper macro adjusts the offset value that is returned
80d91e264baf 8062851: cleanup ObjectMonitor offset adjustments
dcubed
parents: 27165
diff changeset
   217
  // to the ObjectMonitor reference manipulation code:
80d91e264baf 8062851: cleanup ObjectMonitor offset adjustments
dcubed
parents: 27165
diff changeset
   218
  //
80d91e264baf 8062851: cleanup ObjectMonitor offset adjustments
dcubed
parents: 27165
diff changeset
   219
  #define OM_OFFSET_NO_MONITOR_VALUE_TAG(f) \
57777
90ead0febf56 8229258: Rework markOop and markOopDesc into a simpler mark word value carrier
stefank
parents: 57734
diff changeset
   220
    ((ObjectMonitor::f ## _offset_in_bytes()) - markWord::monitor_value)
27608
80d91e264baf 8062851: cleanup ObjectMonitor offset adjustments
dcubed
parents: 27165
diff changeset
   221
57777
90ead0febf56 8229258: Rework markOop and markOopDesc into a simpler mark word value carrier
stefank
parents: 57734
diff changeset
   222
  markWord           header() const;
90ead0febf56 8229258: Rework markOop and markOopDesc into a simpler mark word value carrier
stefank
parents: 57734
diff changeset
   223
  volatile markWord* header_addr();
90ead0febf56 8229258: Rework markOop and markOopDesc into a simpler mark word value carrier
stefank
parents: 57734
diff changeset
   224
  void               set_header(markWord hdr);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   225
6975
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
   226
  intptr_t is_busy() const {
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
   227
    // TODO-FIXME: assert _owner == null implies _recursions = 0
54609
04857e2cd509 8222295: more baseline cleanups from Async Monitor Deflation project
dcubed
parents: 53557
diff changeset
   228
    return _contentions|_waiters|intptr_t(_owner)|intptr_t(_cxq)|intptr_t(_EntryList);
6975
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
   229
  }
55345
492b644bb9c2 8225453: is_busy diagnostics and other baseline cleanups from Async Monitor Deflation project
dcubed
parents: 54807
diff changeset
   230
  const char* is_busy_to_string(stringStream* ss);
6975
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
   231
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   232
  intptr_t  is_entered(Thread* current) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   233
489c9b5090e2 Initial load
duke
parents:
diff changeset
   234
  void*     owner() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   235
  void      set_owner(void* owner);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   236
27165
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
   237
  jint      waiters() const;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   238
27165
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
   239
  jint      contentions() const;
59156
14fa9e70ae71 8230876: baseline cleanups from Async Monitor Deflation v2.0[789]
dcubed
parents: 58488
diff changeset
   240
  intx      recursions() const                                         { return _recursions; }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   241
27165
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
   242
  // JVM/TI GetObjectMonitorUsage() needs this:
6975
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
   243
  ObjectWaiter* first_waiter()                                         { return _WaitSet; }
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
   244
  ObjectWaiter* next_waiter(ObjectWaiter* o)                           { return o->_next; }
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
   245
  Thread* thread_of_waiter(ObjectWaiter* o)                            { return o->_thread; }
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
   246
27165
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
   247
 protected:
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
   248
  // We don't typically expect or want the ctors or dtors to run.
785a8d56024c 8049737: Contended Locking reorder and cache line bucket
dcubed
parents: 26684
diff changeset
   249
  // normal ObjectMonitors are type-stable and immortal.
57906
e17f768b3b71 8230184: rename, whitespace, indent and comments changes in preparation for lock free Monitor lists
dcubed
parents: 57811
diff changeset
   250
  ObjectMonitor() { ::memset((void*)this, 0, sizeof(*this)); }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   251
6975
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
   252
  ~ObjectMonitor() {
26683
a02753d5a0b2 8057107: cleanup indent white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 25633
diff changeset
   253
    // TODO: Add asserts ...
a02753d5a0b2 8057107: cleanup indent white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 25633
diff changeset
   254
    // _cxq == 0 _succ == NULL _owner == NULL _waiters == 0
54609
04857e2cd509 8222295: more baseline cleanups from Async Monitor Deflation project
dcubed
parents: 53557
diff changeset
   255
    // _contentions == 0 _EntryList  == NULL etc
6975
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
   256
  }
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
   257
26683
a02753d5a0b2 8057107: cleanup indent white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 25633
diff changeset
   258
 private:
25064
244218e6ec0a 8046758: cleanup non-indent white space issues prior to Contended Locking cleanup bucket
dcubed
parents: 22551
diff changeset
   259
  void Recycle() {
6975
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
   260
    // TODO: add stronger asserts ...
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
   261
    // _cxq == 0 _succ == NULL _owner == NULL _waiters == 0
54609
04857e2cd509 8222295: more baseline cleanups from Async Monitor Deflation project
dcubed
parents: 53557
diff changeset
   262
    // _contentions == 0 EntryList  == NULL
6975
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
   263
    // _recursions == 0 _WaitSet == NULL
55345
492b644bb9c2 8225453: is_busy diagnostics and other baseline cleanups from Async Monitor Deflation project
dcubed
parents: 54807
diff changeset
   264
    DEBUG_ONLY(stringStream ss;)
492b644bb9c2 8225453: is_busy diagnostics and other baseline cleanups from Async Monitor Deflation project
dcubed
parents: 54807
diff changeset
   265
    assert((is_busy() | _recursions) == 0, "freeing in-use monitor: %s, "
59156
14fa9e70ae71 8230876: baseline cleanups from Async Monitor Deflation v2.0[789]
dcubed
parents: 58488
diff changeset
   266
           "recursions=" INTX_FORMAT, is_busy_to_string(&ss), _recursions);
25064
244218e6ec0a 8046758: cleanup non-indent white space issues prior to Contended Locking cleanup bucket
dcubed
parents: 22551
diff changeset
   267
    _succ          = NULL;
244218e6ec0a 8046758: cleanup non-indent white space issues prior to Contended Locking cleanup bucket
dcubed
parents: 22551
diff changeset
   268
    _EntryList     = NULL;
244218e6ec0a 8046758: cleanup non-indent white space issues prior to Contended Locking cleanup bucket
dcubed
parents: 22551
diff changeset
   269
    _cxq           = NULL;
244218e6ec0a 8046758: cleanup non-indent white space issues prior to Contended Locking cleanup bucket
dcubed
parents: 22551
diff changeset
   270
    _WaitSet       = NULL;
244218e6ec0a 8046758: cleanup non-indent white space issues prior to Contended Locking cleanup bucket
dcubed
parents: 22551
diff changeset
   271
    _recursions    = 0;
6975
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
   272
  }
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
   273
26683
a02753d5a0b2 8057107: cleanup indent white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 25633
diff changeset
   274
 public:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   275
489c9b5090e2 Initial load
duke
parents:
diff changeset
   276
  void*     object() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   277
  void*     object_addr();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   278
  void      set_object(void* obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   279
57734
18f4d3d46d54 8229212: clear up CHECK_OWNER confusion in objectMonitor.cpp
dcubed
parents: 55345
diff changeset
   280
  // Returns true if the specified thread owns the ObjectMonitor. Otherwise
18f4d3d46d54 8229212: clear up CHECK_OWNER confusion in objectMonitor.cpp
dcubed
parents: 55345
diff changeset
   281
  // returns false and throws IllegalMonitorStateException (IMSE).
18f4d3d46d54 8229212: clear up CHECK_OWNER confusion in objectMonitor.cpp
dcubed
parents: 55345
diff changeset
   282
  bool      check_owner(Thread* THREAD);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   283
  void      clear();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   284
489c9b5090e2 Initial load
duke
parents:
diff changeset
   285
  void      enter(TRAPS);
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents: 17376
diff changeset
   286
  void      exit(bool not_suspended, TRAPS);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   287
  void      wait(jlong millis, bool interruptable, TRAPS);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   288
  void      notify(TRAPS);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   289
  void      notifyAll(TRAPS);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   290
54807
33fe50b6d707 8223626: move print() functions to cpp files
coleenp
parents: 54732
diff changeset
   291
  void      print() const;
59156
14fa9e70ae71 8230876: baseline cleanups from Async Monitor Deflation v2.0[789]
dcubed
parents: 58488
diff changeset
   292
#ifdef ASSERT
14fa9e70ae71 8230876: baseline cleanups from Async Monitor Deflation v2.0[789]
dcubed
parents: 58488
diff changeset
   293
  void      print_debug_style_on(outputStream* st) const;
14fa9e70ae71 8230876: baseline cleanups from Async Monitor Deflation v2.0[789]
dcubed
parents: 58488
diff changeset
   294
#endif
54725
bfa52d3068f5 8222893: markOopDesc::print_on() is a bit confused
coleenp
parents: 54609
diff changeset
   295
  void      print_on(outputStream* st) const;
bfa52d3068f5 8222893: markOopDesc::print_on() is a bit confused
coleenp
parents: 54609
diff changeset
   296
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   297
// Use the following at your own risk
59156
14fa9e70ae71 8230876: baseline cleanups from Async Monitor Deflation v2.0[789]
dcubed
parents: 58488
diff changeset
   298
  intx      complete_exit(TRAPS);
14fa9e70ae71 8230876: baseline cleanups from Async Monitor Deflation v2.0[789]
dcubed
parents: 58488
diff changeset
   299
  void      reenter(intx recursions, TRAPS);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   300
489c9b5090e2 Initial load
duke
parents:
diff changeset
   301
 private:
57906
e17f768b3b71 8230184: rename, whitespace, indent and comments changes in preparation for lock free Monitor lists
dcubed
parents: 57811
diff changeset
   302
  void      AddWaiter(ObjectWaiter* waiter);
e17f768b3b71 8230184: rename, whitespace, indent and comments changes in preparation for lock free Monitor lists
dcubed
parents: 57811
diff changeset
   303
  void      INotify(Thread* self);
e17f768b3b71 8230184: rename, whitespace, indent and comments changes in preparation for lock free Monitor lists
dcubed
parents: 57811
diff changeset
   304
  ObjectWaiter* DequeueWaiter();
e17f768b3b71 8230184: rename, whitespace, indent and comments changes in preparation for lock free Monitor lists
dcubed
parents: 57811
diff changeset
   305
  void      DequeueSpecificWaiter(ObjectWaiter* waiter);
25064
244218e6ec0a 8046758: cleanup non-indent white space issues prior to Contended Locking cleanup bucket
dcubed
parents: 22551
diff changeset
   306
  void      EnterI(TRAPS);
57906
e17f768b3b71 8230184: rename, whitespace, indent and comments changes in preparation for lock free Monitor lists
dcubed
parents: 57811
diff changeset
   307
  void      ReenterI(Thread* self, ObjectWaiter* self_node);
e17f768b3b71 8230184: rename, whitespace, indent and comments changes in preparation for lock free Monitor lists
dcubed
parents: 57811
diff changeset
   308
  void      UnlinkAfterAcquire(Thread* self, ObjectWaiter* self_node);
e17f768b3b71 8230184: rename, whitespace, indent and comments changes in preparation for lock free Monitor lists
dcubed
parents: 57811
diff changeset
   309
  int       TryLock(Thread* self);
e17f768b3b71 8230184: rename, whitespace, indent and comments changes in preparation for lock free Monitor lists
dcubed
parents: 57811
diff changeset
   310
  int       NotRunnable(Thread* self, Thread * Owner);
e17f768b3b71 8230184: rename, whitespace, indent and comments changes in preparation for lock free Monitor lists
dcubed
parents: 57811
diff changeset
   311
  int       TrySpin(Thread* self);
e17f768b3b71 8230184: rename, whitespace, indent and comments changes in preparation for lock free Monitor lists
dcubed
parents: 57811
diff changeset
   312
  void      ExitEpilog(Thread* self, ObjectWaiter* Wakee);
e17f768b3b71 8230184: rename, whitespace, indent and comments changes in preparation for lock free Monitor lists
dcubed
parents: 57811
diff changeset
   313
  bool      ExitSuspendEquivalent(JavaThread* self);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   314
};
6975
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
   315
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 51960
diff changeset
   316
#endif // SHARE_RUNTIME_OBJECTMONITOR_HPP