< prev index next >

src/hotspot/cpu/x86/continuationFreezeThaw_x86.inline.hpp

Print this page

174   assert(frame_pc == ContinuationHelper::Frame::real_pc(hf), "");
175 }
176 
177 inline void FreezeBase::patch_pd(frame& hf, const frame& caller) {
178   if (caller.is_interpreted_frame()) {
179     assert(!caller.is_empty(), "");
180     patch_callee_link_relative(caller, caller.fp());
181   } else {
182     // If we're the bottom-most frame frozen in this freeze, the caller might have stayed frozen in the chunk,
183     // and its oop-containing fp fixed. We've now just overwritten it, so we must patch it back to its value
184     // as read from the chunk.
185     patch_callee_link(caller, caller.fp());
186   }
187 }
188 
189 inline void FreezeBase::patch_pd_unused(intptr_t* sp) {
190   intptr_t* fp_addr = sp - frame::sender_sp_offset;
191   *fp_addr = badAddressVal;
192 }
193 































194 //////// Thaw
195 
196 // Fast path
197 
198 inline void ThawBase::prefetch_chunk_pd(void* start, int size) {
199   size <<= LogBytesPerWord;
200   Prefetch::read(start, size);
201   Prefetch::read(start, size - 64);
202 }
203 
204 template <typename ConfigT>
205 inline void Thaw<ConfigT>::patch_caller_links(intptr_t* sp, intptr_t* bottom) {
206   // Fast path depends on !PreserveFramePointer. See can_thaw_fast().
207   assert(!PreserveFramePointer, "Frame pointers need to be fixed");
208 }
209 
210 // Slow path
211 
212 inline frame ThawBase::new_entry_frame() {
213   intptr_t* sp = _cont.entrySP();

281 inline void ThawBase::patch_pd(frame& f, const frame& caller) {
282   patch_callee_link(caller, caller.fp());
283 }
284 
285 inline void ThawBase::patch_pd(frame& f, intptr_t* caller_sp) {
286   intptr_t* fp = caller_sp - frame::sender_sp_offset;
287   patch_callee_link(f, fp);
288 }
289 
290 inline intptr_t* ThawBase::push_cleanup_continuation() {
291   frame enterSpecial = new_entry_frame();
292   intptr_t* sp = enterSpecial.sp();
293 
294   sp[-1] = (intptr_t)ContinuationEntry::cleanup_pc();
295   sp[-2] = (intptr_t)enterSpecial.fp();
296 
297   log_develop_trace(continuations, preempt)("push_cleanup_continuation initial sp: " INTPTR_FORMAT " final sp: " INTPTR_FORMAT, p2i(sp + 2 * frame::metadata_words), p2i(sp));
298   return sp;
299 }
300 










301 inline void ThawBase::derelativize_interpreted_frame_metadata(const frame& hf, const frame& f) {
302   // Make sure that last_sp is kept relativized.
303   assert((intptr_t*)f.at_relative(frame::interpreter_frame_last_sp_offset) == f.unextended_sp(), "");
304 
305   // Make sure that monitor_block_top is still relativized.
306   assert(f.at_absolute(frame::interpreter_frame_monitor_block_top_offset) <= frame::interpreter_frame_initial_sp_offset, "");
307 }
308 
309 #endif // CPU_X86_CONTINUATIONFREEZE_THAW_X86_INLINE_HPP

174   assert(frame_pc == ContinuationHelper::Frame::real_pc(hf), "");
175 }
176 
177 inline void FreezeBase::patch_pd(frame& hf, const frame& caller) {
178   if (caller.is_interpreted_frame()) {
179     assert(!caller.is_empty(), "");
180     patch_callee_link_relative(caller, caller.fp());
181   } else {
182     // If we're the bottom-most frame frozen in this freeze, the caller might have stayed frozen in the chunk,
183     // and its oop-containing fp fixed. We've now just overwritten it, so we must patch it back to its value
184     // as read from the chunk.
185     patch_callee_link(caller, caller.fp());
186   }
187 }
188 
189 inline void FreezeBase::patch_pd_unused(intptr_t* sp) {
190   intptr_t* fp_addr = sp - frame::sender_sp_offset;
191   *fp_addr = badAddressVal;
192 }
193 
194 inline intptr_t* AnchorMark::anchor_mark_set_pd() {
195   intptr_t* sp = _top_frame.sp();
196   if (_top_frame.is_interpreted_frame()) {
197     // In case the top frame is interpreted we need to set up the anchor using
198     // the last_sp saved in the frame (remove possible alignment added while
199     // thawing, see ThawBase::finish_thaw()). We also need to clear the last_sp
200     // saved in the frame as it is not expected to be set in case we preempt again.
201     _last_sp_from_frame = _top_frame.interpreter_frame_last_sp();
202     assert(_last_sp_from_frame != nullptr, "");
203     _top_frame.interpreter_frame_set_last_sp(nullptr);
204     if (sp != _last_sp_from_frame) {
205       _last_sp_from_frame[-1] = (intptr_t)_top_frame.pc();
206       _last_sp_from_frame[-2] = (intptr_t)_top_frame.fp();
207     }
208     _is_interpreted = true;
209     sp = _last_sp_from_frame;
210   }
211   return sp;
212 }
213 
214 inline void AnchorMark::anchor_mark_clear_pd() {
215   if (_is_interpreted) {
216     // Restore last_sp_from_frame and possibly overwritten pc.
217     _top_frame.interpreter_frame_set_last_sp(_last_sp_from_frame);
218     intptr_t* sp = _top_frame.sp();
219     if (sp != _last_sp_from_frame) {
220       sp[-1] = (intptr_t)_top_frame.pc();
221     }  
222   }
223 }
224 
225 //////// Thaw
226 
227 // Fast path
228 
229 inline void ThawBase::prefetch_chunk_pd(void* start, int size) {
230   size <<= LogBytesPerWord;
231   Prefetch::read(start, size);
232   Prefetch::read(start, size - 64);
233 }
234 
235 template <typename ConfigT>
236 inline void Thaw<ConfigT>::patch_caller_links(intptr_t* sp, intptr_t* bottom) {
237   // Fast path depends on !PreserveFramePointer. See can_thaw_fast().
238   assert(!PreserveFramePointer, "Frame pointers need to be fixed");
239 }
240 
241 // Slow path
242 
243 inline frame ThawBase::new_entry_frame() {
244   intptr_t* sp = _cont.entrySP();

312 inline void ThawBase::patch_pd(frame& f, const frame& caller) {
313   patch_callee_link(caller, caller.fp());
314 }
315 
316 inline void ThawBase::patch_pd(frame& f, intptr_t* caller_sp) {
317   intptr_t* fp = caller_sp - frame::sender_sp_offset;
318   patch_callee_link(f, fp);
319 }
320 
321 inline intptr_t* ThawBase::push_cleanup_continuation() {
322   frame enterSpecial = new_entry_frame();
323   intptr_t* sp = enterSpecial.sp();
324 
325   sp[-1] = (intptr_t)ContinuationEntry::cleanup_pc();
326   sp[-2] = (intptr_t)enterSpecial.fp();
327 
328   log_develop_trace(continuations, preempt)("push_cleanup_continuation initial sp: " INTPTR_FORMAT " final sp: " INTPTR_FORMAT, p2i(sp + 2 * frame::metadata_words), p2i(sp));
329   return sp;
330 }
331 
332 inline intptr_t* ThawBase::push_preempt_adapter() {
333   frame enterSpecial = new_entry_frame();
334   intptr_t* sp = enterSpecial.sp();
335 
336   sp[-1] = (intptr_t)StubRoutines::cont_preempt_stub();
337 
338   log_develop_trace(continuations, preempt)("push_preempt_adapter initial sp: " INTPTR_FORMAT " final sp: " INTPTR_FORMAT, p2i(sp + 2 * frame::metadata_words), p2i(sp));
339   return sp;
340 }
341 
342 inline void ThawBase::derelativize_interpreted_frame_metadata(const frame& hf, const frame& f) {
343   // Make sure that last_sp is kept relativized.
344   assert((intptr_t*)f.at_relative(frame::interpreter_frame_last_sp_offset) == f.unextended_sp(), "");
345 
346   // Make sure that monitor_block_top is still relativized.
347   assert(f.at_absolute(frame::interpreter_frame_monitor_block_top_offset) <= frame::interpreter_frame_initial_sp_offset, "");
348 }
349 
350 #endif // CPU_X86_CONTINUATIONFREEZE_THAW_X86_INLINE_HPP
< prev index next >