< prev index next >

src/hotspot/cpu/x86/frame_x86.cpp

Print this page

129       // which can be different from the sender unextended sp (the sp seen
130       // by the sender) because of current frame local variables
131       sender_sp = (intptr_t*) addr_at(sender_sp_offset);
132       sender_unextended_sp = (intptr_t*) this->fp()[interpreter_frame_sender_sp_offset];
133       saved_fp = (intptr_t*) this->fp()[link_offset];
134 
135     } else {
136       // must be some sort of compiled/runtime frame
137       // fp does not have to be safe (although it could be check for c1?)
138 
139       // check for a valid frame_size, otherwise we are unlikely to get a valid sender_pc
140       if (_cb->frame_size() <= 0) {
141         return false;
142       }
143 
144       sender_sp = _unextended_sp + _cb->frame_size();
145       // Is sender_sp safe?
146       if (!thread->is_in_full_stack_checked((address)sender_sp)) {
147         return false;
148       }
149       sender_unextended_sp = sender_sp;
150       // On Intel the return_address is always the word on the stack
151       sender_pc = (address) *(sender_sp-1);
152       // Note: frame::sender_sp_offset is only valid for compiled frame
153       saved_fp = (intptr_t*) *(sender_sp - frame::sender_sp_offset);
154     }
155 




156     if (Continuation::is_return_barrier_entry(sender_pc)) {
157       // If our sender_pc is the return barrier, then our "real" sender is the continuation entry
158       frame s = Continuation::continuation_bottom_sender(thread, *this, sender_sp);
159       sender_sp = s.sp();
160       sender_pc = s.pc();
161     }
162 
163     // If the potential sender is the interpreter then we can do some more checking
164     if (Interpreter::contains(sender_pc)) {
165 
166       // ebp is always saved in a recognizable place in any code we generate. However
167       // only if the sender is interpreted/call_stub (c1 too?) are we certain that the saved ebp
168       // is really a frame pointer.
169 
170       if (!thread->is_in_stack_range_excl((address)saved_fp, (address)sender_sp)) {
171         return false;
172       }
173 
174       // construct the potential sender
175 

645       Continuation::is_return_barrier_entry(ret_pc) ? "return address (return barrier)" : "return address");
646     values.describe(-1, fp_loc, "saved fp", 0); // "unowned" as value belongs to sender
647   }
648 }
649 
650 #endif // !PRODUCT
651 
652 intptr_t *frame::initial_deoptimization_info() {
653   // used to reset the saved FP
654   return fp();
655 }
656 
657 #ifndef PRODUCT
658 // This is a generic constructor which is only used by pns() in debug.cpp.
659 frame::frame(void* sp, void* fp, void* pc) {
660   init((intptr_t*)sp, (intptr_t*)fp, (address)pc);
661 }
662 
663 #endif
664 















665 void JavaFrameAnchor::make_walkable() {
666   // last frame set?
667   if (last_Java_sp() == nullptr) return;
668   // already walkable?
669   if (walkable()) return;
670   vmassert(last_Java_pc() == nullptr, "already walkable");
671   _last_Java_pc = (address)_last_Java_sp[-1];
672   vmassert(walkable(), "something went wrong");
673 }

129       // which can be different from the sender unextended sp (the sp seen
130       // by the sender) because of current frame local variables
131       sender_sp = (intptr_t*) addr_at(sender_sp_offset);
132       sender_unextended_sp = (intptr_t*) this->fp()[interpreter_frame_sender_sp_offset];
133       saved_fp = (intptr_t*) this->fp()[link_offset];
134 
135     } else {
136       // must be some sort of compiled/runtime frame
137       // fp does not have to be safe (although it could be check for c1?)
138 
139       // check for a valid frame_size, otherwise we are unlikely to get a valid sender_pc
140       if (_cb->frame_size() <= 0) {
141         return false;
142       }
143 
144       sender_sp = _unextended_sp + _cb->frame_size();
145       // Is sender_sp safe?
146       if (!thread->is_in_full_stack_checked((address)sender_sp)) {
147         return false;
148       }

149       // On Intel the return_address is always the word on the stack
150       sender_pc = (address) *(sender_sp-1);
151       // Note: frame::sender_sp_offset is only valid for compiled frame
152       intptr_t** saved_fp_addr = (intptr_t**) (sender_sp - frame::sender_sp_offset);
153       saved_fp = *saved_fp_addr;
154 
155       // Repair the sender sp if this is a method with scalarized inline type args
156       sender_sp = repair_sender_sp(sender_sp, saved_fp_addr);
157       sender_unextended_sp = sender_sp;
158     }
159     if (Continuation::is_return_barrier_entry(sender_pc)) {
160       // If our sender_pc is the return barrier, then our "real" sender is the continuation entry
161       frame s = Continuation::continuation_bottom_sender(thread, *this, sender_sp);
162       sender_sp = s.sp();
163       sender_pc = s.pc();
164     }
165 
166     // If the potential sender is the interpreter then we can do some more checking
167     if (Interpreter::contains(sender_pc)) {
168 
169       // ebp is always saved in a recognizable place in any code we generate. However
170       // only if the sender is interpreted/call_stub (c1 too?) are we certain that the saved ebp
171       // is really a frame pointer.
172 
173       if (!thread->is_in_stack_range_excl((address)saved_fp, (address)sender_sp)) {
174         return false;
175       }
176 
177       // construct the potential sender
178 

648       Continuation::is_return_barrier_entry(ret_pc) ? "return address (return barrier)" : "return address");
649     values.describe(-1, fp_loc, "saved fp", 0); // "unowned" as value belongs to sender
650   }
651 }
652 
653 #endif // !PRODUCT
654 
655 intptr_t *frame::initial_deoptimization_info() {
656   // used to reset the saved FP
657   return fp();
658 }
659 
660 #ifndef PRODUCT
661 // This is a generic constructor which is only used by pns() in debug.cpp.
662 frame::frame(void* sp, void* fp, void* pc) {
663   init((intptr_t*)sp, (intptr_t*)fp, (address)pc);
664 }
665 
666 #endif
667 
668 // Check for a method with scalarized inline type arguments that needs
669 // a stack repair and return the repaired sender stack pointer.
670 intptr_t* frame::repair_sender_sp(intptr_t* sender_sp, intptr_t** saved_fp_addr) const {
671   CompiledMethod* cm = _cb->as_compiled_method_or_null();
672   if (cm != nullptr && cm->needs_stack_repair()) {
673     // The stack increment resides just below the saved rbp on the stack
674     // and does not account for the return address.
675     intptr_t* real_frame_size_addr = (intptr_t*) (saved_fp_addr - 1);
676     int real_frame_size = ((*real_frame_size_addr) + wordSize) / wordSize;
677     assert(real_frame_size >= _cb->frame_size() && real_frame_size <= 1000000, "invalid frame size");
678     sender_sp = unextended_sp() + real_frame_size;
679   }
680   return sender_sp;
681 }
682 
683 void JavaFrameAnchor::make_walkable() {
684   // last frame set?
685   if (last_Java_sp() == nullptr) return;
686   // already walkable?
687   if (walkable()) return;
688   vmassert(last_Java_pc() == nullptr, "already walkable");
689   _last_Java_pc = (address)_last_Java_sp[-1];
690   vmassert(walkable(), "something went wrong");
691 }
< prev index next >