< prev index next >

src/hotspot/cpu/riscv/continuationFreezeThaw_riscv.inline.hpp

Print this page

  1 /*
  2  * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved.
  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  *
 19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 20  * or visit www.oracle.com if you need additional information or have any
 21  * questions.
 22  *

 57 inline frame FreezeBase::sender(const frame& f) {
 58   assert(FKind::is_instance(f), "");
 59   if (FKind::interpreted) {
 60     return frame(f.sender_sp(), f.interpreter_frame_sender_sp(), f.link(), f.sender_pc());
 61   }
 62 
 63   intptr_t** link_addr = link_address<FKind>(f);
 64   intptr_t* sender_sp = (intptr_t*)(link_addr + 2); //  f.unextended_sp() + (fsize/wordSize); //
 65   address sender_pc = (address) *(sender_sp - 1);
 66   assert(sender_sp != f.sp(), "must have changed");
 67 
 68   int slot = 0;
 69   CodeBlob* sender_cb = CodeCache::find_blob_and_oopmap(sender_pc, slot);
 70   return sender_cb != nullptr
 71     ? frame(sender_sp, sender_sp, *link_addr, sender_pc, sender_cb,
 72             slot == -1 ? nullptr : sender_cb->oop_map_for_slot(slot, sender_pc),
 73             false /* on_heap ? */)
 74     : frame(sender_sp, sender_sp, *link_addr, sender_pc);
 75 }
 76 
 77 template<typename FKind> frame FreezeBase::new_heap_frame(frame& f, frame& caller) {

 78   assert(FKind::is_instance(f), "");
 79   assert(!caller.is_interpreted_frame()
 80     || caller.unextended_sp() == (intptr_t*)caller.at(frame::interpreter_frame_last_sp_offset), "");
 81 
 82   intptr_t *sp, *fp; // sp is really our unextended_sp
 83   if (FKind::interpreted) {
 84     assert((intptr_t*)f.at(frame::interpreter_frame_last_sp_offset) == nullptr
 85       || f.unextended_sp() == (intptr_t*)f.at_relative(frame::interpreter_frame_last_sp_offset), "");
 86     intptr_t locals_offset = *f.addr_at(frame::interpreter_frame_locals_offset);
 87     // If the caller.is_empty(), i.e. we're freezing into an empty chunk, then we set
 88     // the chunk's argsize in finalize_freeze and make room for it above the unextended_sp
 89     bool overlap_caller = caller.is_interpreted_frame() || caller.is_empty();
 90     fp = caller.unextended_sp() - 1 - locals_offset + (overlap_caller ? ContinuationHelper::InterpretedFrame::stack_argsize(f) : 0);
 91     sp = fp - (f.fp() - f.unextended_sp());
 92     assert(sp <= fp, "");
 93     assert(fp <= caller.unextended_sp(), "");
 94     caller.set_sp(fp + frame::sender_sp_offset);
 95 
 96     assert(_cont.tail()->is_in_chunk(sp), "");
 97 
 98     frame hf(sp, sp, fp, f.pc(), nullptr, nullptr, true /* on_heap */);
 99     *hf.addr_at(frame::interpreter_frame_locals_offset) = locals_offset;
100     return hf;
101   } else {
102     // We need to re-read fp out of the frame because it may be an oop and we might have
103     // had a safepoint in finalize_freeze, after constructing f.
104     fp = *(intptr_t**)(f.sp() - 2);
105 
106     int fsize = FKind::size(f);
107     sp = caller.unextended_sp() - fsize;
108     if (caller.is_interpreted_frame()) {
109       // If the caller is interpreted, our stackargs are not supposed to overlap with it
110       // so we make more room by moving sp down by argsize
111       int argsize = FKind::stack_argsize(f);
112       sp -= argsize;

113     }
114     caller.set_sp(sp + fsize);
115 
116     assert(_cont.tail()->is_in_chunk(sp), "");
117 
118     return frame(sp, sp, fp, f.pc(), nullptr, nullptr, true /* on_heap */);
119   }
120 }
121 
122 void FreezeBase::adjust_interpreted_frame_unextended_sp(frame& f) {
123   assert((f.at(frame::interpreter_frame_last_sp_offset) != 0) || (f.unextended_sp() == f.sp()), "");
124   intptr_t* real_unextended_sp = (intptr_t*)f.at_relative_or_null(frame::interpreter_frame_last_sp_offset);
125   if (real_unextended_sp != nullptr) {
126     f.set_unextended_sp(real_unextended_sp); // can be null at a safepoint
127   }
128 }
129 
130 inline void FreezeBase::prepare_freeze_interpreted_top_frame(frame& f) {
131   assert(f.interpreter_frame_last_sp() == nullptr, "should be null for top frame");
132   f.interpreter_frame_set_last_sp(f.unextended_sp());
133 }
134 

165   assert(hf.fp()            >  (intptr_t*)hf.at(frame::interpreter_frame_initial_sp_offset), "");
166 #ifdef ASSERT
167   if (f.interpreter_frame_method()->max_locals() > 0) {
168     assert(hf.fp()          <= (intptr_t*)hf.at(frame::interpreter_frame_locals_offset), "");
169   }
170 #endif
171 }
172 
173 inline void FreezeBase::set_top_frame_metadata_pd(const frame& hf) {
174   stackChunkOop chunk = _cont.tail();
175   assert(chunk->is_in_chunk(hf.sp() - 1), "");
176   assert(chunk->is_in_chunk(hf.sp() - 2), "");
177 
178   *(hf.sp() - 1) = (intptr_t)hf.pc();
179 
180   intptr_t* fp_addr = hf.sp() - 2;
181   *fp_addr = hf.is_interpreted_frame() ? (intptr_t)(hf.fp() - fp_addr)
182                                        : (intptr_t)hf.fp();
183 }
184 
185 inline void FreezeBase::patch_pd(frame& hf, const frame& caller) {
186   if (caller.is_interpreted_frame()) {
187     assert(!caller.is_empty(), "");
188     patch_callee_link_relative(caller, caller.fp());
189   } else {

190     // If we're the bottom-most frame frozen in this freeze, the caller might have stayed frozen in the chunk,
191     // and its oop-containing fp fixed. We've now just overwritten it, so we must patch it back to its value
192     // as read from the chunk.
193     patch_callee_link(caller, caller.fp());
194   }
195 }
196 
197 inline void FreezeBase::patch_pd_unused(intptr_t* sp) {
198 }
199 
200 //////// Thaw
201 
202 // Fast path
203 
204 inline void ThawBase::prefetch_chunk_pd(void* start, int size) {
205   size <<= LogBytesPerWord;
206   Prefetch::read(start, size);
207   Prefetch::read(start, size - 64);
208 }
209 

239     if (sp != _last_sp_from_frame) {
240       sp[-1] = (intptr_t)_top_frame.pc();
241     }
242   }
243 }
244 
245 template <typename ConfigT>
246 inline void Thaw<ConfigT>::patch_caller_links(intptr_t* sp, intptr_t* bottom) {
247   // Fast path depends on !PreserveFramePointer. See can_thaw_fast().
248   assert(!PreserveFramePointer, "Frame pointers need to be fixed");
249 }
250 
251 // Slow path
252 
253 inline frame ThawBase::new_entry_frame() {
254   intptr_t* sp = _cont.entrySP();
255   // TODO PERF: This finds code blob and computes deopt state
256   return frame(sp, sp, _cont.entryFP(), _cont.entryPC());
257 }
258 
259 template<typename FKind> frame ThawBase::new_stack_frame(const frame& hf, frame& caller, bool bottom) {

260   assert(FKind::is_instance(hf), "");
261   // The values in the returned frame object will be written into the callee's stack in patch.
262 
263   if (FKind::interpreted) {
264     intptr_t* heap_sp = hf.unextended_sp();
265     // If caller is interpreted it already made room for the callee arguments
266     int overlap = caller.is_interpreted_frame() ? ContinuationHelper::InterpretedFrame::stack_argsize(hf) : 0;
267     const int fsize = (int)(ContinuationHelper::InterpretedFrame::frame_bottom(hf) - hf.unextended_sp() - overlap);
268     intptr_t* frame_sp = caller.unextended_sp() - fsize;
269     intptr_t* fp = frame_sp + (hf.fp() - heap_sp);
270     if ((intptr_t)fp % frame::frame_alignment != 0) {
271       fp--;
272       frame_sp--;
273       log_develop_trace(continuations)("Adding internal interpreted frame alignment");
274     }
275     DEBUG_ONLY(intptr_t* unextended_sp = fp + *hf.addr_at(frame::interpreter_frame_last_sp_offset);)
276     assert(frame_sp == unextended_sp, "");
277     caller.set_sp(fp + frame::sender_sp_offset);
278     frame f(frame_sp, frame_sp, fp, hf.pc());
279     // we need to set the locals so that the caller of new_stack_frame() can call
280     // ContinuationHelper::InterpretedFrame::frame_bottom
281     // copy relativized locals from the heap frame
282     *f.addr_at(frame::interpreter_frame_locals_offset) = *hf.addr_at(frame::interpreter_frame_locals_offset);
283     assert((intptr_t)f.fp() % frame::frame_alignment == 0, "");
284     return f;
285   } else {
286     int fsize = FKind::size(hf);
287     intptr_t* frame_sp = caller.unextended_sp() - fsize;
288     if (bottom || caller.is_interpreted_frame()) {
289       int argsize = FKind::stack_argsize(hf);
290 
291       fsize += argsize;
292       frame_sp -= argsize;
293       caller.set_sp(caller.sp() - argsize);
294       assert(caller.sp() == frame_sp + (fsize-argsize), "");
295 
296       frame_sp = align(hf, frame_sp, caller, bottom);

297     }

298 
299     assert(hf.cb() != nullptr, "");
300     assert(hf.oop_map() != nullptr, "");
301     intptr_t* fp;
302     if (PreserveFramePointer) {
303       // we need to recreate a "real" frame pointer, pointing into the stack
304       fp = frame_sp + FKind::size(hf) - frame::sender_sp_offset;
305     } else {
306       fp = FKind::stub || FKind::native
307         // fp always points to the address above the pushed return pc. We need correct address.
308         ? frame_sp + fsize - frame::sender_sp_offset
309         // we need to re-read fp because it may be an oop and we might have fixed the frame.
310         : *(intptr_t**)(hf.sp() - 2);
311     }
312     // TODO PERF : this computes deopt state; is it necessary?
313     return frame(frame_sp, frame_sp, fp, hf.pc(), hf.cb(), hf.oop_map(), false);
314   }
315 }
316 
317 inline intptr_t* ThawBase::align(const frame& hf, intptr_t* frame_sp, frame& caller, bool bottom) {
318 #ifdef _LP64
319   if (((intptr_t)frame_sp & 0xf) != 0) {
320     assert(caller.is_interpreted_frame() || (bottom && hf.compiled_frame_stack_argsize() % 2 != 0), "");
321     frame_sp--;
322     caller.set_sp(caller.sp() - 1);
323   }
324   assert(is_aligned(frame_sp, frame::frame_alignment), "");
325 #endif
326 
327   return frame_sp;
328 }
329 
330 inline void ThawBase::patch_pd(frame& f, const frame& caller) {
331   patch_callee_link(caller, caller.fp());


332 }
333 
334 inline void ThawBase::patch_pd(frame& f, intptr_t* caller_sp) {
335   intptr_t* fp = caller_sp - frame::sender_sp_offset;
336   patch_callee_link(f, fp);
337 }
338 
339 inline intptr_t* ThawBase::push_cleanup_continuation() {
340   frame enterSpecial = new_entry_frame();
341   intptr_t* sp = enterSpecial.sp();
342 
343   // We only need to set the return pc. fp will be restored back in gen_continuation_enter().
344   sp[-1] = (intptr_t)ContinuationEntry::cleanup_pc();
345   return sp;
346 }
347 
348 inline intptr_t* ThawBase::push_preempt_adapter() {
349   frame enterSpecial = new_entry_frame();
350   intptr_t* sp = enterSpecial.sp();
351 

  1 /*
  2  * Copyright (c) 2019, 2026, Oracle and/or its affiliates. All rights reserved.
  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  *
 19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 20  * or visit www.oracle.com if you need additional information or have any
 21  * questions.
 22  *

 57 inline frame FreezeBase::sender(const frame& f) {
 58   assert(FKind::is_instance(f), "");
 59   if (FKind::interpreted) {
 60     return frame(f.sender_sp(), f.interpreter_frame_sender_sp(), f.link(), f.sender_pc());
 61   }
 62 
 63   intptr_t** link_addr = link_address<FKind>(f);
 64   intptr_t* sender_sp = (intptr_t*)(link_addr + 2); //  f.unextended_sp() + (fsize/wordSize); //
 65   address sender_pc = (address) *(sender_sp - 1);
 66   assert(sender_sp != f.sp(), "must have changed");
 67 
 68   int slot = 0;
 69   CodeBlob* sender_cb = CodeCache::find_blob_and_oopmap(sender_pc, slot);
 70   return sender_cb != nullptr
 71     ? frame(sender_sp, sender_sp, *link_addr, sender_pc, sender_cb,
 72             slot == -1 ? nullptr : sender_cb->oop_map_for_slot(slot, sender_pc),
 73             false /* on_heap ? */)
 74     : frame(sender_sp, sender_sp, *link_addr, sender_pc);
 75 }
 76 
 77 template<typename FKind>
 78 frame FreezeBase::new_heap_frame(frame& f, frame& caller, int size_adjust) {
 79   assert(FKind::is_instance(f), "");
 80   assert(!caller.is_interpreted_frame()
 81     || caller.unextended_sp() == (intptr_t*)caller.at(frame::interpreter_frame_last_sp_offset), "");
 82 
 83   intptr_t *sp, *fp; // sp is really our unextended_sp
 84   if (FKind::interpreted) {
 85     assert((intptr_t*)f.at(frame::interpreter_frame_last_sp_offset) == nullptr
 86       || f.unextended_sp() == (intptr_t*)f.at_relative(frame::interpreter_frame_last_sp_offset), "");
 87     intptr_t locals_offset = *f.addr_at(frame::interpreter_frame_locals_offset);
 88     // If the caller.is_empty(), i.e. we're freezing into an empty chunk, then we set
 89     // the chunk's argsize in finalize_freeze and make room for it above the unextended_sp
 90     bool overlap_caller = caller.is_interpreted_frame() || caller.is_empty();
 91     fp = caller.unextended_sp() - 1 - locals_offset + (overlap_caller ? ContinuationHelper::InterpretedFrame::stack_argsize(f) : 0);
 92     sp = fp - (f.fp() - f.unextended_sp());
 93     assert(sp <= fp, "");
 94     assert(fp <= caller.unextended_sp(), "");
 95     caller.set_sp(fp + frame::sender_sp_offset);
 96 
 97     assert(_cont.tail()->is_in_chunk(sp), "");
 98 
 99     frame hf(sp, sp, fp, f.pc(), nullptr, nullptr, true /* on_heap */);
100     *hf.addr_at(frame::interpreter_frame_locals_offset) = locals_offset;
101     return hf;
102   } else {
103     // We need to re-read fp out of the frame because it may be an oop and we might have
104     // had a safepoint in finalize_freeze, after constructing f.
105     fp = *(intptr_t**)(f.sp() - 2);
106 
107     int fsize = FKind::size(f);
108     sp = caller.unextended_sp() - fsize - size_adjust;
109     if (caller.is_interpreted_frame() && size_adjust == 0) {
110       // If the caller is interpreted, our stackargs are not supposed to overlap with it
111       // so we make more room by moving sp down by argsize
112       int argsize = FKind::stack_argsize(f);
113       sp -= argsize;
114       caller.set_sp(sp + fsize);
115     }

116 
117     assert(_cont.tail()->is_in_chunk(sp), "");
118 
119     return frame(sp, sp, fp, f.pc(), nullptr, nullptr, true /* on_heap */);
120   }
121 }
122 
123 void FreezeBase::adjust_interpreted_frame_unextended_sp(frame& f) {
124   assert((f.at(frame::interpreter_frame_last_sp_offset) != 0) || (f.unextended_sp() == f.sp()), "");
125   intptr_t* real_unextended_sp = (intptr_t*)f.at_relative_or_null(frame::interpreter_frame_last_sp_offset);
126   if (real_unextended_sp != nullptr) {
127     f.set_unextended_sp(real_unextended_sp); // can be null at a safepoint
128   }
129 }
130 
131 inline void FreezeBase::prepare_freeze_interpreted_top_frame(frame& f) {
132   assert(f.interpreter_frame_last_sp() == nullptr, "should be null for top frame");
133   f.interpreter_frame_set_last_sp(f.unextended_sp());
134 }
135 

166   assert(hf.fp()            >  (intptr_t*)hf.at(frame::interpreter_frame_initial_sp_offset), "");
167 #ifdef ASSERT
168   if (f.interpreter_frame_method()->max_locals() > 0) {
169     assert(hf.fp()          <= (intptr_t*)hf.at(frame::interpreter_frame_locals_offset), "");
170   }
171 #endif
172 }
173 
174 inline void FreezeBase::set_top_frame_metadata_pd(const frame& hf) {
175   stackChunkOop chunk = _cont.tail();
176   assert(chunk->is_in_chunk(hf.sp() - 1), "");
177   assert(chunk->is_in_chunk(hf.sp() - 2), "");
178 
179   *(hf.sp() - 1) = (intptr_t)hf.pc();
180 
181   intptr_t* fp_addr = hf.sp() - 2;
182   *fp_addr = hf.is_interpreted_frame() ? (intptr_t)(hf.fp() - fp_addr)
183                                        : (intptr_t)hf.fp();
184 }
185 
186 inline void FreezeBase::patch_pd(frame& hf, const frame& caller, bool is_bottom_frame) {
187   if (caller.is_interpreted_frame()) {
188     assert(!caller.is_empty(), "");
189     patch_callee_link_relative(caller, caller.fp());
190   } else if (is_bottom_frame && caller.pc() != nullptr) {
191     assert(caller.is_compiled_frame(), "");
192     // If we're the bottom-most frame frozen in this freeze, the caller might have stayed frozen in the chunk,
193     // and its oop-containing fp fixed. We've now just overwritten it, so we must patch it back to its value
194     // as read from the chunk.
195     patch_callee_link(caller, caller.fp());
196   }
197 }
198 
199 inline void FreezeBase::patch_pd_unused(intptr_t* sp) {
200 }
201 
202 //////// Thaw
203 
204 // Fast path
205 
206 inline void ThawBase::prefetch_chunk_pd(void* start, int size) {
207   size <<= LogBytesPerWord;
208   Prefetch::read(start, size);
209   Prefetch::read(start, size - 64);
210 }
211 

241     if (sp != _last_sp_from_frame) {
242       sp[-1] = (intptr_t)_top_frame.pc();
243     }
244   }
245 }
246 
247 template <typename ConfigT>
248 inline void Thaw<ConfigT>::patch_caller_links(intptr_t* sp, intptr_t* bottom) {
249   // Fast path depends on !PreserveFramePointer. See can_thaw_fast().
250   assert(!PreserveFramePointer, "Frame pointers need to be fixed");
251 }
252 
253 // Slow path
254 
255 inline frame ThawBase::new_entry_frame() {
256   intptr_t* sp = _cont.entrySP();
257   // TODO PERF: This finds code blob and computes deopt state
258   return frame(sp, sp, _cont.entryFP(), _cont.entryPC());
259 }
260 
261 template<typename FKind>
262 frame ThawBase::new_stack_frame(const frame& hf, frame& caller, bool bottom, int size_adjust) {
263   assert(FKind::is_instance(hf), "");
264   // The values in the returned frame object will be written into the callee's stack in patch.
265 
266   if (FKind::interpreted) {
267     intptr_t* heap_sp = hf.unextended_sp();
268     // If caller is interpreted it already made room for the callee arguments
269     int overlap = caller.is_interpreted_frame() ? ContinuationHelper::InterpretedFrame::stack_argsize(hf) : 0;
270     const int fsize = (int)(ContinuationHelper::InterpretedFrame::frame_bottom(hf) - hf.unextended_sp() - overlap);
271     intptr_t* frame_sp = caller.unextended_sp() - fsize;
272     intptr_t* fp = frame_sp + (hf.fp() - heap_sp);
273     if ((intptr_t)fp % frame::frame_alignment != 0) {
274       fp--;
275       frame_sp--;
276       log_develop_trace(continuations)("Adding internal interpreted frame alignment");
277     }
278     DEBUG_ONLY(intptr_t* unextended_sp = fp + *hf.addr_at(frame::interpreter_frame_last_sp_offset);)
279     assert(frame_sp == unextended_sp, "");
280     caller.set_sp(fp + frame::sender_sp_offset);
281     frame f(frame_sp, frame_sp, fp, hf.pc());
282     // we need to set the locals so that the caller of new_stack_frame() can call
283     // ContinuationHelper::InterpretedFrame::frame_bottom
284     // copy relativized locals from the heap frame
285     *f.addr_at(frame::interpreter_frame_locals_offset) = *hf.addr_at(frame::interpreter_frame_locals_offset);
286     assert((intptr_t)f.fp() % frame::frame_alignment == 0, "");
287     return f;
288   } else {
289     int fsize = FKind::size(hf);
290     intptr_t* frame_sp = caller.unextended_sp() - fsize - size_adjust;
291     if (bottom || caller.is_interpreted_frame()) {
292       if (size_adjust == 0) {
293         int argsize = FKind::stack_argsize(hf);
294         frame_sp -= argsize;
295       }



296       frame_sp = align(hf, frame_sp, caller, bottom);
297       caller.set_sp(frame_sp + fsize + size_adjust);
298     }
299     assert(is_aligned(frame_sp, frame::frame_alignment), "");
300 
301     assert(hf.cb() != nullptr, "");
302     assert(hf.oop_map() != nullptr, "");
303     intptr_t* fp;
304     if (PreserveFramePointer) {
305       // we need to recreate a "real" frame pointer, pointing into the stack
306       fp = frame_sp + fsize - frame::sender_sp_offset;
307     } else {
308       fp = FKind::stub || FKind::native
309         // fp always points to the address above the pushed return pc. We need correct address.
310         ? frame_sp + fsize - frame::sender_sp_offset
311         // we need to re-read fp because it may be an oop and we might have fixed the frame.
312         : *(intptr_t**)(hf.sp() - 2);
313     }
314     // TODO PERF : this computes deopt state; is it necessary?
315     return frame(frame_sp, frame_sp, fp, hf.pc(), hf.cb(), hf.oop_map(), false);
316   }
317 }
318 
319 inline intptr_t* ThawBase::align(const frame& hf, intptr_t* frame_sp, frame& caller, bool bottom) {
320 #ifdef _LP64
321   if (((intptr_t)frame_sp & 0xf) != 0) {
322     assert(caller.is_interpreted_frame() || (bottom && hf.compiled_frame_stack_argsize() % 2 != 0), "");
323     frame_sp--;

324   }
325   assert(is_aligned(frame_sp, frame::frame_alignment), "");
326 #endif

327   return frame_sp;
328 }
329 
330 inline void ThawBase::patch_pd(frame& f, const frame& caller) {
331   if (caller.is_interpreted_frame() || PreserveFramePointer) {
332     patch_callee_link(caller, caller.fp());
333   }
334 }
335 
336 inline void ThawBase::patch_pd(frame& f, intptr_t* caller_sp) {
337   intptr_t* fp = caller_sp - frame::sender_sp_offset;
338   patch_callee_link(f, fp);
339 }
340 
341 inline intptr_t* ThawBase::push_cleanup_continuation() {
342   frame enterSpecial = new_entry_frame();
343   intptr_t* sp = enterSpecial.sp();
344 
345   // We only need to set the return pc. fp will be restored back in gen_continuation_enter().
346   sp[-1] = (intptr_t)ContinuationEntry::cleanup_pc();
347   return sp;
348 }
349 
350 inline intptr_t* ThawBase::push_preempt_adapter() {
351   frame enterSpecial = new_entry_frame();
352   intptr_t* sp = enterSpecial.sp();
353 
< prev index next >