author | stefank |
Thu, 22 Feb 2018 18:36:32 +0100 | |
changeset 49048 | 4e8c86b75428 |
parent 48105 | 8d15b1369c7a |
child 49594 | 898ef81cbc0e |
permissions | -rw-r--r-- |
1 | 1 |
/* |
48105
8d15b1369c7a
8167108: inconsistent handling of SR_lock can lead to crashes
dcubed
parents:
47216
diff
changeset
|
2 |
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. |
1 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
13 |
* accompanied this code). |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License version |
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
670
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
670
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:
670
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
7397 | 25 |
#include "precompiled.hpp" |
30764 | 26 |
#include "gc/shared/collectedHeap.hpp" |
27 |
#include "gc/shared/gcLocker.inline.hpp" |
|
7397 | 28 |
#include "memory/resourceArea.hpp" |
35061 | 29 |
#include "logging/log.hpp" |
40655
9f644073d3a0
8157907: Incorrect inclusion of atomic.hpp instead of atomic.inline.hpp
dholmes
parents:
37242
diff
changeset
|
30 |
#include "runtime/atomic.hpp" |
24351
61b33cc6d3cf
8042195: Introduce umbrella header orderAccess.inline.hpp.
goetz
parents:
23540
diff
changeset
|
31 |
#include "runtime/thread.inline.hpp" |
48105
8d15b1369c7a
8167108: inconsistent handling of SR_lock can lead to crashes
dcubed
parents:
47216
diff
changeset
|
32 |
#include "runtime/threadSMR.hpp" |
1 | 33 |
|
35492
c8c0273e6b91
8146690: Make all classes in GC follow the naming convention.
david
parents:
35061
diff
changeset
|
34 |
volatile jint GCLocker::_jni_lock_count = 0; |
c8c0273e6b91
8146690: Make all classes in GC follow the naming convention.
david
parents:
35061
diff
changeset
|
35 |
volatile bool GCLocker::_needs_gc = false; |
c8c0273e6b91
8146690: Make all classes in GC follow the naming convention.
david
parents:
35061
diff
changeset
|
36 |
volatile bool GCLocker::_doing_gc = false; |
11631
33813f69207b
7129164: JNI Get/ReleasePrimitiveArrayCritical doesn't scale
never
parents:
7397
diff
changeset
|
37 |
|
33813f69207b
7129164: JNI Get/ReleasePrimitiveArrayCritical doesn't scale
never
parents:
7397
diff
changeset
|
38 |
#ifdef ASSERT |
35492
c8c0273e6b91
8146690: Make all classes in GC follow the naming convention.
david
parents:
35061
diff
changeset
|
39 |
volatile jint GCLocker::_debug_jni_lock_count = 0; |
11631
33813f69207b
7129164: JNI Get/ReleasePrimitiveArrayCritical doesn't scale
never
parents:
7397
diff
changeset
|
40 |
#endif |
33813f69207b
7129164: JNI Get/ReleasePrimitiveArrayCritical doesn't scale
never
parents:
7397
diff
changeset
|
41 |
|
33813f69207b
7129164: JNI Get/ReleasePrimitiveArrayCritical doesn't scale
never
parents:
7397
diff
changeset
|
42 |
|
33813f69207b
7129164: JNI Get/ReleasePrimitiveArrayCritical doesn't scale
never
parents:
7397
diff
changeset
|
43 |
#ifdef ASSERT |
35492
c8c0273e6b91
8146690: Make all classes in GC follow the naming convention.
david
parents:
35061
diff
changeset
|
44 |
void GCLocker::verify_critical_count() { |
11631
33813f69207b
7129164: JNI Get/ReleasePrimitiveArrayCritical doesn't scale
never
parents:
7397
diff
changeset
|
45 |
if (SafepointSynchronize::is_at_safepoint()) { |
33813f69207b
7129164: JNI Get/ReleasePrimitiveArrayCritical doesn't scale
never
parents:
7397
diff
changeset
|
46 |
assert(!needs_gc() || _debug_jni_lock_count == _jni_lock_count, "must agree"); |
33813f69207b
7129164: JNI Get/ReleasePrimitiveArrayCritical doesn't scale
never
parents:
7397
diff
changeset
|
47 |
int count = 0; |
33813f69207b
7129164: JNI Get/ReleasePrimitiveArrayCritical doesn't scale
never
parents:
7397
diff
changeset
|
48 |
// Count the number of threads with critical operations in progress |
48105
8d15b1369c7a
8167108: inconsistent handling of SR_lock can lead to crashes
dcubed
parents:
47216
diff
changeset
|
49 |
JavaThreadIteratorWithHandle jtiwh; |
8d15b1369c7a
8167108: inconsistent handling of SR_lock can lead to crashes
dcubed
parents:
47216
diff
changeset
|
50 |
for (; JavaThread *thr = jtiwh.next(); ) { |
11631
33813f69207b
7129164: JNI Get/ReleasePrimitiveArrayCritical doesn't scale
never
parents:
7397
diff
changeset
|
51 |
if (thr->in_critical()) { |
33813f69207b
7129164: JNI Get/ReleasePrimitiveArrayCritical doesn't scale
never
parents:
7397
diff
changeset
|
52 |
count++; |
33813f69207b
7129164: JNI Get/ReleasePrimitiveArrayCritical doesn't scale
never
parents:
7397
diff
changeset
|
53 |
} |
33813f69207b
7129164: JNI Get/ReleasePrimitiveArrayCritical doesn't scale
never
parents:
7397
diff
changeset
|
54 |
} |
33813f69207b
7129164: JNI Get/ReleasePrimitiveArrayCritical doesn't scale
never
parents:
7397
diff
changeset
|
55 |
if (_jni_lock_count != count) { |
37226
9b0d4b523ce4
8153188: Use log_error(gc, verify) for logging in verification code
brutisso
parents:
35492
diff
changeset
|
56 |
log_error(gc, verify)("critical counts don't match: %d != %d", _jni_lock_count, count); |
48105
8d15b1369c7a
8167108: inconsistent handling of SR_lock can lead to crashes
dcubed
parents:
47216
diff
changeset
|
57 |
jtiwh.rewind(); |
8d15b1369c7a
8167108: inconsistent handling of SR_lock can lead to crashes
dcubed
parents:
47216
diff
changeset
|
58 |
for (; JavaThread *thr = jtiwh.next(); ) { |
11631
33813f69207b
7129164: JNI Get/ReleasePrimitiveArrayCritical doesn't scale
never
parents:
7397
diff
changeset
|
59 |
if (thr->in_critical()) { |
37226
9b0d4b523ce4
8153188: Use log_error(gc, verify) for logging in verification code
brutisso
parents:
35492
diff
changeset
|
60 |
log_error(gc, verify)(INTPTR_FORMAT " in_critical %d", p2i(thr), thr->in_critical()); |
11631
33813f69207b
7129164: JNI Get/ReleasePrimitiveArrayCritical doesn't scale
never
parents:
7397
diff
changeset
|
61 |
} |
33813f69207b
7129164: JNI Get/ReleasePrimitiveArrayCritical doesn't scale
never
parents:
7397
diff
changeset
|
62 |
} |
33813f69207b
7129164: JNI Get/ReleasePrimitiveArrayCritical doesn't scale
never
parents:
7397
diff
changeset
|
63 |
} |
33813f69207b
7129164: JNI Get/ReleasePrimitiveArrayCritical doesn't scale
never
parents:
7397
diff
changeset
|
64 |
assert(_jni_lock_count == count, "must be equal"); |
33813f69207b
7129164: JNI Get/ReleasePrimitiveArrayCritical doesn't scale
never
parents:
7397
diff
changeset
|
65 |
} |
33813f69207b
7129164: JNI Get/ReleasePrimitiveArrayCritical doesn't scale
never
parents:
7397
diff
changeset
|
66 |
} |
25351
7c198a690050
8044775: Improve usage of umbrella header atomic.inline.hpp.
goetz
parents:
24424
diff
changeset
|
67 |
|
7c198a690050
8044775: Improve usage of umbrella header atomic.inline.hpp.
goetz
parents:
24424
diff
changeset
|
68 |
// In debug mode track the locking state at all times |
35492
c8c0273e6b91
8146690: Make all classes in GC follow the naming convention.
david
parents:
35061
diff
changeset
|
69 |
void GCLocker::increment_debug_jni_lock_count() { |
25351
7c198a690050
8044775: Improve usage of umbrella header atomic.inline.hpp.
goetz
parents:
24424
diff
changeset
|
70 |
assert(_debug_jni_lock_count >= 0, "bad value"); |
7c198a690050
8044775: Improve usage of umbrella header atomic.inline.hpp.
goetz
parents:
24424
diff
changeset
|
71 |
Atomic::inc(&_debug_jni_lock_count); |
7c198a690050
8044775: Improve usage of umbrella header atomic.inline.hpp.
goetz
parents:
24424
diff
changeset
|
72 |
} |
7c198a690050
8044775: Improve usage of umbrella header atomic.inline.hpp.
goetz
parents:
24424
diff
changeset
|
73 |
|
35492
c8c0273e6b91
8146690: Make all classes in GC follow the naming convention.
david
parents:
35061
diff
changeset
|
74 |
void GCLocker::decrement_debug_jni_lock_count() { |
25351
7c198a690050
8044775: Improve usage of umbrella header atomic.inline.hpp.
goetz
parents:
24424
diff
changeset
|
75 |
assert(_debug_jni_lock_count > 0, "bad value"); |
7c198a690050
8044775: Improve usage of umbrella header atomic.inline.hpp.
goetz
parents:
24424
diff
changeset
|
76 |
Atomic::dec(&_debug_jni_lock_count); |
7c198a690050
8044775: Improve usage of umbrella header atomic.inline.hpp.
goetz
parents:
24424
diff
changeset
|
77 |
} |
11631
33813f69207b
7129164: JNI Get/ReleasePrimitiveArrayCritical doesn't scale
never
parents:
7397
diff
changeset
|
78 |
#endif |
33813f69207b
7129164: JNI Get/ReleasePrimitiveArrayCritical doesn't scale
never
parents:
7397
diff
changeset
|
79 |
|
35492
c8c0273e6b91
8146690: Make all classes in GC follow the naming convention.
david
parents:
35061
diff
changeset
|
80 |
void GCLocker::log_debug_jni(const char* msg) { |
37242 | 81 |
Log(gc, jni) log; |
35061 | 82 |
if (log.is_debug()) { |
83 |
ResourceMark rm; // JavaThread::name() allocates to convert to UTF8 |
|
84 |
log.debug("%s Thread \"%s\" %d locked.", msg, Thread::current()->name(), _jni_lock_count); |
|
85 |
} |
|
86 |
} |
|
87 |
||
35492
c8c0273e6b91
8146690: Make all classes in GC follow the naming convention.
david
parents:
35061
diff
changeset
|
88 |
bool GCLocker::check_active_before_gc() { |
11631
33813f69207b
7129164: JNI Get/ReleasePrimitiveArrayCritical doesn't scale
never
parents:
7397
diff
changeset
|
89 |
assert(SafepointSynchronize::is_at_safepoint(), "only read at safepoint"); |
33813f69207b
7129164: JNI Get/ReleasePrimitiveArrayCritical doesn't scale
never
parents:
7397
diff
changeset
|
90 |
if (is_active() && !_needs_gc) { |
33813f69207b
7129164: JNI Get/ReleasePrimitiveArrayCritical doesn't scale
never
parents:
7397
diff
changeset
|
91 |
verify_critical_count(); |
33813f69207b
7129164: JNI Get/ReleasePrimitiveArrayCritical doesn't scale
never
parents:
7397
diff
changeset
|
92 |
_needs_gc = true; |
35061 | 93 |
log_debug_jni("Setting _needs_gc."); |
11631
33813f69207b
7129164: JNI Get/ReleasePrimitiveArrayCritical doesn't scale
never
parents:
7397
diff
changeset
|
94 |
} |
33813f69207b
7129164: JNI Get/ReleasePrimitiveArrayCritical doesn't scale
never
parents:
7397
diff
changeset
|
95 |
return is_active(); |
33813f69207b
7129164: JNI Get/ReleasePrimitiveArrayCritical doesn't scale
never
parents:
7397
diff
changeset
|
96 |
} |
1 | 97 |
|
35492
c8c0273e6b91
8146690: Make all classes in GC follow the naming convention.
david
parents:
35061
diff
changeset
|
98 |
void GCLocker::stall_until_clear() { |
1 | 99 |
assert(!JavaThread::current()->in_critical(), "Would deadlock"); |
11631
33813f69207b
7129164: JNI Get/ReleasePrimitiveArrayCritical doesn't scale
never
parents:
7397
diff
changeset
|
100 |
MutexLocker ml(JNICritical_lock); |
33813f69207b
7129164: JNI Get/ReleasePrimitiveArrayCritical doesn't scale
never
parents:
7397
diff
changeset
|
101 |
|
33813f69207b
7129164: JNI Get/ReleasePrimitiveArrayCritical doesn't scale
never
parents:
7397
diff
changeset
|
102 |
if (needs_gc()) { |
35061 | 103 |
log_debug_jni("Allocation failed. Thread stalled by JNI critical section."); |
386
7f121b1192f2
6539517: CR 6186200 should be extended to perm gen allocation to prevent spurious OOM's from perm gen
apetrusenko
parents:
1
diff
changeset
|
104 |
} |
11631
33813f69207b
7129164: JNI Get/ReleasePrimitiveArrayCritical doesn't scale
never
parents:
7397
diff
changeset
|
105 |
|
1 | 106 |
// Wait for _needs_gc to be cleared |
11631
33813f69207b
7129164: JNI Get/ReleasePrimitiveArrayCritical doesn't scale
never
parents:
7397
diff
changeset
|
107 |
while (needs_gc()) { |
1 | 108 |
JNICritical_lock->wait(); |
109 |
} |
|
110 |
} |
|
111 |
||
35492
c8c0273e6b91
8146690: Make all classes in GC follow the naming convention.
david
parents:
35061
diff
changeset
|
112 |
void GCLocker::jni_lock(JavaThread* thread) { |
11631
33813f69207b
7129164: JNI Get/ReleasePrimitiveArrayCritical doesn't scale
never
parents:
7397
diff
changeset
|
113 |
assert(!thread->in_critical(), "shouldn't currently be in a critical region"); |
1 | 114 |
MutexLocker mu(JNICritical_lock); |
115 |
// Block entering threads if we know at least one thread is in a |
|
116 |
// JNI critical region and we need a GC. |
|
117 |
// We check that at least one thread is in a critical region before |
|
118 |
// blocking because blocked threads are woken up by a thread exiting |
|
119 |
// a JNI critical region. |
|
23540
06f7d6e1f654
8028498: runtime/SharedArchiveFile/CdsDifferentObjectAlignment.java asserts in RT_Baseline
sjohanss
parents:
22234
diff
changeset
|
120 |
while (is_active_and_needs_gc() || _doing_gc) { |
1 | 121 |
JNICritical_lock->wait(); |
122 |
} |
|
11631
33813f69207b
7129164: JNI Get/ReleasePrimitiveArrayCritical doesn't scale
never
parents:
7397
diff
changeset
|
123 |
thread->enter_critical(); |
33813f69207b
7129164: JNI Get/ReleasePrimitiveArrayCritical doesn't scale
never
parents:
7397
diff
changeset
|
124 |
_jni_lock_count++; |
33813f69207b
7129164: JNI Get/ReleasePrimitiveArrayCritical doesn't scale
never
parents:
7397
diff
changeset
|
125 |
increment_debug_jni_lock_count(); |
1 | 126 |
} |
127 |
||
35492
c8c0273e6b91
8146690: Make all classes in GC follow the naming convention.
david
parents:
35061
diff
changeset
|
128 |
void GCLocker::jni_unlock(JavaThread* thread) { |
11631
33813f69207b
7129164: JNI Get/ReleasePrimitiveArrayCritical doesn't scale
never
parents:
7397
diff
changeset
|
129 |
assert(thread->in_last_critical(), "should be exiting critical region"); |
1 | 130 |
MutexLocker mu(JNICritical_lock); |
11631
33813f69207b
7129164: JNI Get/ReleasePrimitiveArrayCritical doesn't scale
never
parents:
7397
diff
changeset
|
131 |
_jni_lock_count--; |
33813f69207b
7129164: JNI Get/ReleasePrimitiveArrayCritical doesn't scale
never
parents:
7397
diff
changeset
|
132 |
decrement_debug_jni_lock_count(); |
33813f69207b
7129164: JNI Get/ReleasePrimitiveArrayCritical doesn't scale
never
parents:
7397
diff
changeset
|
133 |
thread->exit_critical(); |
23540
06f7d6e1f654
8028498: runtime/SharedArchiveFile/CdsDifferentObjectAlignment.java asserts in RT_Baseline
sjohanss
parents:
22234
diff
changeset
|
134 |
if (needs_gc() && !is_active_internal()) { |
1 | 135 |
// We're the last thread out. Cause a GC to occur. |
23540
06f7d6e1f654
8028498: runtime/SharedArchiveFile/CdsDifferentObjectAlignment.java asserts in RT_Baseline
sjohanss
parents:
22234
diff
changeset
|
136 |
_doing_gc = true; |
06f7d6e1f654
8028498: runtime/SharedArchiveFile/CdsDifferentObjectAlignment.java asserts in RT_Baseline
sjohanss
parents:
22234
diff
changeset
|
137 |
{ |
06f7d6e1f654
8028498: runtime/SharedArchiveFile/CdsDifferentObjectAlignment.java asserts in RT_Baseline
sjohanss
parents:
22234
diff
changeset
|
138 |
// Must give up the lock while at a safepoint |
06f7d6e1f654
8028498: runtime/SharedArchiveFile/CdsDifferentObjectAlignment.java asserts in RT_Baseline
sjohanss
parents:
22234
diff
changeset
|
139 |
MutexUnlocker munlock(JNICritical_lock); |
35061 | 140 |
log_debug_jni("Performing GC after exiting critical section."); |
23540
06f7d6e1f654
8028498: runtime/SharedArchiveFile/CdsDifferentObjectAlignment.java asserts in RT_Baseline
sjohanss
parents:
22234
diff
changeset
|
141 |
Universe::heap()->collect(GCCause::_gc_locker); |
1 | 142 |
} |
23540
06f7d6e1f654
8028498: runtime/SharedArchiveFile/CdsDifferentObjectAlignment.java asserts in RT_Baseline
sjohanss
parents:
22234
diff
changeset
|
143 |
_doing_gc = false; |
11631
33813f69207b
7129164: JNI Get/ReleasePrimitiveArrayCritical doesn't scale
never
parents:
7397
diff
changeset
|
144 |
_needs_gc = false; |
1 | 145 |
JNICritical_lock->notify_all(); |
146 |
} |
|
147 |
} |
|
148 |
||
35492
c8c0273e6b91
8146690: Make all classes in GC follow the naming convention.
david
parents:
35061
diff
changeset
|
149 |
// Implementation of NoGCVerifier |
1 | 150 |
|
151 |
#ifdef ASSERT |
|
152 |
||
35492
c8c0273e6b91
8146690: Make all classes in GC follow the naming convention.
david
parents:
35061
diff
changeset
|
153 |
NoGCVerifier::NoGCVerifier(bool verifygc) { |
1 | 154 |
_verifygc = verifygc; |
155 |
if (_verifygc) { |
|
156 |
CollectedHeap* h = Universe::heap(); |
|
35492
c8c0273e6b91
8146690: Make all classes in GC follow the naming convention.
david
parents:
35061
diff
changeset
|
157 |
assert(!h->is_gc_active(), "GC active during NoGCVerifier"); |
1 | 158 |
_old_invocations = h->total_collections(); |
159 |
} |
|
160 |
} |
|
161 |
||
162 |
||
35492
c8c0273e6b91
8146690: Make all classes in GC follow the naming convention.
david
parents:
35061
diff
changeset
|
163 |
NoGCVerifier::~NoGCVerifier() { |
1 | 164 |
if (_verifygc) { |
165 |
CollectedHeap* h = Universe::heap(); |
|
35492
c8c0273e6b91
8146690: Make all classes in GC follow the naming convention.
david
parents:
35061
diff
changeset
|
166 |
assert(!h->is_gc_active(), "GC active during NoGCVerifier"); |
1 | 167 |
if (_old_invocations != h->total_collections()) { |
35492
c8c0273e6b91
8146690: Make all classes in GC follow the naming convention.
david
parents:
35061
diff
changeset
|
168 |
fatal("collection in a NoGCVerifier secured function"); |
1 | 169 |
} |
170 |
} |
|
171 |
} |
|
172 |
||
35492
c8c0273e6b91
8146690: Make all classes in GC follow the naming convention.
david
parents:
35061
diff
changeset
|
173 |
PauseNoGCVerifier::PauseNoGCVerifier(NoGCVerifier * ngcv) { |
1 | 174 |
_ngcv = ngcv; |
175 |
if (_ngcv->_verifygc) { |
|
176 |
// if we were verifying, then make sure that nothing is |
|
177 |
// wrong before we "pause" verification |
|
178 |
CollectedHeap* h = Universe::heap(); |
|
35492
c8c0273e6b91
8146690: Make all classes in GC follow the naming convention.
david
parents:
35061
diff
changeset
|
179 |
assert(!h->is_gc_active(), "GC active during NoGCVerifier"); |
1 | 180 |
if (_ngcv->_old_invocations != h->total_collections()) { |
35492
c8c0273e6b91
8146690: Make all classes in GC follow the naming convention.
david
parents:
35061
diff
changeset
|
181 |
fatal("collection in a NoGCVerifier secured function"); |
1 | 182 |
} |
183 |
} |
|
184 |
} |
|
185 |
||
186 |
||
35492
c8c0273e6b91
8146690: Make all classes in GC follow the naming convention.
david
parents:
35061
diff
changeset
|
187 |
PauseNoGCVerifier::~PauseNoGCVerifier() { |
1 | 188 |
if (_ngcv->_verifygc) { |
189 |
// if we were verifying before, then reenable verification |
|
190 |
CollectedHeap* h = Universe::heap(); |
|
35492
c8c0273e6b91
8146690: Make all classes in GC follow the naming convention.
david
parents:
35061
diff
changeset
|
191 |
assert(!h->is_gc_active(), "GC active during NoGCVerifier"); |
1 | 192 |
_ngcv->_old_invocations = h->total_collections(); |
193 |
} |
|
194 |
} |
|
195 |
||
196 |
||
197 |
// JRT_LEAF rules: |
|
198 |
// A JRT_LEAF method may not interfere with safepointing by |
|
199 |
// 1) acquiring or blocking on a Mutex or JavaLock - checked |
|
200 |
// 2) allocating heap memory - checked |
|
201 |
// 3) executing a VM operation - checked |
|
202 |
// 4) executing a system call (including malloc) that could block or grab a lock |
|
203 |
// 5) invoking GC |
|
204 |
// 6) reaching a safepoint |
|
205 |
// 7) running too long |
|
206 |
// Nor may any method it calls. |
|
35492
c8c0273e6b91
8146690: Make all classes in GC follow the naming convention.
david
parents:
35061
diff
changeset
|
207 |
JRTLeafVerifier::JRTLeafVerifier() |
c8c0273e6b91
8146690: Make all classes in GC follow the naming convention.
david
parents:
35061
diff
changeset
|
208 |
: NoSafepointVerifier(true, JRTLeafVerifier::should_verify_GC()) |
1 | 209 |
{ |
210 |
} |
|
211 |
||
35492
c8c0273e6b91
8146690: Make all classes in GC follow the naming convention.
david
parents:
35061
diff
changeset
|
212 |
JRTLeafVerifier::~JRTLeafVerifier() |
1 | 213 |
{ |
214 |
} |
|
215 |
||
35492
c8c0273e6b91
8146690: Make all classes in GC follow the naming convention.
david
parents:
35061
diff
changeset
|
216 |
bool JRTLeafVerifier::should_verify_GC() { |
1 | 217 |
switch (JavaThread::current()->thread_state()) { |
218 |
case _thread_in_Java: |
|
219 |
// is in a leaf routine, there must be no safepoint. |
|
220 |
return true; |
|
221 |
case _thread_in_native: |
|
222 |
// A native thread is not subject to safepoints. |
|
223 |
// Even while it is in a leaf routine, GC is ok |
|
224 |
return false; |
|
225 |
default: |
|
226 |
// Leaf routines cannot be called from other contexts. |
|
227 |
ShouldNotReachHere(); |
|
228 |
return false; |
|
229 |
} |
|
230 |
} |
|
231 |
#endif |