src/hotspot/share/runtime/biasedLocking.hpp
author chegar
Thu, 17 Oct 2019 20:54:25 +0100
branchdatagramsocketimpl-branch
changeset 58679 9c3209ff7550
parent 58678 9cf78a70fa4f
parent 58226 408c445d04e8
permissions -rw-r--r--
datagramsocketimpl-branch: merge with default
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: 49364
diff changeset
     2
 * Copyright (c) 2005, 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: 49364
diff changeset
    25
#ifndef SHARE_RUNTIME_BIASEDLOCKING_HPP
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 49364
diff changeset
    26
#define SHARE_RUNTIME_BIASEDLOCKING_HPP
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    27
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    28
#include "runtime/handles.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    29
#include "utilities/growableArray.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    30
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    31
// This class describes operations to implement Store-Free Biased
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
// Locking. The high-level properties of the scheme are similar to
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
// IBM's lock reservation, Dice-Moir-Scherer QR locks, and other biased
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
// locking mechanisms. The principal difference is in the handling of
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
// recursive locking which is how this technique achieves a more
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
// efficient fast path than these other schemes.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
// The basic observation is that in HotSpot's current fast locking
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
// scheme, recursive locking (in the fast path) causes no update to
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
// the object header. The recursion is described simply by stack
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
// records containing a specific value (NULL). Only the last unlock by
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
// a given thread causes an update to the object header.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
// This observation, coupled with the fact that HotSpot only compiles
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
// methods for which monitor matching is obeyed (and which therefore
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
// can not throw IllegalMonitorStateException), implies that we can
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
// completely eliminate modifications to the object header for
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
// recursive locking in compiled code, and perform similar recursion
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
// checks and throwing of IllegalMonitorStateException in the
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
// interpreter with little or no impact on the performance of the fast
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
// path.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
// The basic algorithm is as follows (note, see below for more details
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
// and information). A pattern in the low three bits is reserved in
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
// the object header to indicate whether biasing of a given object's
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
// lock is currently being done or is allowed at all.  If the bias
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
// pattern is present, the contents of the rest of the header are
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
// either the JavaThread* of the thread to which the lock is biased,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
// or NULL, indicating that the lock is "anonymously biased". The
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
// first thread which locks an anonymously biased object biases the
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
// lock toward that thread. If another thread subsequently attempts to
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
// lock the same object, the bias is revoked.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
// Because there are no updates to the object header at all during
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
// recursive locking while the lock is biased, the biased lock entry
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
// code is simply a test of the object header's value. If this test
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
// succeeds, the lock has been acquired by the thread. If this test
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
// fails, a bit test is done to see whether the bias bit is still
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
// set. If not, we fall back to HotSpot's original CAS-based locking
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
// scheme. If it is set, we attempt to CAS in a bias toward this
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
// thread. The latter operation is expected to be the rarest operation
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
// performed on these locks. We optimistically expect the biased lock
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
// entry to hit most of the time, and want the CAS-based fallthrough
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
// to occur quickly in the situations where the bias has been revoked.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
// Revocation of the lock's bias is fairly straightforward. We want to
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
// restore the object's header and stack-based BasicObjectLocks and
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
// BasicLocks to the state they would have been in had the object been
55625
f7e8dbb77156 8191890: Biased locking still uses the inferior stop the world safepoint for revocation
pchilanomate
parents: 55479
diff changeset
    79
// locked by HotSpot's usual fast locking scheme. To do this, we execute
f7e8dbb77156 8191890: Biased locking still uses the inferior stop the world safepoint for revocation
pchilanomate
parents: 55479
diff changeset
    80
// a handshake with the JavaThread that biased the lock. Inside the
f7e8dbb77156 8191890: Biased locking still uses the inferior stop the world safepoint for revocation
pchilanomate
parents: 55479
diff changeset
    81
// handshake we walk the biaser stack searching for all of the lock
f7e8dbb77156 8191890: Biased locking still uses the inferior stop the world safepoint for revocation
pchilanomate
parents: 55479
diff changeset
    82
// records corresponding to this object, in particular the first / "highest"
f7e8dbb77156 8191890: Biased locking still uses the inferior stop the world safepoint for revocation
pchilanomate
parents: 55479
diff changeset
    83
// record. We fill in the highest lock record with the object's displaced
f7e8dbb77156 8191890: Biased locking still uses the inferior stop the world safepoint for revocation
pchilanomate
parents: 55479
diff changeset
    84
// header (which is a well-known value given that we don't maintain an
f7e8dbb77156 8191890: Biased locking still uses the inferior stop the world safepoint for revocation
pchilanomate
parents: 55479
diff changeset
    85
// identity hash nor age bits for the object while it's in the biased
f7e8dbb77156 8191890: Biased locking still uses the inferior stop the world safepoint for revocation
pchilanomate
parents: 55479
diff changeset
    86
// state) and all other lock records with 0, the value for recursive locks.
f7e8dbb77156 8191890: Biased locking still uses the inferior stop the world safepoint for revocation
pchilanomate
parents: 55479
diff changeset
    87
// Alternatively, we can revoke the bias of an object inside a safepoint
f7e8dbb77156 8191890: Biased locking still uses the inferior stop the world safepoint for revocation
pchilanomate
parents: 55479
diff changeset
    88
// if we are already in one and we detect that we need to perform a
f7e8dbb77156 8191890: Biased locking still uses the inferior stop the world safepoint for revocation
pchilanomate
parents: 55479
diff changeset
    89
// revocation.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
// This scheme can not handle transfers of biases of single objects
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
// from thread to thread efficiently, but it can handle bulk transfers
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
// of such biases, which is a usage pattern showing up in some
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
// applications and benchmarks. We implement "bulk rebias" and "bulk
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
// revoke" operations using a "bias epoch" on a per-data-type basis.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
// If too many bias revocations are occurring for a particular data
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
// type, the bias epoch for the data type is incremented at a
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
// safepoint, effectively meaning that all previous biases are
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
// invalid. The fast path locking case checks for an invalid epoch in
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
// the object header and attempts to rebias the object with a CAS if
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
// found, avoiding safepoints or bulk heap sweeps (the latter which
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
// was used in a prior version of this algorithm and did not scale
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
// well). If too many bias revocations persist, biasing is completely
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
// disabled for the data type by resetting the prototype header to the
57777
90ead0febf56 8229258: Rework markOop and markOopDesc into a simpler mark word value carrier
stefank
parents: 55625
diff changeset
   105
// unbiased markWord. The fast-path locking code checks to see whether
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
// the instance's bias pattern differs from the prototype header's and
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
// causes the bias to be revoked without reaching a safepoint or,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
// again, a bulk heap sweep.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
// Biased locking counters
49364
601146c66cad 8173070: Remove ValueObj class for allocation subclassing for runtime code
coleenp
parents: 47216
diff changeset
   111
class BiasedLockingCounters {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
  int _total_entry_count;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
  int _biased_lock_entry_count;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
  int _anonymously_biased_lock_entry_count;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
  int _rebiased_lock_entry_count;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
  int _revoked_lock_entry_count;
55625
f7e8dbb77156 8191890: Biased locking still uses the inferior stop the world safepoint for revocation
pchilanomate
parents: 55479
diff changeset
   118
  int _handshakes_count;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
  int _fast_path_entry_count;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
  int _slow_path_entry_count;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
  BiasedLockingCounters() :
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
    _total_entry_count(0),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
    _biased_lock_entry_count(0),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
    _anonymously_biased_lock_entry_count(0),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
    _rebiased_lock_entry_count(0),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
    _revoked_lock_entry_count(0),
55625
f7e8dbb77156 8191890: Biased locking still uses the inferior stop the world safepoint for revocation
pchilanomate
parents: 55479
diff changeset
   129
    _handshakes_count(0),
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
    _fast_path_entry_count(0),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
    _slow_path_entry_count(0) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
54807
33fe50b6d707 8223626: move print() functions to cpp files
coleenp
parents: 53244
diff changeset
   133
  int slow_path_entry_count() const; // Compute this field if necessary
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
  int* total_entry_count_addr()                   { return &_total_entry_count; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
  int* biased_lock_entry_count_addr()             { return &_biased_lock_entry_count; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
  int* anonymously_biased_lock_entry_count_addr() { return &_anonymously_biased_lock_entry_count; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
  int* rebiased_lock_entry_count_addr()           { return &_rebiased_lock_entry_count; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
  int* revoked_lock_entry_count_addr()            { return &_revoked_lock_entry_count; }
55625
f7e8dbb77156 8191890: Biased locking still uses the inferior stop the world safepoint for revocation
pchilanomate
parents: 55479
diff changeset
   140
  int* handshakes_count_addr()                    { return &_handshakes_count; }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
  int* fast_path_entry_count_addr()               { return &_fast_path_entry_count; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
  int* slow_path_entry_count_addr()               { return &_slow_path_entry_count; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
  bool nonzero() { return _total_entry_count > 0; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
54807
33fe50b6d707 8223626: move print() functions to cpp files
coleenp
parents: 53244
diff changeset
   146
  void print_on(outputStream* st) const;
33fe50b6d707 8223626: move print() functions to cpp files
coleenp
parents: 53244
diff changeset
   147
  void print() const;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
class BiasedLocking : AllStatic {
55625
f7e8dbb77156 8191890: Biased locking still uses the inferior stop the world safepoint for revocation
pchilanomate
parents: 55479
diff changeset
   152
friend class VM_BulkRevokeBias;
f7e8dbb77156 8191890: Biased locking still uses the inferior stop the world safepoint for revocation
pchilanomate
parents: 55479
diff changeset
   153
friend class RevokeOneBias;
f7e8dbb77156 8191890: Biased locking still uses the inferior stop the world safepoint for revocation
pchilanomate
parents: 55479
diff changeset
   154
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
  static BiasedLockingCounters _counters;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
  static int* total_entry_count_addr();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
  static int* biased_lock_entry_count_addr();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
  static int* anonymously_biased_lock_entry_count_addr();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
  static int* rebiased_lock_entry_count_addr();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
  static int* revoked_lock_entry_count_addr();
55625
f7e8dbb77156 8191890: Biased locking still uses the inferior stop the world safepoint for revocation
pchilanomate
parents: 55479
diff changeset
   164
  static int* handshakes_count_addr();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
  static int* fast_path_entry_count_addr();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
  static int* slow_path_entry_count_addr();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
  enum Condition {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
    NOT_BIASED = 1,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
    BIAS_REVOKED = 2,
57893
49fea19f0726 8229844: Remove attempt_rebias parameter from revoke_and_rebias()
pchilanomate
parents: 57777
diff changeset
   171
    NOT_REVOKED = 3
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
  };
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
55625
f7e8dbb77156 8191890: Biased locking still uses the inferior stop the world safepoint for revocation
pchilanomate
parents: 55479
diff changeset
   174
private:
57893
49fea19f0726 8229844: Remove attempt_rebias parameter from revoke_and_rebias()
pchilanomate
parents: 57777
diff changeset
   175
  static void single_revoke_at_safepoint(oop obj, bool is_bulk, JavaThread* requester, JavaThread** biaser);
49fea19f0726 8229844: Remove attempt_rebias parameter from revoke_and_rebias()
pchilanomate
parents: 57777
diff changeset
   176
  static void bulk_revoke_at_safepoint(oop o, bool bulk_rebias, JavaThread* requester);
55625
f7e8dbb77156 8191890: Biased locking still uses the inferior stop the world safepoint for revocation
pchilanomate
parents: 55479
diff changeset
   177
  static Condition single_revoke_with_handshake(Handle obj, JavaThread *requester, JavaThread *biaser);
f7e8dbb77156 8191890: Biased locking still uses the inferior stop the world safepoint for revocation
pchilanomate
parents: 55479
diff changeset
   178
  static void walk_stack_and_revoke(oop obj, JavaThread* biased_locker);
f7e8dbb77156 8191890: Biased locking still uses the inferior stop the world safepoint for revocation
pchilanomate
parents: 55479
diff changeset
   179
f7e8dbb77156 8191890: Biased locking still uses the inferior stop the world safepoint for revocation
pchilanomate
parents: 55479
diff changeset
   180
public:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   181
  // This initialization routine should only be called once and
489c9b5090e2 Initial load
duke
parents:
diff changeset
   182
  // schedules a PeriodicTask to turn on biased locking a few seconds
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
  // into the VM run to avoid startup time regressions
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
  static void init();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   185
489c9b5090e2 Initial load
duke
parents:
diff changeset
   186
  // This provides a global switch for leaving biased locking disabled
489c9b5090e2 Initial load
duke
parents:
diff changeset
   187
  // for the first part of a run and enabling it later
489c9b5090e2 Initial load
duke
parents:
diff changeset
   188
  static bool enabled();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   189
489c9b5090e2 Initial load
duke
parents:
diff changeset
   190
  // This should be called by JavaThreads to revoke the bias of an object
57893
49fea19f0726 8229844: Remove attempt_rebias parameter from revoke_and_rebias()
pchilanomate
parents: 57777
diff changeset
   191
  static void revoke(Handle obj, TRAPS);
49fea19f0726 8229844: Remove attempt_rebias parameter from revoke_and_rebias()
pchilanomate
parents: 57777
diff changeset
   192
58226
408c445d04e8 8226705: [REDO] Deoptimize with handshakes
rehn
parents: 57893
diff changeset
   193
  // This must only be called by a JavaThread to revoke the bias of an owned object.
408c445d04e8 8226705: [REDO] Deoptimize with handshakes
rehn
parents: 57893
diff changeset
   194
  static void revoke_own_lock(Handle obj, TRAPS);
408c445d04e8 8226705: [REDO] Deoptimize with handshakes
rehn
parents: 57893
diff changeset
   195
57893
49fea19f0726 8229844: Remove attempt_rebias parameter from revoke_and_rebias()
pchilanomate
parents: 57777
diff changeset
   196
  static void revoke_at_safepoint(Handle obj);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
57893
49fea19f0726 8229844: Remove attempt_rebias parameter from revoke_and_rebias()
pchilanomate
parents: 57777
diff changeset
   198
  // These are used by deoptimization to ensure that monitors on the stack
49fea19f0726 8229844: Remove attempt_rebias parameter from revoke_and_rebias()
pchilanomate
parents: 57777
diff changeset
   199
  // can be migrated
55625
f7e8dbb77156 8191890: Biased locking still uses the inferior stop the world safepoint for revocation
pchilanomate
parents: 55479
diff changeset
   200
  static void revoke(GrowableArray<Handle>* objs, JavaThread *biaser);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   201
489c9b5090e2 Initial load
duke
parents:
diff changeset
   202
  static void print_counters() { _counters.print(); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   203
  static BiasedLockingCounters* counters() { return &_counters; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   204
489c9b5090e2 Initial load
duke
parents:
diff changeset
   205
  // These routines are GC-related and should not be called by end
489c9b5090e2 Initial load
duke
parents:
diff changeset
   206
  // users. GCs which do not do preservation of mark words do not need
489c9b5090e2 Initial load
duke
parents:
diff changeset
   207
  // to call these routines.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   208
  static void preserve_marks();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   209
  static void restore_marks();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   210
};
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
   211
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 49364
diff changeset
   212
#endif // SHARE_RUNTIME_BIASEDLOCKING_HPP