< prev index next >

src/hotspot/cpu/x86/frame_x86.cpp

Print this page

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




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

679       Continuation::is_return_barrier_entry(ret_pc) ? "return address (return barrier)" : "return address");
680     values.describe(-1, fp_loc, "saved fp", 0); // "unowned" as value belongs to sender
681   }
682 }
683 
684 #endif // !PRODUCT
685 
686 intptr_t *frame::initial_deoptimization_info() {
687   // used to reset the saved FP
688   return fp();
689 }
690 
691 #ifndef PRODUCT
692 // This is a generic constructor which is only used by pns() in debug.cpp.
693 frame::frame(void* sp, void* fp, void* pc) {
694   init((intptr_t*)sp, (intptr_t*)fp, (address)pc);
695 }
696 
697 #endif
698 















699 void JavaFrameAnchor::make_walkable() {
700   // last frame set?
701   if (last_Java_sp() == nullptr) return;
702   // already walkable?
703   if (walkable()) return;
704   vmassert(last_Java_pc() == nullptr, "already walkable");
705   _last_Java_pc = (address)_last_Java_sp[-1];
706   vmassert(walkable(), "something went wrong");
707 }

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

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

682       Continuation::is_return_barrier_entry(ret_pc) ? "return address (return barrier)" : "return address");
683     values.describe(-1, fp_loc, "saved fp", 0); // "unowned" as value belongs to sender
684   }
685 }
686 
687 #endif // !PRODUCT
688 
689 intptr_t *frame::initial_deoptimization_info() {
690   // used to reset the saved FP
691   return fp();
692 }
693 
694 #ifndef PRODUCT
695 // This is a generic constructor which is only used by pns() in debug.cpp.
696 frame::frame(void* sp, void* fp, void* pc) {
697   init((intptr_t*)sp, (intptr_t*)fp, (address)pc);
698 }
699 
700 #endif
701 
702 // Check for a method with scalarized inline type arguments that needs
703 // a stack repair and return the repaired sender stack pointer.
704 intptr_t* frame::repair_sender_sp(intptr_t* sender_sp, intptr_t** saved_fp_addr) const {
705   nmethod* nm = _cb->as_nmethod_or_null();
706   if (nm != nullptr && nm->needs_stack_repair()) {
707     // The stack increment resides just below the saved rbp on the stack
708     // and does not account for the return address.
709     intptr_t* real_frame_size_addr = (intptr_t*) (saved_fp_addr - 1);
710     int real_frame_size = ((*real_frame_size_addr) + wordSize) / wordSize;
711     assert(real_frame_size >= _cb->frame_size() && real_frame_size <= 1000000, "invalid frame size");
712     sender_sp = unextended_sp() + real_frame_size;
713   }
714   return sender_sp;
715 }
716 
717 void JavaFrameAnchor::make_walkable() {
718   // last frame set?
719   if (last_Java_sp() == nullptr) return;
720   // already walkable?
721   if (walkable()) return;
722   vmassert(last_Java_pc() == nullptr, "already walkable");
723   _last_Java_pc = (address)_last_Java_sp[-1];
724   vmassert(walkable(), "something went wrong");
725 }
< prev index next >