180 intptr_t* fp_addr = hf.sp() - 2;
181 *fp_addr = hf.is_interpreted_frame() ? (intptr_t)(hf.fp() - fp_addr)
182 : (intptr_t)hf.fp();
183 }
184
185 inline void FreezeBase::patch_pd(frame& hf, const frame& caller) {
186 if (caller.is_interpreted_frame()) {
187 assert(!caller.is_empty(), "");
188 patch_callee_link_relative(caller, caller.fp());
189 } else {
190 // If we're the bottom-most frame frozen in this freeze, the caller might have stayed frozen in the chunk,
191 // and its oop-containing fp fixed. We've now just overwritten it, so we must patch it back to its value
192 // as read from the chunk.
193 patch_callee_link(caller, caller.fp());
194 }
195 }
196
197 inline void FreezeBase::patch_pd_unused(intptr_t* sp) {
198 }
199
200 //////// Thaw
201
202 // Fast path
203
204 inline void ThawBase::prefetch_chunk_pd(void* start, int size) {
205 size <<= LogBytesPerWord;
206 Prefetch::read(start, size);
207 Prefetch::read(start, size - 64);
208 }
209
210 template <typename ConfigT>
211 inline void Thaw<ConfigT>::patch_caller_links(intptr_t* sp, intptr_t* bottom) {
212 // Fast path depends on !PreserveFramePointer. See can_thaw_fast().
213 assert(!PreserveFramePointer, "Frame pointers need to be fixed");
214 }
215
216 // Slow path
217
218 inline frame ThawBase::new_entry_frame() {
219 intptr_t* sp = _cont.entrySP();
295 inline void ThawBase::patch_pd(frame& f, const frame& caller) {
296 patch_callee_link(caller, caller.fp());
297 }
298
299 inline void ThawBase::patch_pd(frame& f, intptr_t* caller_sp) {
300 intptr_t* fp = caller_sp - frame::sender_sp_offset;
301 patch_callee_link(f, fp);
302 }
303
304 inline intptr_t* ThawBase::push_cleanup_continuation() {
305 frame enterSpecial = new_entry_frame();
306 intptr_t* sp = enterSpecial.sp();
307
308 sp[-1] = (intptr_t)ContinuationEntry::cleanup_pc();
309 sp[-2] = (intptr_t)enterSpecial.fp();
310
311 log_develop_trace(continuations, preempt)("push_cleanup_continuation initial sp: " INTPTR_FORMAT " final sp: " INTPTR_FORMAT, p2i(sp + 2 * frame::metadata_words), p2i(sp));
312 return sp;
313 }
314
315 inline void ThawBase::derelativize_interpreted_frame_metadata(const frame& hf, const frame& f) {
316 // Make sure that last_sp is kept relativized.
317 assert((intptr_t*)f.at_relative(frame::interpreter_frame_last_sp_offset) == f.unextended_sp(), "");
318
319 // Make sure that monitor_block_top is still relativized.
320 assert(f.at_absolute(frame::interpreter_frame_monitor_block_top_offset) <= frame::interpreter_frame_initial_sp_offset, "");
321
322 DEBUG_ONLY(Method* m = hf.interpreter_frame_method();)
323 DEBUG_ONLY(int extra_space = m->is_object_wait0() ? m->size_of_parameters() : 0;) // see comment in relativize_interpreted_frame_metadata()
324
325 // Make sure that extended_sp is kept relativized.
326 assert((intptr_t*)f.at_relative(frame::interpreter_frame_extended_sp_offset) < f.unextended_sp() + extra_space, "");
327 }
328
329 #endif // CPU_RISCV_CONTINUATIONFREEZETHAW_RISCV_INLINE_HPP
|
180 intptr_t* fp_addr = hf.sp() - 2;
181 *fp_addr = hf.is_interpreted_frame() ? (intptr_t)(hf.fp() - fp_addr)
182 : (intptr_t)hf.fp();
183 }
184
185 inline void FreezeBase::patch_pd(frame& hf, const frame& caller) {
186 if (caller.is_interpreted_frame()) {
187 assert(!caller.is_empty(), "");
188 patch_callee_link_relative(caller, caller.fp());
189 } else {
190 // If we're the bottom-most frame frozen in this freeze, the caller might have stayed frozen in the chunk,
191 // and its oop-containing fp fixed. We've now just overwritten it, so we must patch it back to its value
192 // as read from the chunk.
193 patch_callee_link(caller, caller.fp());
194 }
195 }
196
197 inline void FreezeBase::patch_pd_unused(intptr_t* sp) {
198 }
199
200 inline intptr_t* AnchorMark::anchor_mark_set_pd() {
201 return _top_frame.sp();
202 }
203
204 inline void AnchorMark::anchor_mark_clear_pd() {
205 }
206
207 //////// Thaw
208
209 // Fast path
210
211 inline void ThawBase::prefetch_chunk_pd(void* start, int size) {
212 size <<= LogBytesPerWord;
213 Prefetch::read(start, size);
214 Prefetch::read(start, size - 64);
215 }
216
217 template <typename ConfigT>
218 inline void Thaw<ConfigT>::patch_caller_links(intptr_t* sp, intptr_t* bottom) {
219 // Fast path depends on !PreserveFramePointer. See can_thaw_fast().
220 assert(!PreserveFramePointer, "Frame pointers need to be fixed");
221 }
222
223 // Slow path
224
225 inline frame ThawBase::new_entry_frame() {
226 intptr_t* sp = _cont.entrySP();
302 inline void ThawBase::patch_pd(frame& f, const frame& caller) {
303 patch_callee_link(caller, caller.fp());
304 }
305
306 inline void ThawBase::patch_pd(frame& f, intptr_t* caller_sp) {
307 intptr_t* fp = caller_sp - frame::sender_sp_offset;
308 patch_callee_link(f, fp);
309 }
310
311 inline intptr_t* ThawBase::push_cleanup_continuation() {
312 frame enterSpecial = new_entry_frame();
313 intptr_t* sp = enterSpecial.sp();
314
315 sp[-1] = (intptr_t)ContinuationEntry::cleanup_pc();
316 sp[-2] = (intptr_t)enterSpecial.fp();
317
318 log_develop_trace(continuations, preempt)("push_cleanup_continuation initial sp: " INTPTR_FORMAT " final sp: " INTPTR_FORMAT, p2i(sp + 2 * frame::metadata_words), p2i(sp));
319 return sp;
320 }
321
322 inline intptr_t* ThawBase::push_preempt_adapter() {
323 Unimplemented();
324 return nullptr;
325 }
326
327 inline void ThawBase::derelativize_interpreted_frame_metadata(const frame& hf, const frame& f) {
328 // Make sure that last_sp is kept relativized.
329 assert((intptr_t*)f.at_relative(frame::interpreter_frame_last_sp_offset) == f.unextended_sp(), "");
330
331 // Make sure that monitor_block_top is still relativized.
332 assert(f.at_absolute(frame::interpreter_frame_monitor_block_top_offset) <= frame::interpreter_frame_initial_sp_offset, "");
333
334 DEBUG_ONLY(Method* m = hf.interpreter_frame_method();)
335 DEBUG_ONLY(int extra_space = m->is_object_wait0() ? m->size_of_parameters() : 0;) // see comment in relativize_interpreted_frame_metadata()
336
337 // Make sure that extended_sp is kept relativized.
338 assert((intptr_t*)f.at_relative(frame::interpreter_frame_extended_sp_offset) < f.unextended_sp() + extra_space, "");
339 }
340
341 #endif // CPU_RISCV_CONTINUATIONFREEZETHAW_RISCV_INLINE_HPP
|