author | jcbeyler |
Tue, 17 Jul 2018 19:59:38 -0700 | |
changeset 51138 | 914f305ba6fa |
parent 50882 | 80abf702eed8 |
child 50946 | be2d74d91351 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
49480
d7df2dd501ce
8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
49449
diff
changeset
|
2 |
* Copyright (c) 1997, 2018, 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:
3261
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
3261
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:
3261
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
7397 | 25 |
#include "precompiled.hpp" |
30764 | 26 |
#include "gc/shared/collectedHeap.hpp" |
27 |
#include "gc/shared/collectedHeap.inline.hpp" |
|
50882
80abf702eed8
8205683: Refactor heap allocation to separate concerns
eosterlund
parents:
50429
diff
changeset
|
28 |
#include "logging/log.hpp" |
7397 | 29 |
#include "memory/resourceArea.hpp" |
40655
9f644073d3a0
8157907: Incorrect inclusion of atomic.hpp instead of atomic.inline.hpp
dholmes
parents:
35061
diff
changeset
|
30 |
#include "runtime/atomic.hpp" |
49480
d7df2dd501ce
8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
49449
diff
changeset
|
31 |
#include "runtime/frame.inline.hpp" |
49449
ef5d5d343e2a
8199263: Split interfaceSupport.hpp to not require including .inline.hpp files
coleenp
parents:
47765
diff
changeset
|
32 |
#include "runtime/handles.inline.hpp" |
7397 | 33 |
#include "runtime/init.hpp" |
49449
ef5d5d343e2a
8199263: Split interfaceSupport.hpp to not require including .inline.hpp files
coleenp
parents:
47765
diff
changeset
|
34 |
#include "runtime/interfaceSupport.inline.hpp" |
50429
83aec1d357d4
8204301: Make OrderAccess functions available to hpp rather than inline.hpp files
coleenp
parents:
49734
diff
changeset
|
35 |
#include "runtime/orderAccess.hpp" |
25468
5331df506290
8048241: Introduce umbrella header os.inline.hpp and clean up includes
goetz
parents:
25351
diff
changeset
|
36 |
#include "runtime/os.inline.hpp" |
49449
ef5d5d343e2a
8199263: Split interfaceSupport.hpp to not require including .inline.hpp files
coleenp
parents:
47765
diff
changeset
|
37 |
#include "runtime/thread.inline.hpp" |
49594
898ef81cbc0e
8200106: Move NoSafepointVerifier out from gcLocker.hpp
stefank
parents:
49480
diff
changeset
|
38 |
#include "runtime/safepointVerifiers.hpp" |
7397 | 39 |
#include "runtime/vframe.hpp" |
49480
d7df2dd501ce
8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
49449
diff
changeset
|
40 |
#include "runtime/vmThread.hpp" |
7397 | 41 |
#include "utilities/preserveException.hpp" |
1 | 42 |
|
43 |
// Implementation of InterfaceSupport |
|
44 |
||
45 |
#ifdef ASSERT |
|
49449
ef5d5d343e2a
8199263: Split interfaceSupport.hpp to not require including .inline.hpp files
coleenp
parents:
47765
diff
changeset
|
46 |
VMEntryWrapper::VMEntryWrapper() { |
ef5d5d343e2a
8199263: Split interfaceSupport.hpp to not require including .inline.hpp files
coleenp
parents:
47765
diff
changeset
|
47 |
if (VerifyLastFrame) { |
ef5d5d343e2a
8199263: Split interfaceSupport.hpp to not require including .inline.hpp files
coleenp
parents:
47765
diff
changeset
|
48 |
InterfaceSupport::verify_last_frame(); |
ef5d5d343e2a
8199263: Split interfaceSupport.hpp to not require including .inline.hpp files
coleenp
parents:
47765
diff
changeset
|
49 |
} |
ef5d5d343e2a
8199263: Split interfaceSupport.hpp to not require including .inline.hpp files
coleenp
parents:
47765
diff
changeset
|
50 |
} |
ef5d5d343e2a
8199263: Split interfaceSupport.hpp to not require including .inline.hpp files
coleenp
parents:
47765
diff
changeset
|
51 |
|
ef5d5d343e2a
8199263: Split interfaceSupport.hpp to not require including .inline.hpp files
coleenp
parents:
47765
diff
changeset
|
52 |
VMEntryWrapper::~VMEntryWrapper() { |
ef5d5d343e2a
8199263: Split interfaceSupport.hpp to not require including .inline.hpp files
coleenp
parents:
47765
diff
changeset
|
53 |
InterfaceSupport::check_gc_alot(); |
ef5d5d343e2a
8199263: Split interfaceSupport.hpp to not require including .inline.hpp files
coleenp
parents:
47765
diff
changeset
|
54 |
if (WalkStackALot) { |
ef5d5d343e2a
8199263: Split interfaceSupport.hpp to not require including .inline.hpp files
coleenp
parents:
47765
diff
changeset
|
55 |
InterfaceSupport::walk_stack(); |
ef5d5d343e2a
8199263: Split interfaceSupport.hpp to not require including .inline.hpp files
coleenp
parents:
47765
diff
changeset
|
56 |
} |
ef5d5d343e2a
8199263: Split interfaceSupport.hpp to not require including .inline.hpp files
coleenp
parents:
47765
diff
changeset
|
57 |
#ifdef COMPILER2 |
ef5d5d343e2a
8199263: Split interfaceSupport.hpp to not require including .inline.hpp files
coleenp
parents:
47765
diff
changeset
|
58 |
// This option is not used by Compiler 1 |
ef5d5d343e2a
8199263: Split interfaceSupport.hpp to not require including .inline.hpp files
coleenp
parents:
47765
diff
changeset
|
59 |
if (StressDerivedPointers) { |
ef5d5d343e2a
8199263: Split interfaceSupport.hpp to not require including .inline.hpp files
coleenp
parents:
47765
diff
changeset
|
60 |
InterfaceSupport::stress_derived_pointers(); |
ef5d5d343e2a
8199263: Split interfaceSupport.hpp to not require including .inline.hpp files
coleenp
parents:
47765
diff
changeset
|
61 |
} |
ef5d5d343e2a
8199263: Split interfaceSupport.hpp to not require including .inline.hpp files
coleenp
parents:
47765
diff
changeset
|
62 |
#endif |
ef5d5d343e2a
8199263: Split interfaceSupport.hpp to not require including .inline.hpp files
coleenp
parents:
47765
diff
changeset
|
63 |
if (DeoptimizeALot || DeoptimizeRandom) { |
ef5d5d343e2a
8199263: Split interfaceSupport.hpp to not require including .inline.hpp files
coleenp
parents:
47765
diff
changeset
|
64 |
InterfaceSupport::deoptimizeAll(); |
ef5d5d343e2a
8199263: Split interfaceSupport.hpp to not require including .inline.hpp files
coleenp
parents:
47765
diff
changeset
|
65 |
} |
ef5d5d343e2a
8199263: Split interfaceSupport.hpp to not require including .inline.hpp files
coleenp
parents:
47765
diff
changeset
|
66 |
if (ZombieALot) { |
ef5d5d343e2a
8199263: Split interfaceSupport.hpp to not require including .inline.hpp files
coleenp
parents:
47765
diff
changeset
|
67 |
InterfaceSupport::zombieAll(); |
ef5d5d343e2a
8199263: Split interfaceSupport.hpp to not require including .inline.hpp files
coleenp
parents:
47765
diff
changeset
|
68 |
} |
ef5d5d343e2a
8199263: Split interfaceSupport.hpp to not require including .inline.hpp files
coleenp
parents:
47765
diff
changeset
|
69 |
if (UnlinkSymbolsALot) { |
ef5d5d343e2a
8199263: Split interfaceSupport.hpp to not require including .inline.hpp files
coleenp
parents:
47765
diff
changeset
|
70 |
InterfaceSupport::unlinkSymbols(); |
ef5d5d343e2a
8199263: Split interfaceSupport.hpp to not require including .inline.hpp files
coleenp
parents:
47765
diff
changeset
|
71 |
} |
ef5d5d343e2a
8199263: Split interfaceSupport.hpp to not require including .inline.hpp files
coleenp
parents:
47765
diff
changeset
|
72 |
// do verification AFTER potential deoptimization |
ef5d5d343e2a
8199263: Split interfaceSupport.hpp to not require including .inline.hpp files
coleenp
parents:
47765
diff
changeset
|
73 |
if (VerifyStack) { |
ef5d5d343e2a
8199263: Split interfaceSupport.hpp to not require including .inline.hpp files
coleenp
parents:
47765
diff
changeset
|
74 |
InterfaceSupport::verify_stack(); |
ef5d5d343e2a
8199263: Split interfaceSupport.hpp to not require including .inline.hpp files
coleenp
parents:
47765
diff
changeset
|
75 |
} |
ef5d5d343e2a
8199263: Split interfaceSupport.hpp to not require including .inline.hpp files
coleenp
parents:
47765
diff
changeset
|
76 |
} |
1 | 77 |
|
78 |
long InterfaceSupport::_number_of_calls = 0; |
|
79 |
long InterfaceSupport::_scavenge_alot_counter = 1; |
|
80 |
long InterfaceSupport::_fullgc_alot_counter = 1; |
|
81 |
long InterfaceSupport::_fullgc_alot_invocation = 0; |
|
82 |
||
83 |
Histogram* RuntimeHistogram; |
|
84 |
||
85 |
RuntimeHistogramElement::RuntimeHistogramElement(const char* elementName) { |
|
47765
b7c7428eaab9
8189610: Reconcile jvm.h and all jvm_md.h between java.base and hotspot
coleenp
parents:
47216
diff
changeset
|
86 |
static volatile int RuntimeHistogram_lock = 0; |
1 | 87 |
_name = elementName; |
88 |
uintx count = 0; |
|
89 |
||
90 |
while (Atomic::cmpxchg(1, &RuntimeHistogram_lock, 0) != 0) { |
|
91 |
while (OrderAccess::load_acquire(&RuntimeHistogram_lock) != 0) { |
|
92 |
count +=1; |
|
93 |
if ( (WarnOnStalledSpinLock > 0) |
|
94 |
&& (count % WarnOnStalledSpinLock == 0)) { |
|
95 |
warning("RuntimeHistogram_lock seems to be stalled"); |
|
96 |
} |
|
97 |
} |
|
98 |
} |
|
99 |
||
100 |
if (RuntimeHistogram == NULL) { |
|
101 |
RuntimeHistogram = new Histogram("VM Runtime Call Counts",200); |
|
102 |
} |
|
103 |
||
104 |
RuntimeHistogram->add_element(this); |
|
105 |
Atomic::dec(&RuntimeHistogram_lock); |
|
106 |
} |
|
107 |
||
108 |
void InterfaceSupport::gc_alot() { |
|
109 |
Thread *thread = Thread::current(); |
|
2995
d8283445992a
6820167: GCALotAtAllSafepoints + FullGCALot(ScavengeALot) options crash JVM
ysr
parents:
1
diff
changeset
|
110 |
if (!thread->is_Java_thread()) return; // Avoid concurrent calls |
1 | 111 |
// Check for new, not quite initialized thread. A thread in new mode cannot initiate a GC. |
112 |
JavaThread *current_thread = (JavaThread *)thread; |
|
113 |
if (current_thread->active_handles() == NULL) return; |
|
114 |
||
2995
d8283445992a
6820167: GCALotAtAllSafepoints + FullGCALot(ScavengeALot) options crash JVM
ysr
parents:
1
diff
changeset
|
115 |
// Short-circuit any possible re-entrant gc-a-lot attempt |
d8283445992a
6820167: GCALotAtAllSafepoints + FullGCALot(ScavengeALot) options crash JVM
ysr
parents:
1
diff
changeset
|
116 |
if (thread->skip_gcalot()) return; |
d8283445992a
6820167: GCALotAtAllSafepoints + FullGCALot(ScavengeALot) options crash JVM
ysr
parents:
1
diff
changeset
|
117 |
|
27678
d1872bc7dd8d
8062036: ConcurrentMarkThread::slt may be invoked before ConcurrentMarkThread::makeSurrogateLockerThread causing intermittent crashes
kbarrett
parents:
25468
diff
changeset
|
118 |
if (Threads::is_vm_complete()) { |
1 | 119 |
|
120 |
if (++_fullgc_alot_invocation < FullGCALotStart) { |
|
121 |
return; |
|
122 |
} |
|
123 |
||
124 |
// Use this line if you want to block at a specific point, |
|
125 |
// e.g. one number_of_calls/scavenge/gc before you got into problems |
|
126 |
if (FullGCALot) _fullgc_alot_counter--; |
|
127 |
||
128 |
// Check if we should force a full gc |
|
129 |
if (_fullgc_alot_counter == 0) { |
|
130 |
// Release dummy so objects are forced to move |
|
131 |
if (!Universe::release_fullgc_alot_dummy()) { |
|
132 |
warning("FullGCALot: Unable to release more dummies at bottom of heap"); |
|
133 |
} |
|
134 |
HandleMark hm(thread); |
|
135 |
Universe::heap()->collect(GCCause::_full_gc_alot); |
|
136 |
unsigned int invocations = Universe::heap()->total_full_collections(); |
|
137 |
// Compute new interval |
|
138 |
if (FullGCALotInterval > 1) { |
|
139 |
_fullgc_alot_counter = 1+(long)((double)FullGCALotInterval*os::random()/(max_jint+1.0)); |
|
35061 | 140 |
log_trace(gc)("Full gc no: %u\tInterval: %ld", invocations, _fullgc_alot_counter); |
1 | 141 |
} else { |
142 |
_fullgc_alot_counter = 1; |
|
143 |
} |
|
144 |
// Print progress message |
|
145 |
if (invocations % 100 == 0) { |
|
35061 | 146 |
log_trace(gc)("Full gc no: %u", invocations); |
1 | 147 |
} |
148 |
} else { |
|
149 |
if (ScavengeALot) _scavenge_alot_counter--; |
|
150 |
// Check if we should force a scavenge |
|
151 |
if (_scavenge_alot_counter == 0) { |
|
152 |
HandleMark hm(thread); |
|
153 |
Universe::heap()->collect(GCCause::_scavenge_alot); |
|
154 |
unsigned int invocations = Universe::heap()->total_collections() - Universe::heap()->total_full_collections(); |
|
155 |
// Compute new interval |
|
156 |
if (ScavengeALotInterval > 1) { |
|
157 |
_scavenge_alot_counter = 1+(long)((double)ScavengeALotInterval*os::random()/(max_jint+1.0)); |
|
35061 | 158 |
log_trace(gc)("Scavenge no: %u\tInterval: %ld", invocations, _scavenge_alot_counter); |
1 | 159 |
} else { |
160 |
_scavenge_alot_counter = 1; |
|
161 |
} |
|
162 |
// Print progress message |
|
163 |
if (invocations % 1000 == 0) { |
|
35061 | 164 |
log_trace(gc)("Scavenge no: %u", invocations); |
1 | 165 |
} |
166 |
} |
|
167 |
} |
|
168 |
} |
|
169 |
} |
|
170 |
||
171 |
||
172 |
vframe* vframe_array[50]; |
|
173 |
int walk_stack_counter = 0; |
|
174 |
||
175 |
void InterfaceSupport::walk_stack_from(vframe* start_vf) { |
|
176 |
// walk |
|
177 |
int i = 0; |
|
178 |
for (vframe* f = start_vf; f; f = f->sender() ) { |
|
179 |
if (i < 50) vframe_array[i++] = f; |
|
180 |
} |
|
181 |
} |
|
182 |
||
183 |
||
184 |
void InterfaceSupport::walk_stack() { |
|
185 |
JavaThread* thread = JavaThread::current(); |
|
186 |
walk_stack_counter++; |
|
187 |
if (!thread->has_last_Java_frame()) return; |
|
188 |
ResourceMark rm(thread); |
|
189 |
RegisterMap reg_map(thread); |
|
190 |
walk_stack_from(thread->last_java_vframe(®_map)); |
|
191 |
} |
|
192 |
||
27451
7e2e2b955d15
8036913: make DeoptimizeALot dependent on number of threads
iignatyev
parents:
25468
diff
changeset
|
193 |
// invocation counter for InterfaceSupport::deoptimizeAll/zombieAll functions |
1 | 194 |
int deoptimizeAllCounter = 0; |
195 |
int zombieAllCounter = 0; |
|
196 |
||
197 |
void InterfaceSupport::zombieAll() { |
|
27451
7e2e2b955d15
8036913: make DeoptimizeALot dependent on number of threads
iignatyev
parents:
25468
diff
changeset
|
198 |
// This method is called by all threads when a thread make |
7e2e2b955d15
8036913: make DeoptimizeALot dependent on number of threads
iignatyev
parents:
25468
diff
changeset
|
199 |
// transition to VM state (for example, runtime calls). |
7e2e2b955d15
8036913: make DeoptimizeALot dependent on number of threads
iignatyev
parents:
25468
diff
changeset
|
200 |
// Divide number of calls by number of threads to avoid |
7e2e2b955d15
8036913: make DeoptimizeALot dependent on number of threads
iignatyev
parents:
25468
diff
changeset
|
201 |
// dependence of ZombieAll events frequency on number of threads. |
7e2e2b955d15
8036913: make DeoptimizeALot dependent on number of threads
iignatyev
parents:
25468
diff
changeset
|
202 |
int value = zombieAllCounter / Threads::number_of_threads(); |
7e2e2b955d15
8036913: make DeoptimizeALot dependent on number of threads
iignatyev
parents:
25468
diff
changeset
|
203 |
if (is_init_completed() && value > ZombieALotInterval) { |
1 | 204 |
zombieAllCounter = 0; |
205 |
VM_ZombieAll op; |
|
206 |
VMThread::execute(&op); |
|
207 |
} |
|
27451
7e2e2b955d15
8036913: make DeoptimizeALot dependent on number of threads
iignatyev
parents:
25468
diff
changeset
|
208 |
zombieAllCounter++; |
1 | 209 |
} |
210 |
||
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
211 |
void InterfaceSupport::unlinkSymbols() { |
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
212 |
VM_UnlinkSymbols op; |
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
213 |
VMThread::execute(&op); |
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
214 |
} |
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
215 |
|
1 | 216 |
void InterfaceSupport::deoptimizeAll() { |
27451
7e2e2b955d15
8036913: make DeoptimizeALot dependent on number of threads
iignatyev
parents:
25468
diff
changeset
|
217 |
// This method is called by all threads when a thread make |
7e2e2b955d15
8036913: make DeoptimizeALot dependent on number of threads
iignatyev
parents:
25468
diff
changeset
|
218 |
// transition to VM state (for example, runtime calls). |
7e2e2b955d15
8036913: make DeoptimizeALot dependent on number of threads
iignatyev
parents:
25468
diff
changeset
|
219 |
// Divide number of calls by number of threads to avoid |
7e2e2b955d15
8036913: make DeoptimizeALot dependent on number of threads
iignatyev
parents:
25468
diff
changeset
|
220 |
// dependence of DeoptimizeAll events frequency on number of threads. |
7e2e2b955d15
8036913: make DeoptimizeALot dependent on number of threads
iignatyev
parents:
25468
diff
changeset
|
221 |
int value = deoptimizeAllCounter / Threads::number_of_threads(); |
7e2e2b955d15
8036913: make DeoptimizeALot dependent on number of threads
iignatyev
parents:
25468
diff
changeset
|
222 |
if (is_init_completed()) { |
7e2e2b955d15
8036913: make DeoptimizeALot dependent on number of threads
iignatyev
parents:
25468
diff
changeset
|
223 |
if (DeoptimizeALot && value > DeoptimizeALotInterval) { |
1 | 224 |
deoptimizeAllCounter = 0; |
225 |
VM_DeoptimizeAll op; |
|
226 |
VMThread::execute(&op); |
|
27451
7e2e2b955d15
8036913: make DeoptimizeALot dependent on number of threads
iignatyev
parents:
25468
diff
changeset
|
227 |
} else if (DeoptimizeRandom && (value & 0x1F) == (os::random() & 0x1F)) { |
1 | 228 |
VM_DeoptimizeAll op; |
229 |
VMThread::execute(&op); |
|
230 |
} |
|
231 |
} |
|
232 |
deoptimizeAllCounter++; |
|
233 |
} |
|
234 |
||
235 |
||
236 |
void InterfaceSupport::stress_derived_pointers() { |
|
237 |
#ifdef COMPILER2 |
|
238 |
JavaThread *thread = JavaThread::current(); |
|
239 |
if (!is_init_completed()) return; |
|
240 |
ResourceMark rm(thread); |
|
241 |
bool found = false; |
|
242 |
for (StackFrameStream sfs(thread); !sfs.is_done() && !found; sfs.next()) { |
|
243 |
CodeBlob* cb = sfs.current()->cb(); |
|
244 |
if (cb != NULL && cb->oop_maps() ) { |
|
245 |
// Find oopmap for current method |
|
30590 | 246 |
const ImmutableOopMap* map = cb->oop_map_for_return_address(sfs.current()->pc()); |
1 | 247 |
assert(map != NULL, "no oopmap found for pc"); |
248 |
found = map->has_derived_pointer(); |
|
249 |
} |
|
250 |
} |
|
251 |
if (found) { |
|
252 |
// $$$ Not sure what to do here. |
|
253 |
/* |
|
254 |
Scavenge::invoke(0); |
|
255 |
*/ |
|
256 |
} |
|
257 |
#endif |
|
258 |
} |
|
259 |
||
260 |
||
261 |
void InterfaceSupport::verify_stack() { |
|
262 |
JavaThread* thread = JavaThread::current(); |
|
263 |
ResourceMark rm(thread); |
|
264 |
// disabled because it throws warnings that oop maps should only be accessed |
|
265 |
// in VM thread or during debugging |
|
266 |
||
267 |
if (!thread->has_pending_exception()) { |
|
268 |
// verification does not work if there are pending exceptions |
|
269 |
StackFrameStream sfs(thread); |
|
270 |
CodeBlob* cb = sfs.current()->cb(); |
|
271 |
// In case of exceptions we might not have a runtime_stub on |
|
272 |
// top of stack, hence, all callee-saved registers are not going |
|
273 |
// to be setup correctly, hence, we cannot do stack verify |
|
274 |
if (cb != NULL && !(cb->is_runtime_stub() || cb->is_uncommon_trap_stub())) return; |
|
275 |
||
276 |
for (; !sfs.is_done(); sfs.next()) { |
|
277 |
sfs.current()->verify(sfs.register_map()); |
|
278 |
} |
|
279 |
} |
|
280 |
} |
|
281 |
||
282 |
||
283 |
void InterfaceSupport::verify_last_frame() { |
|
284 |
JavaThread* thread = JavaThread::current(); |
|
285 |
ResourceMark rm(thread); |
|
286 |
RegisterMap reg_map(thread); |
|
287 |
frame fr = thread->last_frame(); |
|
288 |
fr.verify(®_map); |
|
289 |
} |
|
290 |
||
291 |
||
292 |
#endif // ASSERT |
|
293 |
||
294 |
||
295 |
void InterfaceSupport_init() { |
|
296 |
#ifdef ASSERT |
|
297 |
if (ScavengeALot || FullGCALot) { |
|
298 |
srand(ScavengeALotInterval * FullGCALotInterval); |
|
299 |
} |
|
300 |
#endif |
|
301 |
} |
|
49594
898ef81cbc0e
8200106: Move NoSafepointVerifier out from gcLocker.hpp
stefank
parents:
49480
diff
changeset
|
302 |
|
898ef81cbc0e
8200106: Move NoSafepointVerifier out from gcLocker.hpp
stefank
parents:
49480
diff
changeset
|
303 |
#ifdef ASSERT |
898ef81cbc0e
8200106: Move NoSafepointVerifier out from gcLocker.hpp
stefank
parents:
49480
diff
changeset
|
304 |
// JRT_LEAF rules: |
898ef81cbc0e
8200106: Move NoSafepointVerifier out from gcLocker.hpp
stefank
parents:
49480
diff
changeset
|
305 |
// A JRT_LEAF method may not interfere with safepointing by |
898ef81cbc0e
8200106: Move NoSafepointVerifier out from gcLocker.hpp
stefank
parents:
49480
diff
changeset
|
306 |
// 1) acquiring or blocking on a Mutex or JavaLock - checked |
898ef81cbc0e
8200106: Move NoSafepointVerifier out from gcLocker.hpp
stefank
parents:
49480
diff
changeset
|
307 |
// 2) allocating heap memory - checked |
898ef81cbc0e
8200106: Move NoSafepointVerifier out from gcLocker.hpp
stefank
parents:
49480
diff
changeset
|
308 |
// 3) executing a VM operation - checked |
898ef81cbc0e
8200106: Move NoSafepointVerifier out from gcLocker.hpp
stefank
parents:
49480
diff
changeset
|
309 |
// 4) executing a system call (including malloc) that could block or grab a lock |
898ef81cbc0e
8200106: Move NoSafepointVerifier out from gcLocker.hpp
stefank
parents:
49480
diff
changeset
|
310 |
// 5) invoking GC |
898ef81cbc0e
8200106: Move NoSafepointVerifier out from gcLocker.hpp
stefank
parents:
49480
diff
changeset
|
311 |
// 6) reaching a safepoint |
898ef81cbc0e
8200106: Move NoSafepointVerifier out from gcLocker.hpp
stefank
parents:
49480
diff
changeset
|
312 |
// 7) running too long |
898ef81cbc0e
8200106: Move NoSafepointVerifier out from gcLocker.hpp
stefank
parents:
49480
diff
changeset
|
313 |
// Nor may any method it calls. |
898ef81cbc0e
8200106: Move NoSafepointVerifier out from gcLocker.hpp
stefank
parents:
49480
diff
changeset
|
314 |
JRTLeafVerifier::JRTLeafVerifier() |
898ef81cbc0e
8200106: Move NoSafepointVerifier out from gcLocker.hpp
stefank
parents:
49480
diff
changeset
|
315 |
: NoSafepointVerifier(true, JRTLeafVerifier::should_verify_GC()) |
898ef81cbc0e
8200106: Move NoSafepointVerifier out from gcLocker.hpp
stefank
parents:
49480
diff
changeset
|
316 |
{ |
898ef81cbc0e
8200106: Move NoSafepointVerifier out from gcLocker.hpp
stefank
parents:
49480
diff
changeset
|
317 |
} |
898ef81cbc0e
8200106: Move NoSafepointVerifier out from gcLocker.hpp
stefank
parents:
49480
diff
changeset
|
318 |
|
898ef81cbc0e
8200106: Move NoSafepointVerifier out from gcLocker.hpp
stefank
parents:
49480
diff
changeset
|
319 |
JRTLeafVerifier::~JRTLeafVerifier() |
898ef81cbc0e
8200106: Move NoSafepointVerifier out from gcLocker.hpp
stefank
parents:
49480
diff
changeset
|
320 |
{ |
898ef81cbc0e
8200106: Move NoSafepointVerifier out from gcLocker.hpp
stefank
parents:
49480
diff
changeset
|
321 |
} |
898ef81cbc0e
8200106: Move NoSafepointVerifier out from gcLocker.hpp
stefank
parents:
49480
diff
changeset
|
322 |
|
898ef81cbc0e
8200106: Move NoSafepointVerifier out from gcLocker.hpp
stefank
parents:
49480
diff
changeset
|
323 |
bool JRTLeafVerifier::should_verify_GC() { |
898ef81cbc0e
8200106: Move NoSafepointVerifier out from gcLocker.hpp
stefank
parents:
49480
diff
changeset
|
324 |
switch (JavaThread::current()->thread_state()) { |
898ef81cbc0e
8200106: Move NoSafepointVerifier out from gcLocker.hpp
stefank
parents:
49480
diff
changeset
|
325 |
case _thread_in_Java: |
898ef81cbc0e
8200106: Move NoSafepointVerifier out from gcLocker.hpp
stefank
parents:
49480
diff
changeset
|
326 |
// is in a leaf routine, there must be no safepoint. |
898ef81cbc0e
8200106: Move NoSafepointVerifier out from gcLocker.hpp
stefank
parents:
49480
diff
changeset
|
327 |
return true; |
898ef81cbc0e
8200106: Move NoSafepointVerifier out from gcLocker.hpp
stefank
parents:
49480
diff
changeset
|
328 |
case _thread_in_native: |
898ef81cbc0e
8200106: Move NoSafepointVerifier out from gcLocker.hpp
stefank
parents:
49480
diff
changeset
|
329 |
// A native thread is not subject to safepoints. |
898ef81cbc0e
8200106: Move NoSafepointVerifier out from gcLocker.hpp
stefank
parents:
49480
diff
changeset
|
330 |
// Even while it is in a leaf routine, GC is ok |
898ef81cbc0e
8200106: Move NoSafepointVerifier out from gcLocker.hpp
stefank
parents:
49480
diff
changeset
|
331 |
return false; |
898ef81cbc0e
8200106: Move NoSafepointVerifier out from gcLocker.hpp
stefank
parents:
49480
diff
changeset
|
332 |
default: |
898ef81cbc0e
8200106: Move NoSafepointVerifier out from gcLocker.hpp
stefank
parents:
49480
diff
changeset
|
333 |
// Leaf routines cannot be called from other contexts. |
898ef81cbc0e
8200106: Move NoSafepointVerifier out from gcLocker.hpp
stefank
parents:
49480
diff
changeset
|
334 |
ShouldNotReachHere(); |
898ef81cbc0e
8200106: Move NoSafepointVerifier out from gcLocker.hpp
stefank
parents:
49480
diff
changeset
|
335 |
return false; |
898ef81cbc0e
8200106: Move NoSafepointVerifier out from gcLocker.hpp
stefank
parents:
49480
diff
changeset
|
336 |
} |
898ef81cbc0e
8200106: Move NoSafepointVerifier out from gcLocker.hpp
stefank
parents:
49480
diff
changeset
|
337 |
} |
898ef81cbc0e
8200106: Move NoSafepointVerifier out from gcLocker.hpp
stefank
parents:
49480
diff
changeset
|
338 |
#endif // ASSERT |