< prev index next >

src/hotspot/cpu/aarch64/continuationFreezeThaw_aarch64.inline.hpp

Print this page

 42   *la = new_value;
 43 }
 44 
 45 ////// Freeze
 46 
 47 // Fast path
 48 
 49 inline void FreezeBase::patch_stack_pd(intptr_t* frame_sp, intptr_t* heap_sp) {
 50   // copy the spilled fp from the heap to the stack
 51   *(frame_sp - frame::sender_sp_offset) = *(heap_sp - frame::sender_sp_offset);
 52 }
 53 
 54 // Slow path
 55 
 56 template<typename FKind>
 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   intptr_t** link_addr = link_address<FKind>(f);
 63 
 64   intptr_t* sender_sp = (intptr_t*)(link_addr + frame::sender_sp_offset); //  f.unextended_sp() + (fsize/wordSize); //
 65   address sender_pc = ContinuationHelper::return_address_at(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) {
 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     // copy relativized locals from the stack frame
101     *hf.addr_at(frame::interpreter_frame_locals_offset) = locals_offset;
102     return hf;
103   } else {
104     // For a compiled frame we need to re-read fp out of the frame because it may be an
105     // oop and we might have had a safepoint in finalize_freeze, after constructing f.
106     // For stub/native frames the value is not used while frozen, and will be constructed again
107     // when thawing the frame (see ThawBase::new_stack_frame). We use a special bad address to
108     // help with debugging, particularly when inspecting frames and identifying invalid accesses.
109     fp = FKind::compiled ? *(intptr_t**)(f.sp() - frame::sender_sp_offset) : (intptr_t*)badAddressVal;
110 
111     int fsize = FKind::size(f);
112     sp = caller.unextended_sp() - fsize;
113     if (caller.is_interpreted_frame()) {
114       // If the caller is interpreted, our stackargs are not supposed to overlap with it
115       // so we make more room by moving sp down by argsize
116       int argsize = FKind::stack_argsize(f);
117       sp -= argsize;

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

166   assert((hf.fp() - hf.unextended_sp()) == (f.fp() - f.unextended_sp()), "");
167   assert(hf.unextended_sp() == (intptr_t*)hf.at(frame::interpreter_frame_last_sp_offset), "");
168   assert(hf.unextended_sp() <= (intptr_t*)hf.at(frame::interpreter_frame_initial_sp_offset), "");
169   assert(hf.unextended_sp() + extra_space >  (intptr_t*)hf.at(frame::interpreter_frame_extended_sp_offset), "");
170   assert(hf.fp()            >  (intptr_t*)hf.at(frame::interpreter_frame_initial_sp_offset), "");
171   assert(hf.fp()            <= (intptr_t*)hf.at(frame::interpreter_frame_locals_offset), "");
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() - frame::sender_sp_offset), "");
178 
179   *(hf.sp() - 1) = (intptr_t)hf.pc();
180 
181   intptr_t* fp_addr = hf.sp() - frame::sender_sp_offset;
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) {
187   if (caller.is_interpreted_frame()) {
188     assert(!caller.is_empty(), "");
189     patch_callee_link_relative(caller, caller.fp());
190   } else {

191     // If we're the bottom-most frame frozen in this freeze, the caller might have stayed frozen in the chunk,
192     // and its oop-containing fp fixed. We've now just overwritten it, so we must patch it back to its value
193     // as read from the chunk.
194     patch_callee_link(caller, caller.fp());
195   }
196 }
197 
198 inline void FreezeBase::patch_pd_unused(intptr_t* sp) {
199   intptr_t* fp_addr = sp - frame::sender_sp_offset;
200   *fp_addr = badAddressVal;
201 }
202 
203 inline intptr_t* AnchorMark::anchor_mark_set_pd() {
204   intptr_t* sp = _top_frame.sp();
205   if (_top_frame.is_interpreted_frame()) {
206     // In case the top frame is interpreted we need to set up the anchor using
207     // the last_sp saved in the frame (remove possible alignment added while
208     // thawing, see ThawBase::finish_thaw()). We also clear last_sp to match
209     // the behavior when calling the VM from the interpreter (we check for this
210     // in FreezeBase::prepare_freeze_interpreted_top_frame, which can be reached

242 
243 inline void ThawBase::prefetch_chunk_pd(void* start, int size) {
244   size <<= LogBytesPerWord;
245   Prefetch::read(start, size);
246   Prefetch::read(start, size - 64);
247 }
248 
249 template <typename ConfigT>
250 inline void Thaw<ConfigT>::patch_caller_links(intptr_t* sp, intptr_t* bottom) {
251   // Fast path depends on !PreserveFramePointer. See can_thaw_fast().
252   assert(!PreserveFramePointer, "Frame pointers need to be fixed");
253 }
254 
255 // Slow path
256 
257 inline frame ThawBase::new_entry_frame() {
258   intptr_t* sp = _cont.entrySP();
259   return frame(sp, sp, _cont.entryFP(), _cont.entryPC()); // TODO PERF: This finds code blob and computes deopt state
260 }
261 
262 template<typename FKind> frame ThawBase::new_stack_frame(const frame& hf, frame& caller, bool bottom) {
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;
291     if (bottom || caller.is_interpreted_frame()) {
292       int argsize = FKind::stack_argsize(hf);
293 
294       fsize += argsize;
295       frame_sp   -= argsize;
296       caller.set_sp(caller.sp() - argsize);
297       assert(caller.sp() == frame_sp + (fsize-argsize), "");
298 
299       frame_sp = align(hf, frame_sp, caller, bottom);

300     }

301 
302     assert(hf.cb() != nullptr, "");
303     assert(hf.oop_map() != nullptr, "");
304     intptr_t* fp;
305     if (PreserveFramePointer) {
306       // we need to recreate a "real" frame pointer, pointing into the stack
307       fp = frame_sp + FKind::size(hf) - frame::sender_sp_offset;
308     } else {
309       fp = FKind::stub || FKind::native
310         ? frame_sp + fsize - frame::sender_sp_offset // fp always points to the address below the pushed return pc. We need correct address.
311         : *(intptr_t**)(hf.sp() - frame::sender_sp_offset); // we need to re-read fp because it may be an oop and we might have fixed the frame.
312     }
313     return frame(frame_sp, frame_sp, fp, hf.pc(), hf.cb(), hf.oop_map(), false); // TODO PERF : this computes deopt state; is it necessary?
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. rfp will be restored back in gen_continuation_enter().
344   ContinuationHelper::patch_return_address_at(&sp[-1],
345                                               ContinuationEntry::cleanup_pc());
346   return sp;
347 }
348 
349 inline intptr_t* ThawBase::push_preempt_adapter() {
350   frame enterSpecial = new_entry_frame();
351   intptr_t* sp = enterSpecial.sp();

 42   *la = new_value;
 43 }
 44 
 45 ////// Freeze
 46 
 47 // Fast path
 48 
 49 inline void FreezeBase::patch_stack_pd(intptr_t* frame_sp, intptr_t* heap_sp) {
 50   // copy the spilled fp from the heap to the stack
 51   *(frame_sp - frame::sender_sp_offset) = *(heap_sp - frame::sender_sp_offset);
 52 }
 53 
 54 // Slow path
 55 
 56 template<typename FKind>
 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   frame::CompiledFramePointers cfp = f.compiled_frame_details();


 64 
 65   int slot = 0;
 66   CodeBlob* sender_cb = CodeCache::find_blob_and_oopmap(*cfp.sender_pc_addr, slot);
 67 
 68   return sender_cb != nullptr
 69     ? frame(cfp.sender_sp, cfp.sender_sp, *cfp.saved_fp_addr, *cfp.sender_pc_addr, sender_cb,
 70             slot == -1 ? nullptr : sender_cb->oop_map_for_slot(slot, *cfp.sender_pc_addr), false)
 71     : frame(cfp.sender_sp, cfp.sender_sp, *cfp.saved_fp_addr, *cfp.sender_pc_addr);

 72 }
 73 
 74 template<typename FKind>
 75 frame FreezeBase::new_heap_frame(frame& f, frame& caller, int size_adjust) {
 76   assert(FKind::is_instance(f), "");
 77   assert(!caller.is_interpreted_frame()
 78     || caller.unextended_sp() == (intptr_t*)caller.at(frame::interpreter_frame_last_sp_offset), "");
 79 
 80   intptr_t *sp, *fp; // sp is really our unextended_sp
 81   if (FKind::interpreted) {
 82     assert((intptr_t*)f.at(frame::interpreter_frame_last_sp_offset) == nullptr
 83       || f.unextended_sp() == (intptr_t*)f.at_relative(frame::interpreter_frame_last_sp_offset), "");
 84     intptr_t locals_offset = *f.addr_at(frame::interpreter_frame_locals_offset);
 85     // If the caller.is_empty(), i.e. we're freezing into an empty chunk, then we set
 86     // the chunk's argsize in finalize_freeze and make room for it above the unextended_sp
 87     bool overlap_caller = caller.is_interpreted_frame() || caller.is_empty();
 88     fp = caller.unextended_sp() - 1 - locals_offset + (overlap_caller ? ContinuationHelper::InterpretedFrame::stack_argsize(f) : 0);
 89     sp = fp - (f.fp() - f.unextended_sp());
 90     assert(sp <= fp, "");
 91     assert(fp <= caller.unextended_sp(), "");
 92     caller.set_sp(fp + frame::sender_sp_offset);
 93 
 94     assert(_cont.tail()->is_in_chunk(sp), "");
 95 
 96     frame hf(sp, sp, fp, f.pc(), nullptr, nullptr, true /* on_heap */);
 97     // copy relativized locals from the stack frame
 98     *hf.addr_at(frame::interpreter_frame_locals_offset) = locals_offset;
 99     return hf;
100   } else {
101     // For a compiled frame we need to re-read fp out of the frame because it may be an
102     // oop and we might have had a safepoint in finalize_freeze, after constructing f.
103     // For stub/native frames the value is not used while frozen, and will be constructed again
104     // when thawing the frame (see ThawBase::new_stack_frame). We use a special bad address to
105     // help with debugging, particularly when inspecting frames and identifying invalid accesses.
106     fp = FKind::compiled ? *(intptr_t**)(f.sp() - frame::sender_sp_offset) : (intptr_t*)badAddressVal;
107 
108     int fsize = FKind::size(f);
109     sp = caller.unextended_sp() - fsize - size_adjust;
110     if (caller.is_interpreted_frame() && size_adjust == 0) {
111       // If the caller is interpreted, our stackargs are not supposed to overlap with it
112       // so we make more room by moving sp down by argsize
113       int argsize = FKind::stack_argsize(f);
114       sp -= argsize;
115       caller.set_sp(sp + fsize);
116     }

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

163   assert((hf.fp() - hf.unextended_sp()) == (f.fp() - f.unextended_sp()), "");
164   assert(hf.unextended_sp() == (intptr_t*)hf.at(frame::interpreter_frame_last_sp_offset), "");
165   assert(hf.unextended_sp() <= (intptr_t*)hf.at(frame::interpreter_frame_initial_sp_offset), "");
166   assert(hf.unextended_sp() + extra_space >  (intptr_t*)hf.at(frame::interpreter_frame_extended_sp_offset), "");
167   assert(hf.fp()            >  (intptr_t*)hf.at(frame::interpreter_frame_initial_sp_offset), "");
168   assert(hf.fp()            <= (intptr_t*)hf.at(frame::interpreter_frame_locals_offset), "");
169 }
170 
171 inline void FreezeBase::set_top_frame_metadata_pd(const frame& hf) {
172   stackChunkOop chunk = _cont.tail();
173   assert(chunk->is_in_chunk(hf.sp() - 1), "");
174   assert(chunk->is_in_chunk(hf.sp() - frame::sender_sp_offset), "");
175 
176   *(hf.sp() - 1) = (intptr_t)hf.pc();
177 
178   intptr_t* fp_addr = hf.sp() - frame::sender_sp_offset;
179   *fp_addr = hf.is_interpreted_frame() ? (intptr_t)(hf.fp() - fp_addr)
180                                        : (intptr_t)hf.fp();
181 }
182 
183 inline void FreezeBase::patch_pd(frame& hf, const frame& caller, bool is_bottom_frame) {
184   if (caller.is_interpreted_frame()) {
185     assert(!caller.is_empty(), "");
186     patch_callee_link_relative(caller, caller.fp());
187   } else if (is_bottom_frame && caller.pc() != nullptr) {
188     assert(caller.is_compiled_frame(), "");
189     // If we're the bottom-most frame frozen in this freeze, the caller might have stayed frozen in the chunk,
190     // and its oop-containing fp fixed. We've now just overwritten it, so we must patch it back to its value
191     // as read from the chunk.
192     patch_callee_link(caller, caller.fp());
193   }
194 }
195 
196 inline void FreezeBase::patch_pd_unused(intptr_t* sp) {
197   intptr_t* fp_addr = sp - frame::sender_sp_offset;
198   *fp_addr = badAddressVal;
199 }
200 
201 inline intptr_t* AnchorMark::anchor_mark_set_pd() {
202   intptr_t* sp = _top_frame.sp();
203   if (_top_frame.is_interpreted_frame()) {
204     // In case the top frame is interpreted we need to set up the anchor using
205     // the last_sp saved in the frame (remove possible alignment added while
206     // thawing, see ThawBase::finish_thaw()). We also clear last_sp to match
207     // the behavior when calling the VM from the interpreter (we check for this
208     // in FreezeBase::prepare_freeze_interpreted_top_frame, which can be reached

240 
241 inline void ThawBase::prefetch_chunk_pd(void* start, int size) {
242   size <<= LogBytesPerWord;
243   Prefetch::read(start, size);
244   Prefetch::read(start, size - 64);
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   return frame(sp, sp, _cont.entryFP(), _cont.entryPC()); // TODO PERF: This finds code blob and computes deopt state
258 }
259 
260 template<typename FKind> frame ThawBase::new_stack_frame(const frame& hf, frame& caller, bool bottom, int size_adjust) {
261   assert(FKind::is_instance(hf), "");
262   // The values in the returned frame object will be written into the callee's stack in patch.
263 
264   if (FKind::interpreted) {
265     intptr_t* heap_sp = hf.unextended_sp();
266     // If caller is interpreted it already made room for the callee arguments
267     int overlap = caller.is_interpreted_frame() ? ContinuationHelper::InterpretedFrame::stack_argsize(hf) : 0;
268     const int fsize = (int)(ContinuationHelper::InterpretedFrame::frame_bottom(hf) - hf.unextended_sp() - overlap);
269     intptr_t* frame_sp = caller.unextended_sp() - fsize;
270     intptr_t* fp = frame_sp + (hf.fp() - heap_sp);
271     if ((intptr_t)fp % frame::frame_alignment != 0) {
272       fp--;
273       frame_sp--;
274       log_develop_trace(continuations)("Adding internal interpreted frame alignment");
275     }
276     DEBUG_ONLY(intptr_t* unextended_sp = fp + *hf.addr_at(frame::interpreter_frame_last_sp_offset);)
277     assert(frame_sp == unextended_sp, "");
278     caller.set_sp(fp + frame::sender_sp_offset);
279     frame f(frame_sp, frame_sp, fp, hf.pc());
280     // we need to set the locals so that the caller of new_stack_frame() can call
281     // ContinuationHelper::InterpretedFrame::frame_bottom
282     // copy relativized locals from the heap frame
283     *f.addr_at(frame::interpreter_frame_locals_offset) = *hf.addr_at(frame::interpreter_frame_locals_offset);
284     assert((intptr_t)f.fp() % frame::frame_alignment == 0, "");
285     return f;
286   } else {
287     int fsize = FKind::size(hf);
288     intptr_t* frame_sp = caller.unextended_sp() - fsize - size_adjust;
289     if (bottom || caller.is_interpreted_frame()) {
290       if (size_adjust == 0) {
291         int argsize = FKind::stack_argsize(hf);
292         frame_sp -= argsize;
293       }



294       frame_sp = align(hf, frame_sp, caller, bottom);
295       caller.set_sp(frame_sp + fsize + size_adjust);
296     }
297     assert(is_aligned(frame_sp, frame::frame_alignment), "");
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 + fsize - frame::sender_sp_offset;
305     } else {
306       fp = FKind::stub || FKind::native
307         ? frame_sp + fsize - frame::sender_sp_offset // fp always points to the address below the pushed return pc. We need correct address.
308         : *(intptr_t**)(hf.sp() - frame::sender_sp_offset); // we need to re-read fp because it may be an oop and we might have fixed the frame.
309     }
310     return frame(frame_sp, frame_sp, fp, hf.pc(), hf.cb(), hf.oop_map(), false); // TODO PERF : this computes deopt state; is it necessary?
311   }
312 }
313 
314 inline intptr_t* ThawBase::align(const frame& hf, intptr_t* frame_sp, frame& caller, bool bottom) {
315 #ifdef _LP64
316   if (((intptr_t)frame_sp & 0xf) != 0) {
317     assert(caller.is_interpreted_frame() || (bottom && hf.compiled_frame_stack_argsize() % 2 != 0), "");
318     frame_sp--;

319   }
320   assert(is_aligned(frame_sp, frame::frame_alignment), "");
321 #endif
322 
323   return frame_sp;
324 }
325 
326 inline void ThawBase::patch_pd(frame& f, const frame& caller) {
327   if (caller.is_interpreted_frame() || PreserveFramePointer) {
328     patch_callee_link(caller, caller.fp());
329   }
330 }
331 
332 inline void ThawBase::patch_pd(frame& f, intptr_t* caller_sp) {
333   intptr_t* fp = caller_sp - frame::sender_sp_offset;
334   patch_callee_link(f, fp);
335 }
336 
337 inline intptr_t* ThawBase::push_cleanup_continuation() {
338   frame enterSpecial = new_entry_frame();
339   intptr_t* sp = enterSpecial.sp();
340 
341   // We only need to set the return pc. rfp will be restored back in gen_continuation_enter().
342   ContinuationHelper::patch_return_address_at(&sp[-1],
343                                               ContinuationEntry::cleanup_pc());
344   return sp;
345 }
346 
347 inline intptr_t* ThawBase::push_preempt_adapter() {
348   frame enterSpecial = new_entry_frame();
349   intptr_t* sp = enterSpecial.sp();
< prev index next >