@@ -321,19 +321,18 @@ class ContinuationHelper {
321
321
static const int align_wiggle; // size, in words, of maximum shift in frame position due to alignment
322
322
323
323
static oop get_continuation (JavaThread* thread);
324
-
324
+ static inline frame last_frame (JavaThread* thread);
325
325
static bool stack_overflow_check (JavaThread* thread, int size, address sp);
326
+
327
+ static inline void clear_anchor (JavaThread* thread);
326
328
static void set_anchor (JavaThread* thread, intptr_t * sp);
327
329
static void set_anchor_pd (JavaFrameAnchor* anchor, intptr_t * sp);
328
- static inline void clear_anchor (JavaThread* thread);
329
330
static void set_anchor_to_entry (JavaThread* thread, ContinuationEntry* cont);
330
331
static void set_anchor_to_entry_pd (JavaFrameAnchor* anchor, ContinuationEntry* cont);
331
332
332
- static void update_map_for_chunk_frame (RegisterMap* map);
333
- template <typename FKind, typename RegisterMapT> static void update_register_map (RegisterMapT* map, const frame& f); // TODO invert parameter order
334
- template <typename RegisterMapT> static void update_register_map_with_callee (RegisterMapT* map, const frame& f); // TODO invert parameter order
333
+ template <typename FKind, typename RegisterMapT> static void update_register_map (const frame& f, RegisterMapT* map);
334
+ template <typename RegisterMapT> static void update_register_map_with_callee (const frame& f, RegisterMapT* map);
335
335
336
- static inline frame last_frame (JavaThread* thread);
337
336
static inline void push_pd (const frame& f);
338
337
339
338
static inline void maybe_flush_stack_processing (JavaThread* thread, ContinuationEntry* entry);
@@ -362,6 +361,10 @@ bool ContinuationHelper::stack_overflow_check(JavaThread* thread, int size, addr
362
361
return true ;
363
362
}
364
363
364
+ inline void ContinuationHelper::clear_anchor (JavaThread* thread) {
365
+ thread->frame_anchor ()->clear ();
366
+ }
367
+
365
368
void ContinuationHelper::set_anchor (JavaThread* thread, intptr_t * sp) {
366
369
address pc = *(address*)(sp - frame::sender_sp_ret_address_offset ());
367
370
assert (pc != nullptr , " " );
@@ -372,15 +375,9 @@ void ContinuationHelper::set_anchor(JavaThread* thread, intptr_t* sp) {
372
375
set_anchor_pd (anchor, sp);
373
376
374
377
assert (thread->has_last_Java_frame (), " " );
375
- log_develop_trace (jvmcont)(" set_anchor: [" JLONG_FORMAT " ] [%d]" , java_tid (thread), thread->osthread ()->thread_id ());
376
- print_vframe (thread->last_frame ());
377
378
assert (thread->last_frame ().cb () != nullptr , " " );
378
379
}
379
380
380
- inline void ContinuationHelper::clear_anchor (JavaThread* thread) {
381
- thread->frame_anchor ()->clear ();
382
- }
383
-
384
381
void ContinuationHelper::set_anchor_to_entry (JavaThread* thread, ContinuationEntry* cont) {
385
382
JavaFrameAnchor* anchor = thread->frame_anchor ();
386
383
anchor->set_last_Java_sp (cont->entry_sp ());
@@ -389,8 +386,6 @@ void ContinuationHelper::set_anchor_to_entry(JavaThread* thread, ContinuationEnt
389
386
390
387
assert (thread->has_last_Java_frame (), " " );
391
388
assert (thread->last_frame ().cb () != nullptr , " " );
392
- log_develop_trace (jvmcont)(" set_anchor: [" JLONG_FORMAT " ] [%d]" , java_tid (thread), thread->osthread ()->thread_id ());
393
- print_vframe (thread->last_frame ());
394
389
}
395
390
396
391
inline void ContinuationHelper::maybe_flush_stack_processing (JavaThread* thread, ContinuationEntry* entry) {
@@ -446,7 +441,7 @@ class ContMirror {
446
441
JavaThread* thread () const { return _thread; }
447
442
oop mirror () { return _cont; }
448
443
stackChunkOop tail () const { return _tail; }
449
- void set_tail (stackChunkOop chunk) { _tail = chunk; }
444
+ void set_tail (stackChunkOop chunk) { _tail = chunk; }
450
445
inline void set_empty () { _tail = nullptr ; }
451
446
452
447
oop parent () { return jdk_internal_vm_Continuation::parent (_cont); }
@@ -1145,9 +1140,9 @@ class Freeze {
1145
1140
intptr_t *_top_address;
1146
1141
1147
1142
int _size; // total size of all frames plus metadata in words. keeps track of offset where a frame should be written and how many bytes we need to allocate.
1148
- int _frames;
1149
1143
int _align_size;
1150
1144
1145
+ NOT_PRODUCT (int _frames;)
1151
1146
DEBUG_ONLY (intptr_t * _last_write;)
1152
1147
1153
1148
inline void set_top_frame_metadata_pd (const frame& hf);
@@ -1186,13 +1181,10 @@ class Freeze {
1186
1181
1187
1182
void init_rest () { // we want to postpone some initialization after chunk handling
1188
1183
_size = 0 ;
1189
- _frames = 0 ;
1190
1184
_align_size = 0 ;
1185
+ NOT_PRODUCT (_frames = 0 ;)
1191
1186
}
1192
1187
1193
- int nr_bytes () const { return _size << LogBytesPerWord; }
1194
- int nr_frames () const { return _frames; }
1195
-
1196
1188
template <bool aligned = true >
1197
1189
void copy_to_chunk (intptr_t * from, intptr_t * to, int size) {
1198
1190
stackChunkOop chunk = _cont.tail ();
@@ -1201,8 +1193,10 @@ class Freeze {
1201
1193
1202
1194
#ifdef ASSERT
1203
1195
if (_last_write != nullptr ) {
1204
- assert (_last_write == to + size, " Missed a spot: _last_write: " INTPTR_FORMAT " to+size: " INTPTR_FORMAT " stack_size: %d _last_write offset: " PTR_FORMAT " to+size: " PTR_FORMAT,
1205
- p2i (_last_write), p2i (to + size), chunk->stack_size (), _last_write - chunk->start_address (), to + size - chunk->start_address ());
1196
+ assert (_last_write == to + size, " Missed a spot: _last_write: " INTPTR_FORMAT " to+size: " INTPTR_FORMAT
1197
+ " stack_size: %d _last_write offset: " PTR_FORMAT " to+size: " PTR_FORMAT,
1198
+ p2i (_last_write), p2i (to + size),
1199
+ chunk->stack_size (), _last_write - chunk->start_address (), to + size - chunk->start_address ());
1206
1200
_last_write = to;
1207
1201
}
1208
1202
#endif
@@ -1316,7 +1310,6 @@ class Freeze {
1316
1310
chunk->set_max_size (chunk->max_size () + size - argsize);
1317
1311
1318
1312
intptr_t * const bottom_sp = bottom - argsize;
1319
- log_develop_trace (jvmcont)(" patching bottom sp: " INTPTR_FORMAT, p2i (bottom_sp));
1320
1313
assert (bottom_sp == _bottom_address, " " );
1321
1314
assert (*(address*)(bottom_sp - frame::sender_sp_ret_address_offset ()) == StubRoutines::cont_returnBarrier (), " " );
1322
1315
patch_chunk_pd (bottom_sp, chunk->sp_address ());
@@ -1375,7 +1368,6 @@ class Freeze {
1375
1368
assert (chunk->is_stackChunk (), " " );
1376
1369
assert (!chunk->requires_barriers (), " " );
1377
1370
assert (chunk == _cont.tail (), " " );
1378
- // assert (chunk == jdk_internal_vm_Continuation::tail(_cont.mirror()), "");
1379
1371
// assert (!chunk->is_gc_mode(), "allocated: %d empty: %d", allocated, empty);
1380
1372
assert (sp <= chunk->stack_size (), " sp: %d chunk size: %d size: %d argsize: %d allocated: %d" , sp, chunk->stack_size (), size, argsize, allocated);
1381
1373
@@ -1394,7 +1386,6 @@ class Freeze {
1394
1386
1395
1387
// patch pc
1396
1388
intptr_t * chunk_bottom_sp = chunk_top + size - argsize;
1397
- log_develop_trace (jvmcont)(" freeze_fast patching return address at: " INTPTR_FORMAT " to: " INTPTR_FORMAT, p2i (chunk_bottom_sp - frame::sender_sp_ret_address_offset ()), p2i (chunk->pc ()));
1398
1389
assert (empty || *(address*)(chunk_bottom_sp - frame::sender_sp_ret_address_offset ()) == StubRoutines::cont_returnBarrier (), " " );
1399
1390
*(address*)(chunk_bottom_sp - frame::sender_sp_ret_address_offset ()) = chunk->pc ();
1400
1391
@@ -1432,7 +1423,6 @@ class Freeze {
1432
1423
#endif
1433
1424
1434
1425
log_develop_trace (jvmcont)(" freeze_slow #" INTPTR_FORMAT, _cont.hash ());
1435
-
1436
1426
assert (_thread->thread_state () == _thread_in_vm || _thread->thread_state () == _thread_blocked, " " );
1437
1427
1438
1428
init_rest ();
@@ -1535,7 +1525,7 @@ class Freeze {
1535
1525
// log_develop_trace(jvmcont)("recurse_freeze_java_frame fsize: %d frame_bottom: " INTPTR_FORMAT " _bottom_address: " INTPTR_FORMAT, fsize, p2i(FKind::frame_bottom(f)), p2i(_bottom_address));
1536
1526
1537
1527
assert (fsize > 0 && argsize >= 0 , " " );
1538
- _frames++;
1528
+ NOT_PRODUCT ( _frames++;)
1539
1529
_size += fsize;
1540
1530
1541
1531
if (FKind::frame_bottom (f) >= _bottom_address - 1 ) { // sometimes there's a space between enterSpecial and the next frame
@@ -1576,7 +1566,7 @@ class Freeze {
1576
1566
#endif
1577
1567
1578
1568
assert (FKind::interpreted || argsize == _cont.argsize (), " argsize: %d _cont.argsize(): %d" , argsize, _cont.argsize ());
1579
- log_develop_trace (jvmcont)(" bottom: " INTPTR_FORMAT " count %d size: %d argsize: %d" , p2i (_bottom_address), nr_frames (), nr_bytes () , argsize);
1569
+ log_develop_trace (jvmcont)(" bottom: " INTPTR_FORMAT " count %d size: %d argsize: %d" , p2i (_bottom_address), _frames, _size << LogBytesPerWord , argsize);
1580
1570
1581
1571
#ifdef ASSERT
1582
1572
bool empty = _cont.is_empty ();
@@ -1848,12 +1838,12 @@ class Freeze {
1848
1838
f.cb ()->name (), _size, fsize, p2i (vsp), p2i (vsp+fsize));
1849
1839
1850
1840
// we're inlining recurse_freeze_java_frame and freeze here because we need to use a full RegisterMap to test lock ownership
1851
- _frames++;
1841
+ NOT_PRODUCT ( _frames++;)
1852
1842
_size += fsize;
1853
1843
1854
1844
RegisterMap map (_cont.thread (), true , false , false );
1855
1845
map.set_include_argument_oops (false );
1856
- ContinuationHelper::update_register_map<StubF>(&map, f );
1846
+ ContinuationHelper::update_register_map<StubF>(f, &map );
1857
1847
f.oop_map ()->update_register_map (&f, &map); // we have callee-save registers in this case
1858
1848
frame senderf = sender<StubF>(f);
1859
1849
assert (senderf.unextended_sp () < _bottom_address - 1 , " " );
@@ -2793,7 +2783,7 @@ class Thaw {
2793
2783
2794
2784
if (f.is_deoptimized_frame ()) {
2795
2785
maybe_set_fastpath (f.sp ());
2796
- } else if (_thread->is_interp_only_mode ()
2786
+ } else if (_thread->is_interp_only_mode ()
2797
2787
|| (_cont.is_preempted () && f.cb ()->as_compiled_method ()->is_marked_for_deoptimization ())) {
2798
2788
// The caller of the safepoint stub when the continuation is preempted is not at a call instruction, and so
2799
2789
// cannot rely on nmethod patching for deopt.
@@ -2860,7 +2850,7 @@ class Thaw {
2860
2850
RegisterMap map (nullptr , true , false , false ); // map.clear();
2861
2851
map.set_include_argument_oops (false );
2862
2852
f.oop_map ()->update_register_map (&f, &map);
2863
- ContinuationHelper::update_register_map_with_callee (&map, caller );
2853
+ ContinuationHelper::update_register_map_with_callee (caller, &map );
2864
2854
InstanceStackChunkKlass::fix_thawed_frame (_cont.tail (), caller, &map);
2865
2855
}
2866
2856
@@ -3024,7 +3014,7 @@ void do_deopt_after_thaw(JavaThread* thread) {
3024
3014
int i = 0 ;
3025
3015
StackFrameStream fst (thread, true , false );
3026
3016
fst.register_map ()->set_include_argument_oops (false );
3027
- ContinuationHelper::update_register_map_with_callee (fst.register_map (), * fst.current ());
3017
+ ContinuationHelper::update_register_map_with_callee (* fst.current (), fst.register_map ());
3028
3018
for (; !fst.is_done (); fst.next ()) {
3029
3019
if (fst.current ()->cb ()->is_compiled ()) {
3030
3020
CompiledMethod* cm = fst.current ()->cb ()->as_compiled_method ();
@@ -3045,7 +3035,7 @@ bool do_verify_after_thaw(JavaThread* thread, int mode, bool barriers, stackChun
3045
3035
int i = 0 ;
3046
3036
StackFrameStream fst (thread, true , false );
3047
3037
fst.register_map ()->set_include_argument_oops (false );
3048
- ContinuationHelper::update_register_map_with_callee (fst.register_map (), * fst.current ());
3038
+ ContinuationHelper::update_register_map_with_callee (* fst.current (), fst.register_map ());
3049
3039
for (; !fst.is_done () && !Continuation::is_continuation_enterSpecial (*fst.current ()); fst.next ()) {
3050
3040
if (fst.current ()->cb ()->is_compiled () && fst.current ()->cb ()->as_compiled_method ()->is_marked_for_deoptimization ()) {
3051
3041
tty->print_cr (" >>> do_verify_after_thaw deopt" );
0 commit comments