< prev index next >

src/hotspot/cpu/aarch64/frame_aarch64.cpp

Print this page

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

160       // Note: PAC authentication may fail in case broken frame is passed in.
161       // Just strip it for now.
162       sender_pc = pauth_strip_pointer((address) *(sender_sp - 1));
163     }
164 




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

771 }
772 
773 // support for printing out where we are in a Java method
774 // needs to be passed current fp and bcp register values
775 // prints method name, bc index and bytecode name
776 extern "C" void pm(uintptr_t fp, uintptr_t bcx) {
777   DESCRIBE_FP_OFFSET(interpreter_frame_method);
778   uintptr_t *p = (uintptr_t *)fp;
779   Method* m = (Method*)p[frame::interpreter_frame_method_offset];
780   printbc(m, bcx);
781 }
782 
783 #ifndef PRODUCT
784 // This is a generic constructor which is only used by pns() in debug.cpp.
785 frame::frame(void* sp, void* fp, void* pc) {
786   init((intptr_t*)sp, (intptr_t*)fp, (address)pc);
787 }
788 
789 #endif
790 
















791 void JavaFrameAnchor::make_walkable() {
792   // last frame set?
793   if (last_Java_sp() == nullptr) return;
794   // already walkable?
795   if (walkable()) return;
796   vmassert(last_Java_sp() != nullptr, "not called from Java code?");
797   vmassert(last_Java_pc() == nullptr, "already walkable");
798   _last_Java_pc = (address)_last_Java_sp[-1];
799   vmassert(walkable(), "something went wrong");
800 }

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

157       // Note: frame::sender_sp_offset is only valid for compiled frame
158       intptr_t **saved_fp_addr = (intptr_t**) (sender_sp - frame::sender_sp_offset);
159       saved_fp = *saved_fp_addr;
160       // Note: PAC authentication may fail in case broken frame is passed in.
161       // Just strip it for now.
162       sender_pc = pauth_strip_pointer((address) *(sender_sp - 1));

163 
164       // Repair the sender sp if this is a method with scalarized inline type args
165       sender_sp = repair_sender_sp(sender_sp, saved_fp_addr);
166       sender_unextended_sp = sender_sp;
167     }
168     if (Continuation::is_return_barrier_entry(sender_pc)) {
169       // If our sender_pc is the return barrier, then our "real" sender is the continuation entry
170       frame s = Continuation::continuation_bottom_sender(thread, *this, sender_sp);
171       sender_sp = s.sp();
172       sender_pc = s.pc();
173     }
174 
175     // If the potential sender is the interpreter then we can do some more checking
176     if (Interpreter::contains(sender_pc)) {
177 
178       // fp is always saved in a recognizable place in any code we generate. However
179       // only if the sender is interpreted/call_stub (c1 too?) are we certain that the saved fp
180       // is really a frame pointer.
181 
182       if (!thread->is_in_stack_range_excl((address)saved_fp, (address)sender_sp)) {
183         return false;
184       }
185 
186       // construct the potential sender
187 

774 }
775 
776 // support for printing out where we are in a Java method
777 // needs to be passed current fp and bcp register values
778 // prints method name, bc index and bytecode name
779 extern "C" void pm(uintptr_t fp, uintptr_t bcx) {
780   DESCRIBE_FP_OFFSET(interpreter_frame_method);
781   uintptr_t *p = (uintptr_t *)fp;
782   Method* m = (Method*)p[frame::interpreter_frame_method_offset];
783   printbc(m, bcx);
784 }
785 
786 #ifndef PRODUCT
787 // This is a generic constructor which is only used by pns() in debug.cpp.
788 frame::frame(void* sp, void* fp, void* pc) {
789   init((intptr_t*)sp, (intptr_t*)fp, (address)pc);
790 }
791 
792 #endif
793 
794 // Check for a method with scalarized inline type arguments that needs
795 // a stack repair and return the repaired sender stack pointer.
796 intptr_t* frame::repair_sender_sp(intptr_t* sender_sp, intptr_t** saved_fp_addr) const {
797   CompiledMethod* cm = _cb->as_compiled_method_or_null();
798   if (cm != nullptr && cm->needs_stack_repair()) {
799     // The stack increment resides just below the saved FP on the stack and
800     // records the total frame size excluding the two words for saving FP and LR.
801     intptr_t* sp_inc_addr = (intptr_t*) (saved_fp_addr - 1);
802     assert(*sp_inc_addr % StackAlignmentInBytes == 0, "sp_inc not aligned");
803     int real_frame_size = (*sp_inc_addr / wordSize) + 2;
804     assert(real_frame_size >= _cb->frame_size() && real_frame_size <= 1000000, "invalid frame size");
805     sender_sp = unextended_sp() + real_frame_size;
806   }
807   return sender_sp;
808 }
809 
810 void JavaFrameAnchor::make_walkable() {
811   // last frame set?
812   if (last_Java_sp() == nullptr) return;
813   // already walkable?
814   if (walkable()) return;
815   vmassert(last_Java_sp() != nullptr, "not called from Java code?");
816   vmassert(last_Java_pc() == nullptr, "already walkable");
817   _last_Java_pc = (address)_last_Java_sp[-1];
818   vmassert(walkable(), "something went wrong");
819 }
< prev index next >