@@ -1057,9 +1057,7 @@ class FreezeBase {
1057
1057
inline freeze_result recurse_freeze_java_frame (const frame& f, frame& caller, int fsize, int argsize);
1058
1058
inline void before_freeze_java_frame (const frame& f, const frame& caller, int fsize, int argsize, bool bottom);
1059
1059
inline void after_freeze_java_frame (const frame& hf, bool bottom);
1060
- template <typename FKind> // the callee's type
1061
1060
freeze_result finalize_freeze (const frame& callee, frame& caller, int argsize);
1062
- template <typename FKind>
1063
1061
void patch (const frame& f, frame& hf, const frame& caller, bool bottom);
1064
1062
NOINLINE freeze_result recurse_freeze_interpreted_frame (frame& f, frame& caller, int callee_argsize, bool callee_interpreted);
1065
1063
freeze_result recurse_freeze_compiled_frame (frame& f, frame& caller, int callee_argsize, bool callee_interpreted);
@@ -1068,10 +1066,11 @@ class FreezeBase {
1068
1066
1069
1067
inline bool stack_overflow ();
1070
1068
1069
+ static frame sender (const frame& f) { return f.is_interpreted_frame () ? sender<Interpreted>(f): sender<NonInterpretedUnknown>(f); }
1071
1070
template <typename FKind> static inline frame sender (const frame& f);
1072
1071
template <typename FKind> frame new_hframe (frame& f, frame& caller);
1073
1072
inline void set_top_frame_metadata_pd (const frame& hf);
1074
- template < typename FKind> inline void patch_pd (frame& callee, const frame& caller);
1073
+ inline void patch_pd (frame& callee, const frame& caller);
1075
1074
static inline void relativize_interpreted_frame_metadata (const frame& f, const frame& hf);
1076
1075
1077
1076
protected:
@@ -1464,7 +1463,7 @@ inline freeze_result FreezeBase::recurse_freeze_java_frame(const frame& f, frame
1464
1463
NOT_PRODUCT (_frames++;)
1465
1464
1466
1465
if (FKind::frame_bottom (f) >= _bottom_address - 1 ) { // sometimes there's space after enterSpecial
1467
- return finalize_freeze<FKind> (f, caller, argsize); // recursion end
1466
+ return finalize_freeze (f, caller, argsize); // recursion end
1468
1467
} else {
1469
1468
frame senderf = sender<FKind>(f);
1470
1469
assert (FKind::interpreted || senderf.sp () == senderf.unextended_sp (), " " );
@@ -1498,9 +1497,8 @@ inline void FreezeBase::after_freeze_java_frame(const frame& hf, bool bottom) {
1498
1497
}
1499
1498
}
1500
1499
1501
- template <typename FKind> // the callee's type
1502
1500
freeze_result FreezeBase::finalize_freeze (const frame& callee, frame& caller, int argsize) {
1503
- assert (FKind::interpreted || argsize == _cont.argsize (), " argsize: %d cont.argsize: %d" , argsize, _cont.argsize ());
1501
+ assert (callee. is_interpreted_frame () || argsize == _cont.argsize (), " argsize: %d cont.argsize: %d" , argsize, _cont.argsize ());
1504
1502
log_develop_trace (jvmcont)(" bottom: " INTPTR_FORMAT " count %d size: %d argsize: %d" ,
1505
1503
p2i (_bottom_address), _frames, _size << LogBytesPerWord, argsize);
1506
1504
@@ -1528,7 +1526,7 @@ freeze_result FreezeBase::finalize_freeze(const frame& callee, frame& caller, in
1528
1526
StackChunkFrameStream<chunk_frames::MIXED> last (chunk);
1529
1527
unextended_sp += last.unextended_sp () - last.sp (); // can be negative (-1), often with lambda forms
1530
1528
}
1531
- if (FKind::interpreted == top_interpreted) {
1529
+ if (callee. is_interpreted_frame () == top_interpreted) {
1532
1530
overlap = argsize;
1533
1531
}
1534
1532
}
@@ -1625,37 +1623,33 @@ freeze_result FreezeBase::finalize_freeze(const frame& callee, frame& caller, in
1625
1623
1626
1624
assert (!empty || Continuation::is_continuation_entry_frame (callee, nullptr ), " " );
1627
1625
1628
- frame entry = sender<FKind> (callee);
1626
+ frame entry = sender (callee);
1629
1627
1630
1628
assert (Continuation::is_return_barrier_entry (entry.pc ()) || Continuation::is_continuation_enterSpecial (entry), " " );
1631
- assert (FKind::interpreted || entry.sp () == entry.unextended_sp (), " " );
1629
+ assert (callee. is_interpreted_frame () || entry.sp () == entry.unextended_sp (), " " );
1632
1630
#endif
1633
1631
1634
1632
return freeze_ok_bottom;
1635
1633
}
1636
1634
1637
- template <typename FKind>
1638
1635
void FreezeBase::patch (const frame& f, frame& hf, const frame& caller, bool bottom) {
1639
- assert (FKind::is_instance (f), " " );
1640
-
1641
1636
if (bottom) {
1642
1637
address last_pc = caller.pc ();
1643
1638
assert ((last_pc == nullptr ) == _cont.tail ()->is_empty (), " " );
1644
- FKind ::patch_pc (caller, last_pc);
1639
+ Frame ::patch_pc (caller, last_pc);
1645
1640
} else {
1646
1641
assert (!caller.is_empty (), " " );
1647
1642
}
1648
1643
1649
- patch_pd<FKind> (hf, caller);
1644
+ patch_pd (hf, caller);
1650
1645
1651
- if (FKind::interpreted ) {
1646
+ if (f. is_interpreted_frame () ) {
1652
1647
assert (hf.is_heap_frame (), " should be" );
1653
1648
Interpreted::patch_sender_sp (hf, caller.unextended_sp ());
1654
1649
}
1655
1650
1656
1651
#ifdef ASSERT
1657
- if (!FKind::interpreted && !FKind::stub) {
1658
- assert (hf.get_cb ()->is_compiled (), " " );
1652
+ if (hf.is_compiled_frame ()) {
1659
1653
if (f.is_deoptimized_frame ()) { // TODO DEOPT: long term solution: unroll on freeze and patch pc
1660
1654
log_develop_trace (jvmcont)(" Freezing deoptimized frame" );
1661
1655
assert (f.cb ()->as_compiled_method ()->is_deopt_pc (f.raw_pc ()), " " );
@@ -1721,7 +1715,7 @@ NOINLINE freeze_result FreezeBase::recurse_freeze_interpreted_frame(frame& f, fr
1721
1715
1722
1716
relativize_interpreted_frame_metadata (f, hf);
1723
1717
1724
- patch<Interpreted> (f, hf, caller, bottom);
1718
+ patch (f, hf, caller, bottom);
1725
1719
1726
1720
CONT_JFR_ONLY (_cont.record_interpreted_frame ();)
1727
1721
DEBUG_ONLY (after_freeze_java_frame (hf, bottom);)
@@ -1763,7 +1757,7 @@ freeze_result FreezeBase::recurse_freeze_compiled_frame(frame& f, frame& caller,
1763
1757
_align_size += ContinuationHelper::align_wiggle; // See Thaw::align
1764
1758
}
1765
1759
1766
- patch<Compiled> (f, hf, caller, bottom);
1760
+ patch (f, hf, caller, bottom);
1767
1761
1768
1762
assert (bottom || Interpreter::contains (Compiled::real_pc (caller)) == caller.is_interpreted_frame (), " " );
1769
1763
@@ -2319,14 +2313,11 @@ class ThawBase {
2319
2313
2320
2314
private:
2321
2315
void thaw (const frame& hf, frame& caller, int num_frames, bool top);
2322
- template <typename FKind>
2323
- bool recurse_thaw_java_frame (frame& caller, int num_frames);
2324
- template <typename FKind>
2316
+ template <typename FKind> bool recurse_thaw_java_frame (frame& caller, int num_frames);
2325
2317
void finalize_thaw (frame& entry, int argsize);
2326
2318
2327
2319
inline void before_thaw_java_frame (const frame& hf, const frame& caller, bool bottom, int num_frame);
2328
2320
inline void after_thaw_java_frame (const frame& f, bool bottom);
2329
- template <typename FKind>
2330
2321
inline void patch (frame& f, const frame& caller, bool bottom);
2331
2322
void clear_bitmap_bits (intptr_t * start, int range);
2332
2323
@@ -2338,7 +2329,7 @@ class ThawBase {
2338
2329
void push_return_frame (frame& f);
2339
2330
inline frame new_entry_frame ();
2340
2331
template <typename FKind> frame new_frame (const frame& hf, frame& caller, bool bottom);
2341
- template < typename FKind> inline void patch_pd (frame& f, const frame& sender);
2332
+ inline void patch_pd (frame& f, const frame& sender);
2342
2333
inline intptr_t * align (const frame& hf, intptr_t * vsp, frame& caller, bool bottom);
2343
2334
2344
2335
intptr_t * push_interpreter_return_frame (intptr_t * sp);
@@ -2628,15 +2619,14 @@ bool ThawBase::recurse_thaw_java_frame(frame& caller, int num_frames) {
2628
2619
}
2629
2620
2630
2621
if (num_frames == 1 || _stream.is_done ()) { // end recursion
2631
- finalize_thaw<FKind> (caller, argsize);
2622
+ finalize_thaw (caller, FKind::interpreted ? 0 : argsize);
2632
2623
return true ; // bottom
2633
2624
} else { // recurse
2634
2625
thaw (_stream.to_frame (), caller, num_frames - 1 , false );
2635
2626
return false ;
2636
2627
}
2637
2628
}
2638
2629
2639
- template <typename FKind>
2640
2630
void ThawBase::finalize_thaw (frame& entry, int argsize) {
2641
2631
stackChunkOop chunk = _cont.tail ();
2642
2632
@@ -2655,7 +2645,7 @@ void ThawBase::finalize_thaw(frame& entry, int argsize) {
2655
2645
int delta = _stream.unextended_sp () - _top_unextended_sp;
2656
2646
chunk->set_max_size (chunk->max_size () - delta);
2657
2647
2658
- _cont.set_argsize (FKind::interpreted ? 0 : argsize);
2648
+ _cont.set_argsize (argsize);
2659
2649
entry = new_entry_frame ();
2660
2650
2661
2651
assert (entry.sp () == _cont.entrySP (), " " );
@@ -2683,16 +2673,15 @@ inline void ThawBase::after_thaw_java_frame(const frame& f, bool bottom) {
2683
2673
}
2684
2674
}
2685
2675
2686
- template <typename FKind>
2687
2676
inline void ThawBase::patch (frame& f, const frame& caller, bool bottom) {
2688
2677
assert (!bottom || caller.fp () == _cont.entryFP (), " " );
2689
2678
if (bottom) {
2690
- FKind ::patch_pc (caller, _cont.is_empty () ? caller.raw_pc () : StubRoutines::cont_returnBarrier ());
2679
+ Frame ::patch_pc (caller, _cont.is_empty () ? caller.raw_pc () : StubRoutines::cont_returnBarrier ());
2691
2680
}
2692
2681
2693
- patch_pd<FKind> (f, caller); // TODO: reevaluate if and when this is necessary -only bottom & interpreted caller?
2682
+ patch_pd (f, caller); // TODO: reevaluate if and when this is necessary -only bottom & interpreted caller?
2694
2683
2695
- if (FKind::interpreted ) {
2684
+ if (f. is_interpreted_frame () ) {
2696
2685
Interpreted::patch_sender_sp (f, caller.unextended_sp ());
2697
2686
}
2698
2687
@@ -2744,7 +2733,7 @@ NOINLINE void ThawBase::recurse_thaw_interpreted_frame(const frame& hf, frame& c
2744
2733
2745
2734
set_interpreter_frame_bottom (f, frame_bottom); // the copy overwrites the metadata
2746
2735
derelativize_interpreted_frame_metadata (hf, f);
2747
- patch<Interpreted> (f, caller, bottom);
2736
+ patch (f, caller, bottom);
2748
2737
2749
2738
#ifdef ASSERT
2750
2739
LogTarget (Trace, jvmcont) lt;
@@ -2808,7 +2797,7 @@ void ThawBase::recurse_thaw_compiled_frame(const frame& hf, frame& caller, int n
2808
2797
2809
2798
copy_from_chunk (from, to, sz);
2810
2799
2811
- patch<Compiled> (f, caller, bottom);
2800
+ patch (f, caller, bottom);
2812
2801
2813
2802
if (f.cb ()->is_nmethod ()) {
2814
2803
f.cb ()->as_nmethod ()->run_nmethod_entry_barrier ();
0 commit comments