hotspot/src/share/vm/runtime/objectMonitor.hpp
author dcubed
Wed, 10 Sep 2014 11:52:16 -0600
changeset 26684 d1221849ea3d
parent 26683 a02753d5a0b2
child 27165 785a8d56024c
permissions -rw-r--r--
8057109: manual cleanup of white space issues prior to Contended Locking reorder and cache line bucket Reviewed-by: fparain, sspitsyn, coleenp
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
25472
381638db28e6 8047104: cleanup misc issues prior to Contended Locking reorder and cache
dcubed
parents: 25064
diff changeset
     2
 * Copyright (c) 1998, 2014, 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
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6975
diff changeset
    25
#ifndef SHARE_VM_RUNTIME_OBJECTMONITOR_HPP
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6975
diff changeset
    26
#define SHARE_VM_RUNTIME_OBJECTMONITOR_HPP
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6975
diff changeset
    27
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6975
diff changeset
    28
#include "runtime/os.hpp"
7408
c04a5c989f26 7003125: precompiled.hpp is included when precompiled headers are not used
stefank
parents: 7397
diff changeset
    29
#include "runtime/park.hpp"
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6975
diff changeset
    30
#include "runtime/perfData.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6975
diff changeset
    31
6975
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
    32
// ObjectWaiter serves as a "proxy" or surrogate thread.
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
    33
// TODO-FIXME: Eliminate ObjectWaiter and use the thread-specific
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
    34
// ParkEvent instead.  Beware, however, that the JVMTI code
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
    35
// knows about ObjectWaiters, so we'll have to reconcile that code.
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
    36
// See next_waiter(), first_waiter(), etc.
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
    37
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
    38
class ObjectWaiter : public StackObj {
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
    39
 public:
25064
244218e6ec0a 8046758: cleanup non-indent white space issues prior to Contended Locking cleanup bucket
dcubed
parents: 22551
diff changeset
    40
  enum TStates { TS_UNDEF, TS_READY, TS_RUN, TS_WAIT, TS_ENTER, TS_CXQ };
244218e6ec0a 8046758: cleanup non-indent white space issues prior to Contended Locking cleanup bucket
dcubed
parents: 22551
diff changeset
    41
  enum Sorted  { PREPEND, APPEND, SORTED };
6975
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
    42
  ObjectWaiter * volatile _next;
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
    43
  ObjectWaiter * volatile _prev;
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
    44
  Thread*       _thread;
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents: 17376
diff changeset
    45
  jlong         _notifier_tid;
6975
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
    46
  ParkEvent *   _event;
25064
244218e6ec0a 8046758: cleanup non-indent white space issues prior to Contended Locking cleanup bucket
dcubed
parents: 22551
diff changeset
    47
  volatile int  _notified;
244218e6ec0a 8046758: cleanup non-indent white space issues prior to Contended Locking cleanup bucket
dcubed
parents: 22551
diff changeset
    48
  volatile TStates TState;
244218e6ec0a 8046758: cleanup non-indent white space issues prior to Contended Locking cleanup bucket
dcubed
parents: 22551
diff changeset
    49
  Sorted        _Sorted;           // List placement disposition
244218e6ec0a 8046758: cleanup non-indent white space issues prior to Contended Locking cleanup bucket
dcubed
parents: 22551
diff changeset
    50
  bool          _active;           // Contention monitoring is enabled
6975
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
    51
 public:
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
    52
  ObjectWaiter(Thread* thread);
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
    53
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
    54
  void wait_reenter_begin(ObjectMonitor *mon);
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
    55
  void wait_reenter_end(ObjectMonitor *mon);
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
    56
};
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
    57
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents: 17376
diff changeset
    58
// forward declaration to avoid include tracing.hpp
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents: 17376
diff changeset
    59
class EventJavaMonitorWait;
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents: 17376
diff changeset
    60
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
// WARNING:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
//   This is a very sensitive and fragile class. DO NOT make any
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
// change unless you are fully aware of the underlying semantics.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
//   This class can not inherit from any other class, because I have
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
// to let the displaced header be the very first word. Otherwise I
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
// have to let markOop include this file, which would export the
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
// monitor data structure to everywhere.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
// The ObjectMonitor class is used to implement JavaMonitors which have
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
// transformed from the lightweight structure of the thread stack to a
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
// heavy weight lock due to contention
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
// It is also used as RawMonitor by the JVMTI
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
class ObjectMonitor {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
  enum {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
    OM_OK,                    // no error
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
    OM_SYSTEM_ERROR,          // operating system error
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
    OM_ILLEGAL_MONITOR_STATE, // IllegalMonitorStateException
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
    OM_INTERRUPTED,           // Thread.interrupt()
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
    OM_TIMED_OUT              // Object.wait() timed out
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
  };
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
  // TODO-FIXME: the "offset" routines should return a type of off_t instead of int ...
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
  // 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
    90
  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
    91
  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
    92
  static int owner_offset_in_bytes()       { return offset_of(ObjectMonitor, _owner); }
d1221849ea3d 8057109: manual cleanup of white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 26683
diff changeset
    93
  static int count_offset_in_bytes()       { return offset_of(ObjectMonitor, _count); }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
  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
    95
  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
    96
  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
    97
  static int EntryList_offset_in_bytes()   { return offset_of(ObjectMonitor, _EntryList); }
d1221849ea3d 8057109: manual cleanup of white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 26683
diff changeset
    98
  static int FreeNext_offset_in_bytes()    { return offset_of(ObjectMonitor, FreeNext); }
d1221849ea3d 8057109: manual cleanup of white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 26683
diff changeset
    99
  static int WaitSet_offset_in_bytes()     { return offset_of(ObjectMonitor, _WaitSet); }
25064
244218e6ec0a 8046758: cleanup non-indent white space issues prior to Contended Locking cleanup bucket
dcubed
parents: 22551
diff changeset
   100
  static int Responsible_offset_in_bytes() { return offset_of(ObjectMonitor, _Responsible); }
26684
d1221849ea3d 8057109: manual cleanup of white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 26683
diff changeset
   101
  static int Spinner_offset_in_bytes()     { return offset_of(ObjectMonitor, _Spinner); }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
 public:
22551
9bf46d16dcc6 8025856: Fix typos in the GC code
jwilhelm
parents: 19696
diff changeset
   104
  // Eventually we'll make provisions for multiple callbacks, but
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
  // now one will suffice.
25064
244218e6ec0a 8046758: cleanup non-indent white space issues prior to Contended Locking cleanup bucket
dcubed
parents: 22551
diff changeset
   106
  static int (*SpinCallbackFunction)(intptr_t, int);
244218e6ec0a 8046758: cleanup non-indent white space issues prior to Contended Locking cleanup bucket
dcubed
parents: 22551
diff changeset
   107
  static intptr_t SpinCallbackArgument;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
  markOop   header() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
  void      set_header(markOop hdr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
6975
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
   114
  intptr_t is_busy() const {
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
   115
    // TODO-FIXME: merge _count and _waiters.
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
   116
    // TODO-FIXME: assert _owner == null implies _recursions = 0
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
   117
    // TODO-FIXME: assert _WaitSet != null implies _count > 0
25064
244218e6ec0a 8046758: cleanup non-indent white space issues prior to Contended Locking cleanup bucket
dcubed
parents: 22551
diff changeset
   118
    return _count|_waiters|intptr_t(_owner)|intptr_t(_cxq)|intptr_t(_EntryList);
6975
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
   119
  }
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
   120
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
  intptr_t  is_entered(Thread* current) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
  void*     owner() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
  void      set_owner(void* owner);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
  intptr_t  waiters() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
  intptr_t  count() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
  void      set_count(intptr_t count);
25064
244218e6ec0a 8046758: cleanup non-indent white space issues prior to Contended Locking cleanup bucket
dcubed
parents: 22551
diff changeset
   130
  intptr_t  contentions() const;
6975
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
   131
  intptr_t  recursions() const                                         { return _recursions; }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
  // JVM/DI GetMonitorInfo() needs this
6975
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
   134
  ObjectWaiter* first_waiter()                                         { return _WaitSet; }
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
   135
  ObjectWaiter* next_waiter(ObjectWaiter* o)                           { return o->_next; }
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
   136
  Thread* thread_of_waiter(ObjectWaiter* o)                            { return o->_thread; }
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
   137
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
   138
  // initialize the monitor, exception the semaphore, all other fields
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
   139
  // are simple integers or pointers
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
   140
  ObjectMonitor() {
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
   141
    _header       = NULL;
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
   142
    _count        = 0;
26684
d1221849ea3d 8057109: manual cleanup of white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 26683
diff changeset
   143
    _waiters      = 0;
d1221849ea3d 8057109: manual cleanup of white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 26683
diff changeset
   144
    _recursions   = 0;
6975
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
   145
    _object       = NULL;
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
   146
    _owner        = NULL;
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
   147
    _WaitSet      = NULL;
25064
244218e6ec0a 8046758: cleanup non-indent white space issues prior to Contended Locking cleanup bucket
dcubed
parents: 22551
diff changeset
   148
    _WaitSetLock  = 0;
244218e6ec0a 8046758: cleanup non-indent white space issues prior to Contended Locking cleanup bucket
dcubed
parents: 22551
diff changeset
   149
    _Responsible  = NULL;
244218e6ec0a 8046758: cleanup non-indent white space issues prior to Contended Locking cleanup bucket
dcubed
parents: 22551
diff changeset
   150
    _succ         = NULL;
244218e6ec0a 8046758: cleanup non-indent white space issues prior to Contended Locking cleanup bucket
dcubed
parents: 22551
diff changeset
   151
    _cxq          = NULL;
244218e6ec0a 8046758: cleanup non-indent white space issues prior to Contended Locking cleanup bucket
dcubed
parents: 22551
diff changeset
   152
    FreeNext      = NULL;
244218e6ec0a 8046758: cleanup non-indent white space issues prior to Contended Locking cleanup bucket
dcubed
parents: 22551
diff changeset
   153
    _EntryList    = NULL;
244218e6ec0a 8046758: cleanup non-indent white space issues prior to Contended Locking cleanup bucket
dcubed
parents: 22551
diff changeset
   154
    _SpinFreq     = 0;
244218e6ec0a 8046758: cleanup non-indent white space issues prior to Contended Locking cleanup bucket
dcubed
parents: 22551
diff changeset
   155
    _SpinClock    = 0;
244218e6ec0a 8046758: cleanup non-indent white space issues prior to Contended Locking cleanup bucket
dcubed
parents: 22551
diff changeset
   156
    OwnerIsThread = 0;
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents: 17376
diff changeset
   157
    _previous_owner_tid = 0;
6975
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
   158
  }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
6975
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
   160
  ~ObjectMonitor() {
26683
a02753d5a0b2 8057107: cleanup indent white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 25633
diff changeset
   161
    // TODO: Add asserts ...
a02753d5a0b2 8057107: cleanup indent white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 25633
diff changeset
   162
    // _cxq == 0 _succ == NULL _owner == NULL _waiters == 0
a02753d5a0b2 8057107: cleanup indent white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 25633
diff changeset
   163
    // _count == 0 _EntryList  == NULL etc
6975
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
   164
  }
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
   165
26683
a02753d5a0b2 8057107: cleanup indent white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 25633
diff changeset
   166
 private:
25064
244218e6ec0a 8046758: cleanup non-indent white space issues prior to Contended Locking cleanup bucket
dcubed
parents: 22551
diff changeset
   167
  void Recycle() {
6975
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
   168
    // TODO: add stronger asserts ...
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
   169
    // _cxq == 0 _succ == NULL _owner == NULL _waiters == 0
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
   170
    // _count == 0 EntryList  == NULL
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
   171
    // _recursions == 0 _WaitSet == NULL
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
   172
    // TODO: assert (is_busy()|_recursions) == 0
25064
244218e6ec0a 8046758: cleanup non-indent white space issues prior to Contended Locking cleanup bucket
dcubed
parents: 22551
diff changeset
   173
    _succ          = NULL;
244218e6ec0a 8046758: cleanup non-indent white space issues prior to Contended Locking cleanup bucket
dcubed
parents: 22551
diff changeset
   174
    _EntryList     = NULL;
244218e6ec0a 8046758: cleanup non-indent white space issues prior to Contended Locking cleanup bucket
dcubed
parents: 22551
diff changeset
   175
    _cxq           = NULL;
244218e6ec0a 8046758: cleanup non-indent white space issues prior to Contended Locking cleanup bucket
dcubed
parents: 22551
diff changeset
   176
    _WaitSet       = NULL;
244218e6ec0a 8046758: cleanup non-indent white space issues prior to Contended Locking cleanup bucket
dcubed
parents: 22551
diff changeset
   177
    _recursions    = 0;
244218e6ec0a 8046758: cleanup non-indent white space issues prior to Contended Locking cleanup bucket
dcubed
parents: 22551
diff changeset
   178
    _SpinFreq      = 0;
244218e6ec0a 8046758: cleanup non-indent white space issues prior to Contended Locking cleanup bucket
dcubed
parents: 22551
diff changeset
   179
    _SpinClock     = 0;
244218e6ec0a 8046758: cleanup non-indent white space issues prior to Contended Locking cleanup bucket
dcubed
parents: 22551
diff changeset
   180
    OwnerIsThread  = 0;
6975
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
   181
  }
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
   182
26683
a02753d5a0b2 8057107: cleanup indent white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 25633
diff changeset
   183
 public:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
489c9b5090e2 Initial load
duke
parents:
diff changeset
   185
  void*     object() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   186
  void*     object_addr();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   187
  void      set_object(void* obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   188
489c9b5090e2 Initial load
duke
parents:
diff changeset
   189
  bool      check(TRAPS);       // true if the thread owns the monitor.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   190
  void      check_slow(TRAPS);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   191
  void      clear();
25633
4cd9c4622c8c 8049717: expose L1_data_cache_line_size for diagnostic/sanity checks
dcubed
parents: 25472
diff changeset
   192
  static void sanity_checks();  // public for -XX:+ExecuteInternalVMTests
4cd9c4622c8c 8049717: expose L1_data_cache_line_size for diagnostic/sanity checks
dcubed
parents: 25472
diff changeset
   193
                                // in PRODUCT for -XX:SyncKnobs=Verbose=1
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
  void      verify();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
  void      print();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
25064
244218e6ec0a 8046758: cleanup non-indent white space issues prior to Contended Locking cleanup bucket
dcubed
parents: 22551
diff changeset
   199
  bool      try_enter(TRAPS);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   200
  void      enter(TRAPS);
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents: 17376
diff changeset
   201
  void      exit(bool not_suspended, TRAPS);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   202
  void      wait(jlong millis, bool interruptable, TRAPS);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   203
  void      notify(TRAPS);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   204
  void      notifyAll(TRAPS);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   205
489c9b5090e2 Initial load
duke
parents:
diff changeset
   206
// Use the following at your own risk
489c9b5090e2 Initial load
duke
parents:
diff changeset
   207
  intptr_t  complete_exit(TRAPS);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   208
  void      reenter(intptr_t recursions, TRAPS);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   209
489c9b5090e2 Initial load
duke
parents:
diff changeset
   210
 private:
25064
244218e6ec0a 8046758: cleanup non-indent white space issues prior to Contended Locking cleanup bucket
dcubed
parents: 22551
diff changeset
   211
  void      AddWaiter(ObjectWaiter * waiter);
6975
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
   212
  static    void DeferredInitialize();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   213
25064
244218e6ec0a 8046758: cleanup non-indent white space issues prior to Contended Locking cleanup bucket
dcubed
parents: 22551
diff changeset
   214
  ObjectWaiter * DequeueWaiter();
244218e6ec0a 8046758: cleanup non-indent white space issues prior to Contended Locking cleanup bucket
dcubed
parents: 22551
diff changeset
   215
  void      DequeueSpecificWaiter(ObjectWaiter * waiter);
244218e6ec0a 8046758: cleanup non-indent white space issues prior to Contended Locking cleanup bucket
dcubed
parents: 22551
diff changeset
   216
  void      EnterI(TRAPS);
244218e6ec0a 8046758: cleanup non-indent white space issues prior to Contended Locking cleanup bucket
dcubed
parents: 22551
diff changeset
   217
  void      ReenterI(Thread * Self, ObjectWaiter * SelfNode);
244218e6ec0a 8046758: cleanup non-indent white space issues prior to Contended Locking cleanup bucket
dcubed
parents: 22551
diff changeset
   218
  void      UnlinkAfterAcquire(Thread * Self, ObjectWaiter * SelfNode);
244218e6ec0a 8046758: cleanup non-indent white space issues prior to Contended Locking cleanup bucket
dcubed
parents: 22551
diff changeset
   219
  int       TryLock(Thread * Self);
244218e6ec0a 8046758: cleanup non-indent white space issues prior to Contended Locking cleanup bucket
dcubed
parents: 22551
diff changeset
   220
  int       NotRunnable(Thread * Self, Thread * Owner);
244218e6ec0a 8046758: cleanup non-indent white space issues prior to Contended Locking cleanup bucket
dcubed
parents: 22551
diff changeset
   221
  int       TrySpin_Fixed(Thread * Self);
244218e6ec0a 8046758: cleanup non-indent white space issues prior to Contended Locking cleanup bucket
dcubed
parents: 22551
diff changeset
   222
  int       TrySpin_VaryFrequency(Thread * Self);
244218e6ec0a 8046758: cleanup non-indent white space issues prior to Contended Locking cleanup bucket
dcubed
parents: 22551
diff changeset
   223
  int       TrySpin_VaryDuration(Thread * Self);
244218e6ec0a 8046758: cleanup non-indent white space issues prior to Contended Locking cleanup bucket
dcubed
parents: 22551
diff changeset
   224
  void      ctAsserts();
244218e6ec0a 8046758: cleanup non-indent white space issues prior to Contended Locking cleanup bucket
dcubed
parents: 22551
diff changeset
   225
  void      ExitEpilog(Thread * Self, ObjectWaiter * Wakee);
244218e6ec0a 8046758: cleanup non-indent white space issues prior to Contended Locking cleanup bucket
dcubed
parents: 22551
diff changeset
   226
  bool      ExitSuspendEquivalent(JavaThread * Self);
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents: 17376
diff changeset
   227
  void      post_monitor_wait_event(EventJavaMonitorWait * event,
26683
a02753d5a0b2 8057107: cleanup indent white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 25633
diff changeset
   228
                                    jlong notifier_tid,
a02753d5a0b2 8057107: cleanup indent white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 25633
diff changeset
   229
                                    jlong timeout,
a02753d5a0b2 8057107: cleanup indent white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 25633
diff changeset
   230
                                    bool timedout);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   231
489c9b5090e2 Initial load
duke
parents:
diff changeset
   232
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   233
  friend class ObjectSynchronizer;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   234
  friend class ObjectWaiter;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   235
  friend class VMStructs;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   236
489c9b5090e2 Initial load
duke
parents:
diff changeset
   237
  // WARNING: this must be the very first word of ObjectMonitor
489c9b5090e2 Initial load
duke
parents:
diff changeset
   238
  // This means this class can't use any virtual member functions.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   239
489c9b5090e2 Initial load
duke
parents:
diff changeset
   240
  volatile markOop   _header;       // displaced object header word - mark
489c9b5090e2 Initial load
duke
parents:
diff changeset
   241
  void*     volatile _object;       // backward object pointer - strong root
489c9b5090e2 Initial load
duke
parents:
diff changeset
   242
26684
d1221849ea3d 8057109: manual cleanup of white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 26683
diff changeset
   243
  double SharingPad[1];             // temp to reduce false sharing
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   244
489c9b5090e2 Initial load
duke
parents:
diff changeset
   245
  // All the following fields must be machine word aligned
489c9b5090e2 Initial load
duke
parents:
diff changeset
   246
  // The VM assumes write ordering wrt these fields, which can be
489c9b5090e2 Initial load
duke
parents:
diff changeset
   247
  // read from other threads.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   248
6975
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
   249
 protected:                         // protected for jvmtiRawMonitor
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   250
  void *  volatile _owner;          // pointer to owning thread OR BasicLock
26684
d1221849ea3d 8057109: manual cleanup of white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 26683
diff changeset
   251
  volatile jlong _previous_owner_tid;  // thread id of the previous owner of the monitor
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   252
  volatile intptr_t  _recursions;   // recursion count, 0 for first entry
6975
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
   253
 private:
26684
d1221849ea3d 8057109: manual cleanup of white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 26683
diff changeset
   254
  int OwnerIsThread;                // _owner is (Thread *) vs SP/BasicLock
d1221849ea3d 8057109: manual cleanup of white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 26683
diff changeset
   255
  ObjectWaiter * volatile _cxq;     // LL of recently-arrived threads blocked on entry.
d1221849ea3d 8057109: manual cleanup of white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 26683
diff changeset
   256
                                    // The list is actually composed of WaitNodes, acting
d1221849ea3d 8057109: manual cleanup of white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 26683
diff changeset
   257
                                    // as proxies for Threads.
6975
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
   258
 protected:
26684
d1221849ea3d 8057109: manual cleanup of white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 26683
diff changeset
   259
  ObjectWaiter * volatile _EntryList;  // Threads blocked on entry or reentry.
6975
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
   260
 private:
25064
244218e6ec0a 8046758: cleanup non-indent white space issues prior to Contended Locking cleanup bucket
dcubed
parents: 22551
diff changeset
   261
  Thread * volatile _succ;          // Heir presumptive thread - used for futile wakeup throttling
244218e6ec0a 8046758: cleanup non-indent white space issues prior to Contended Locking cleanup bucket
dcubed
parents: 22551
diff changeset
   262
  Thread * volatile _Responsible;
26684
d1221849ea3d 8057109: manual cleanup of white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 26683
diff changeset
   263
  int _PromptDrain;                 // rqst to drain cxq into EntryList ASAP
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   264
26684
d1221849ea3d 8057109: manual cleanup of white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 26683
diff changeset
   265
  volatile int _Spinner;            // for exit->spinner handoff optimization
d1221849ea3d 8057109: manual cleanup of white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 26683
diff changeset
   266
  volatile int _SpinFreq;           // Spin 1-out-of-N attempts: success rate
25064
244218e6ec0a 8046758: cleanup non-indent white space issues prior to Contended Locking cleanup bucket
dcubed
parents: 22551
diff changeset
   267
  volatile int _SpinClock;
244218e6ec0a 8046758: cleanup non-indent white space issues prior to Contended Locking cleanup bucket
dcubed
parents: 22551
diff changeset
   268
  volatile int _SpinDuration;
26684
d1221849ea3d 8057109: manual cleanup of white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 26683
diff changeset
   269
  volatile intptr_t _SpinState;     // MCS/CLH list of spinners
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   270
489c9b5090e2 Initial load
duke
parents:
diff changeset
   271
  // TODO-FIXME: _count, _waiters and _recursions should be of
489c9b5090e2 Initial load
duke
parents:
diff changeset
   272
  // type int, or int32_t but not intptr_t.  There's no reason
489c9b5090e2 Initial load
duke
parents:
diff changeset
   273
  // to use 64-bit fields for these variables on a 64-bit JVM.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   274
22551
9bf46d16dcc6 8025856: Fix typos in the GC code
jwilhelm
parents: 19696
diff changeset
   275
  volatile intptr_t  _count;        // reference count to prevent reclamation/deflation
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   276
                                    // at stop-the-world time.  See deflate_idle_monitors().
489c9b5090e2 Initial load
duke
parents:
diff changeset
   277
                                    // _count is approximately |_WaitSet| + |_EntryList|
6975
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
   278
 protected:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   279
  volatile intptr_t  _waiters;      // number of waiting threads
6975
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
   280
 private:
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
   281
 protected:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   282
  ObjectWaiter * volatile _WaitSet; // LL of threads wait()ing on the monitor
6975
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
   283
 private:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   284
  volatile int _WaitSetLock;        // protects Wait Queue - simple spinlock
489c9b5090e2 Initial load
duke
parents:
diff changeset
   285
489c9b5090e2 Initial load
duke
parents:
diff changeset
   286
 public:
26684
d1221849ea3d 8057109: manual cleanup of white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 26683
diff changeset
   287
  int _QMix;                        // Mixed prepend queue discipline
d1221849ea3d 8057109: manual cleanup of white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 26683
diff changeset
   288
  ObjectMonitor * FreeNext;         // Free list linkage
25064
244218e6ec0a 8046758: cleanup non-indent white space issues prior to Contended Locking cleanup bucket
dcubed
parents: 22551
diff changeset
   289
  intptr_t StatA, StatsB;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   290
6975
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
   291
 public:
25064
244218e6ec0a 8046758: cleanup non-indent white space issues prior to Contended Locking cleanup bucket
dcubed
parents: 22551
diff changeset
   292
  static void Initialize();
244218e6ec0a 8046758: cleanup non-indent white space issues prior to Contended Locking cleanup bucket
dcubed
parents: 22551
diff changeset
   293
  static PerfCounter * _sync_ContendedLockAttempts;
244218e6ec0a 8046758: cleanup non-indent white space issues prior to Contended Locking cleanup bucket
dcubed
parents: 22551
diff changeset
   294
  static PerfCounter * _sync_FutileWakeups;
244218e6ec0a 8046758: cleanup non-indent white space issues prior to Contended Locking cleanup bucket
dcubed
parents: 22551
diff changeset
   295
  static PerfCounter * _sync_Parks;
244218e6ec0a 8046758: cleanup non-indent white space issues prior to Contended Locking cleanup bucket
dcubed
parents: 22551
diff changeset
   296
  static PerfCounter * _sync_EmptyNotifications;
244218e6ec0a 8046758: cleanup non-indent white space issues prior to Contended Locking cleanup bucket
dcubed
parents: 22551
diff changeset
   297
  static PerfCounter * _sync_Notifications;
244218e6ec0a 8046758: cleanup non-indent white space issues prior to Contended Locking cleanup bucket
dcubed
parents: 22551
diff changeset
   298
  static PerfCounter * _sync_SlowEnter;
244218e6ec0a 8046758: cleanup non-indent white space issues prior to Contended Locking cleanup bucket
dcubed
parents: 22551
diff changeset
   299
  static PerfCounter * _sync_SlowExit;
244218e6ec0a 8046758: cleanup non-indent white space issues prior to Contended Locking cleanup bucket
dcubed
parents: 22551
diff changeset
   300
  static PerfCounter * _sync_SlowNotify;
244218e6ec0a 8046758: cleanup non-indent white space issues prior to Contended Locking cleanup bucket
dcubed
parents: 22551
diff changeset
   301
  static PerfCounter * _sync_SlowNotifyAll;
244218e6ec0a 8046758: cleanup non-indent white space issues prior to Contended Locking cleanup bucket
dcubed
parents: 22551
diff changeset
   302
  static PerfCounter * _sync_FailedSpins;
244218e6ec0a 8046758: cleanup non-indent white space issues prior to Contended Locking cleanup bucket
dcubed
parents: 22551
diff changeset
   303
  static PerfCounter * _sync_SuccessfulSpins;
244218e6ec0a 8046758: cleanup non-indent white space issues prior to Contended Locking cleanup bucket
dcubed
parents: 22551
diff changeset
   304
  static PerfCounter * _sync_PrivateA;
244218e6ec0a 8046758: cleanup non-indent white space issues prior to Contended Locking cleanup bucket
dcubed
parents: 22551
diff changeset
   305
  static PerfCounter * _sync_PrivateB;
244218e6ec0a 8046758: cleanup non-indent white space issues prior to Contended Locking cleanup bucket
dcubed
parents: 22551
diff changeset
   306
  static PerfCounter * _sync_MonInCirculation;
244218e6ec0a 8046758: cleanup non-indent white space issues prior to Contended Locking cleanup bucket
dcubed
parents: 22551
diff changeset
   307
  static PerfCounter * _sync_MonScavenged;
244218e6ec0a 8046758: cleanup non-indent white space issues prior to Contended Locking cleanup bucket
dcubed
parents: 22551
diff changeset
   308
  static PerfCounter * _sync_Inflations;
244218e6ec0a 8046758: cleanup non-indent white space issues prior to Contended Locking cleanup bucket
dcubed
parents: 22551
diff changeset
   309
  static PerfCounter * _sync_Deflations;
244218e6ec0a 8046758: cleanup non-indent white space issues prior to Contended Locking cleanup bucket
dcubed
parents: 22551
diff changeset
   310
  static PerfLongVariable * _sync_MonExtant;
6975
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
   311
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
   312
 public:
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
   313
  static int Knob_Verbose;
25472
381638db28e6 8047104: cleanup misc issues prior to Contended Locking reorder and cache
dcubed
parents: 25064
diff changeset
   314
  static int Knob_VerifyInUse;
6975
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
   315
  static int Knob_SpinLimit;
19696
bd5a0131bde1 8021954: VM SIGSEGV during classloading on MacOS; hs_err_pid file produced
coleenp
parents: 18025
diff changeset
   316
  void* operator new (size_t size) throw() {
17376
4ee999c3c007 8012902: remove use of global operator new - take 2
minqi
parents: 7408
diff changeset
   317
    return AllocateHeap(size, mtInternal);
4ee999c3c007 8012902: remove use of global operator new - take 2
minqi
parents: 7408
diff changeset
   318
  }
19696
bd5a0131bde1 8021954: VM SIGSEGV during classloading on MacOS; hs_err_pid file produced
coleenp
parents: 18025
diff changeset
   319
  void* operator new[] (size_t size) throw() {
17376
4ee999c3c007 8012902: remove use of global operator new - take 2
minqi
parents: 7408
diff changeset
   320
    return operator new (size);
4ee999c3c007 8012902: remove use of global operator new - take 2
minqi
parents: 7408
diff changeset
   321
  }
4ee999c3c007 8012902: remove use of global operator new - take 2
minqi
parents: 7408
diff changeset
   322
  void operator delete(void* p) {
4ee999c3c007 8012902: remove use of global operator new - take 2
minqi
parents: 7408
diff changeset
   323
    FreeHeap(p, mtInternal);
4ee999c3c007 8012902: remove use of global operator new - take 2
minqi
parents: 7408
diff changeset
   324
  }
4ee999c3c007 8012902: remove use of global operator new - take 2
minqi
parents: 7408
diff changeset
   325
  void operator delete[] (void *p) {
4ee999c3c007 8012902: remove use of global operator new - take 2
minqi
parents: 7408
diff changeset
   326
    operator delete(p);
4ee999c3c007 8012902: remove use of global operator new - take 2
minqi
parents: 7408
diff changeset
   327
  }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   328
};
6975
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
   329
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
   330
#undef TEVENT
26684
d1221849ea3d 8057109: manual cleanup of white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 26683
diff changeset
   331
#define TEVENT(nom) { if (SyncVerbose) FEVENT(nom); }
6975
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
   332
26684
d1221849ea3d 8057109: manual cleanup of white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 26683
diff changeset
   333
#define FEVENT(nom)                 \
d1221849ea3d 8057109: manual cleanup of white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 26683
diff changeset
   334
  {                                 \
d1221849ea3d 8057109: manual cleanup of white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 26683
diff changeset
   335
    static volatile int ctr = 0;    \
d1221849ea3d 8057109: manual cleanup of white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 26683
diff changeset
   336
    int v = ++ctr;                  \
d1221849ea3d 8057109: manual cleanup of white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 26683
diff changeset
   337
    if ((v & (v - 1)) == 0) {       \
d1221849ea3d 8057109: manual cleanup of white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 26683
diff changeset
   338
      ::printf(#nom " : %d\n", v);  \
d1221849ea3d 8057109: manual cleanup of white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 26683
diff changeset
   339
      ::fflush(stdout);             \
d1221849ea3d 8057109: manual cleanup of white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 26683
diff changeset
   340
    }                               \
d1221849ea3d 8057109: manual cleanup of white space issues prior to Contended Locking reorder and cache line bucket
dcubed
parents: 26683
diff changeset
   341
  }
6975
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
   342
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
   343
#undef  TEVENT
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
   344
#define TEVENT(nom) {;}
dc9b63952682 6988353: refactor contended sync subsystem
acorn
parents: 5547
diff changeset
   345
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6975
diff changeset
   346
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6975
diff changeset
   347
#endif // SHARE_VM_RUNTIME_OBJECTMONITOR_HPP