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