< prev index next >

src/hotspot/cpu/ppc/continuationFreezeThaw_ppc.inline.hpp

Print this page

317   }
318 #ifdef ASSERT
319   else {
320     // For compiled frames the back link is actually redundant. It gets computed
321     // as unextended_sp + frame_size.
322 
323     // Note the difference on x86_64: the link is not made relative if the caller
324     // is a compiled frame because there rbp is used as a non-volatile register by
325     // c1/c2 so it could be a computed value local to the caller.
326 
327     // See also:
328     // - FreezeBase::set_top_frame_metadata_pd
329     // - StackChunkFrameStream<frame_kind>::fp()
330     // - UseContinuationFastPath: compiled frames are copied in a batch w/o patching the back link.
331     //   The backlinks are restored when thawing (see Thaw<ConfigT>::patch_caller_links())
332     patch_callee_link(hf, (intptr_t*)badAddress);
333   }
334 #endif
335 }
336 







337 //////// Thaw
338 
339 // Fast path
340 
341 inline void ThawBase::prefetch_chunk_pd(void* start, int size) {
342   size <<= LogBytesPerWord;
343   Prefetch::read(start, size);
344   Prefetch::read(start, size - 64);
345 }
346 
347 // Set back chain links of fast thawed frames such that *sp == callers_sp.
348 // See https://refspecs.linuxfoundation.org/ELF/ppc64/PPC-elf64abi.html#STACK
349 template <typename ConfigT>
350 inline void Thaw<ConfigT>::patch_caller_links(intptr_t* sp, intptr_t* bottom) {
351   for (intptr_t* callers_sp; sp < bottom; sp = callers_sp) {
352     address pc = (address)((frame::java_abi*) sp)->lr;
353     assert(pc != nullptr, "");
354     // see ThawBase::patch_return() which gets called just before
355     bool is_entry_frame = pc == StubRoutines::cont_returnBarrier() || pc == _cont.entryPC();
356     if (is_entry_frame) {

546 
547   // Make sure that esp is still relativized.
548   assert(f.at_absolute(ijava_idx(esp)) <= f.at_absolute(ijava_idx(monitors)), "");
549 
550   // Keep top_frame_sp relativized.
551 }
552 
553 inline intptr_t* ThawBase::push_cleanup_continuation() {
554   frame enterSpecial = new_entry_frame();
555   frame::common_abi* enterSpecial_abi = (frame::common_abi*)enterSpecial.sp();
556 
557   enterSpecial_abi->lr = (intptr_t)ContinuationEntry::cleanup_pc();
558 
559   log_develop_trace(continuations, preempt)("push_cleanup_continuation enterSpecial sp: " INTPTR_FORMAT " cleanup pc: " INTPTR_FORMAT,
560                                             p2i(enterSpecial_abi),
561                                             p2i(ContinuationEntry::cleanup_pc()));
562 
563   return enterSpecial.sp();
564 }
565 





566 inline void ThawBase::patch_pd(frame& f, const frame& caller) {
567   patch_callee_link(caller, caller.fp());
568   // Prevent assertion if f gets deoptimized right away before it's fully initialized
569   f.mark_not_fully_initialized();
570 }
571 
572 inline void ThawBase::patch_pd(frame& f, intptr_t* caller_sp) {
573   assert(f.own_abi()->callers_sp == (uint64_t)caller_sp, "should have been fixed by patch_caller_links");
574 }
575 
576 //
577 // Interpreter Calling Procedure on PPC
578 //
579 // Caller                                   Resized Caller before the Call                New Callee Frame
580 //
581 //   - SP/FP are 16 byte aligned.           - The unused part of the expression stack     - The caller's original SP is passed as
582 //     Padding is added as necessary.         is removed                                    sender SP (in R21_sender_SP) also by
583 //   - SP is _not_ used as esp              - Slots for the callee's nonparameter locals    compiled callers. It is saved in the
584 //     (expression stack pointer)             are added.                                    ijava_state::sender_sp slot and
585 //   - Has reserved slots for the           - The large ABI is replaced with a minimal      restored when returning.

317   }
318 #ifdef ASSERT
319   else {
320     // For compiled frames the back link is actually redundant. It gets computed
321     // as unextended_sp + frame_size.
322 
323     // Note the difference on x86_64: the link is not made relative if the caller
324     // is a compiled frame because there rbp is used as a non-volatile register by
325     // c1/c2 so it could be a computed value local to the caller.
326 
327     // See also:
328     // - FreezeBase::set_top_frame_metadata_pd
329     // - StackChunkFrameStream<frame_kind>::fp()
330     // - UseContinuationFastPath: compiled frames are copied in a batch w/o patching the back link.
331     //   The backlinks are restored when thawing (see Thaw<ConfigT>::patch_caller_links())
332     patch_callee_link(hf, (intptr_t*)badAddress);
333   }
334 #endif
335 }
336 
337 inline intptr_t* AnchorMark::anchor_mark_set_pd() {
338   return _top_frame.sp();
339 }
340 
341 inline void AnchorMark::anchor_mark_clear_pd() {
342 }
343 
344 //////// Thaw
345 
346 // Fast path
347 
348 inline void ThawBase::prefetch_chunk_pd(void* start, int size) {
349   size <<= LogBytesPerWord;
350   Prefetch::read(start, size);
351   Prefetch::read(start, size - 64);
352 }
353 
354 // Set back chain links of fast thawed frames such that *sp == callers_sp.
355 // See https://refspecs.linuxfoundation.org/ELF/ppc64/PPC-elf64abi.html#STACK
356 template <typename ConfigT>
357 inline void Thaw<ConfigT>::patch_caller_links(intptr_t* sp, intptr_t* bottom) {
358   for (intptr_t* callers_sp; sp < bottom; sp = callers_sp) {
359     address pc = (address)((frame::java_abi*) sp)->lr;
360     assert(pc != nullptr, "");
361     // see ThawBase::patch_return() which gets called just before
362     bool is_entry_frame = pc == StubRoutines::cont_returnBarrier() || pc == _cont.entryPC();
363     if (is_entry_frame) {

553 
554   // Make sure that esp is still relativized.
555   assert(f.at_absolute(ijava_idx(esp)) <= f.at_absolute(ijava_idx(monitors)), "");
556 
557   // Keep top_frame_sp relativized.
558 }
559 
560 inline intptr_t* ThawBase::push_cleanup_continuation() {
561   frame enterSpecial = new_entry_frame();
562   frame::common_abi* enterSpecial_abi = (frame::common_abi*)enterSpecial.sp();
563 
564   enterSpecial_abi->lr = (intptr_t)ContinuationEntry::cleanup_pc();
565 
566   log_develop_trace(continuations, preempt)("push_cleanup_continuation enterSpecial sp: " INTPTR_FORMAT " cleanup pc: " INTPTR_FORMAT,
567                                             p2i(enterSpecial_abi),
568                                             p2i(ContinuationEntry::cleanup_pc()));
569 
570   return enterSpecial.sp();
571 }
572 
573 inline intptr_t* ThawBase::push_preempt_adapter() {
574   Unimplemented();
575   return nullptr;
576 }
577 
578 inline void ThawBase::patch_pd(frame& f, const frame& caller) {
579   patch_callee_link(caller, caller.fp());
580   // Prevent assertion if f gets deoptimized right away before it's fully initialized
581   f.mark_not_fully_initialized();
582 }
583 
584 inline void ThawBase::patch_pd(frame& f, intptr_t* caller_sp) {
585   assert(f.own_abi()->callers_sp == (uint64_t)caller_sp, "should have been fixed by patch_caller_links");
586 }
587 
588 //
589 // Interpreter Calling Procedure on PPC
590 //
591 // Caller                                   Resized Caller before the Call                New Callee Frame
592 //
593 //   - SP/FP are 16 byte aligned.           - The unused part of the expression stack     - The caller's original SP is passed as
594 //     Padding is added as necessary.         is removed                                    sender SP (in R21_sender_SP) also by
595 //   - SP is _not_ used as esp              - Slots for the callee's nonparameter locals    compiled callers. It is saved in the
596 //     (expression stack pointer)             are added.                                    ijava_state::sender_sp slot and
597 //   - Has reserved slots for the           - The large ABI is replaced with a minimal      restored when returning.
< prev index next >