127 return (address*)(f.real_fp() - 1);
128 }
129
130 inline address* ContinuationHelper::InterpretedFrame::return_pc_address(const frame& f) {
131 return (address*)(f.fp() + frame::return_addr_offset);
132 }
133
134 inline void ContinuationHelper::InterpretedFrame::patch_sender_sp(frame& f, const frame& caller) {
135 intptr_t* sp = caller.unextended_sp();
136 assert(f.is_interpreted_frame(), "");
137 intptr_t* la = f.addr_at(frame::interpreter_frame_sender_sp_offset);
138 *la = f.is_heap_frame() ? (intptr_t)(sp - f.fp()) : (intptr_t)sp;
139 }
140
141 inline address ContinuationHelper::Frame::real_pc(const frame& f) {
142 // Always used in assertions. Just strip it.
143 address* pc_addr = &(((address*) f.sp())[-1]);
144 return pauth_strip_pointer(*pc_addr);
145 }
146
147 inline void ContinuationHelper::Frame::patch_pc(const frame& f, address pc) {
148 address* pc_addr = &(((address*) f.sp())[-1]);
149 *pc_addr = pauth_sign_return_address(pc);
150 }
151
152 inline intptr_t* ContinuationHelper::InterpretedFrame::frame_top(const frame& f, InterpreterOopMap* mask) { // inclusive; this will be copied with the frame
153 // interpreter_frame_last_sp_offset, points to unextended_sp includes arguments in the frame
154 // interpreter_frame_initial_sp_offset excludes expression stack slots
155 int expression_stack_sz = expression_stack_size(f, mask);
156 intptr_t* res = (intptr_t*)f.at_relative(frame::interpreter_frame_initial_sp_offset) - expression_stack_sz;
157 assert(res == (intptr_t*)f.interpreter_frame_monitor_end() - expression_stack_sz, "");
158 assert(res >= f.unextended_sp(),
159 "res: " INTPTR_FORMAT " initial_sp: " INTPTR_FORMAT " last_sp: " INTPTR_FORMAT " unextended_sp: " INTPTR_FORMAT " expression_stack_size: %d",
160 p2i(res), p2i(f.addr_at(frame::interpreter_frame_initial_sp_offset)), f.at_relative_or_null(frame::interpreter_frame_last_sp_offset),
161 p2i(f.unextended_sp()), expression_stack_sz);
162 return res;
163 }
164
165 inline intptr_t* ContinuationHelper::InterpretedFrame::frame_bottom(const frame& f) { // exclusive; this will not be copied with the frame
166 return (intptr_t*)f.at_relative(frame::interpreter_frame_locals_offset) + 1; // exclusive, so we add 1 word
167 }
168
|
127 return (address*)(f.real_fp() - 1);
128 }
129
130 inline address* ContinuationHelper::InterpretedFrame::return_pc_address(const frame& f) {
131 return (address*)(f.fp() + frame::return_addr_offset);
132 }
133
134 inline void ContinuationHelper::InterpretedFrame::patch_sender_sp(frame& f, const frame& caller) {
135 intptr_t* sp = caller.unextended_sp();
136 assert(f.is_interpreted_frame(), "");
137 intptr_t* la = f.addr_at(frame::interpreter_frame_sender_sp_offset);
138 *la = f.is_heap_frame() ? (intptr_t)(sp - f.fp()) : (intptr_t)sp;
139 }
140
141 inline address ContinuationHelper::Frame::real_pc(const frame& f) {
142 // Always used in assertions. Just strip it.
143 address* pc_addr = &(((address*) f.sp())[-1]);
144 return pauth_strip_pointer(*pc_addr);
145 }
146
147 inline void ContinuationHelper::Frame::patch_pc(const frame& f, address pc, bool callee_augmented) {
148 address* pc_addr = &(((address*) (callee_augmented ? f.unextended_sp() : f.sp()))[-1]);
149 *pc_addr = pauth_sign_return_address(pc);
150 }
151
152 inline intptr_t* ContinuationHelper::InterpretedFrame::frame_top(const frame& f, InterpreterOopMap* mask) { // inclusive; this will be copied with the frame
153 // interpreter_frame_last_sp_offset, points to unextended_sp includes arguments in the frame
154 // interpreter_frame_initial_sp_offset excludes expression stack slots
155 int expression_stack_sz = expression_stack_size(f, mask);
156 intptr_t* res = (intptr_t*)f.at_relative(frame::interpreter_frame_initial_sp_offset) - expression_stack_sz;
157 assert(res == (intptr_t*)f.interpreter_frame_monitor_end() - expression_stack_sz, "");
158 assert(res >= f.unextended_sp(),
159 "res: " INTPTR_FORMAT " initial_sp: " INTPTR_FORMAT " last_sp: " INTPTR_FORMAT " unextended_sp: " INTPTR_FORMAT " expression_stack_size: %d",
160 p2i(res), p2i(f.addr_at(frame::interpreter_frame_initial_sp_offset)), f.at_relative_or_null(frame::interpreter_frame_last_sp_offset),
161 p2i(f.unextended_sp()), expression_stack_sz);
162 return res;
163 }
164
165 inline intptr_t* ContinuationHelper::InterpretedFrame::frame_bottom(const frame& f) { // exclusive; this will not be copied with the frame
166 return (intptr_t*)f.at_relative(frame::interpreter_frame_locals_offset) + 1; // exclusive, so we add 1 word
167 }
168
|