177
178 *(hf.sp() - 1) = (intptr_t)hf.pc();
179
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 //////// Thaw
198
199 // Fast path
200
201 inline void ThawBase::prefetch_chunk_pd(void* start, int size) {
202 size <<= LogBytesPerWord;
203 Prefetch::read(start, size);
204 Prefetch::read(start, size - 64);
205 }
206
207 template <typename ConfigT>
208 inline void Thaw<ConfigT>::patch_caller_links(intptr_t* sp, intptr_t* bottom) {
209 // Fast path depends on !PreserveFramePointer. See can_thaw_fast().
210 assert(!PreserveFramePointer, "Frame pointers need to be fixed");
211 }
212
213 // Slow path
214
215 inline frame ThawBase::new_entry_frame() {
216 intptr_t* sp = _cont.entrySP();
292 inline void ThawBase::patch_pd(frame& f, const frame& caller) {
293 patch_callee_link(caller, caller.fp());
294 }
295
296 inline void ThawBase::patch_pd(frame& f, intptr_t* caller_sp) {
297 intptr_t* fp = caller_sp - frame::sender_sp_offset;
298 patch_callee_link(f, fp);
299 }
300
301 inline intptr_t* ThawBase::push_cleanup_continuation() {
302 frame enterSpecial = new_entry_frame();
303 intptr_t* sp = enterSpecial.sp();
304
305 sp[-1] = (intptr_t)ContinuationEntry::cleanup_pc();
306 sp[-2] = (intptr_t)enterSpecial.fp();
307
308 log_develop_trace(continuations, preempt)("push_cleanup_continuation initial sp: " INTPTR_FORMAT " final sp: " INTPTR_FORMAT, p2i(sp + 2 * frame::metadata_words), p2i(sp));
309 return sp;
310 }
311
312 inline void ThawBase::derelativize_interpreted_frame_metadata(const frame& hf, const frame& f) {
313 // Make sure that last_sp is kept relativized.
314 assert((intptr_t*)f.at_relative(frame::interpreter_frame_last_sp_offset) == f.unextended_sp(), "");
315
316 // Make sure that monitor_block_top is still relativized.
317 assert(f.at_absolute(frame::interpreter_frame_monitor_block_top_offset) <= frame::interpreter_frame_initial_sp_offset, "");
318
319 DEBUG_ONLY(Method* m = hf.interpreter_frame_method();)
320 DEBUG_ONLY(int extra_space = m->is_object_wait0() ? m->size_of_parameters() : 0;) // see comment in relativize_interpreted_frame_metadata()
321
322 // Make sure that extended_sp is kept relativized.
323 assert((intptr_t*)f.at_relative(frame::interpreter_frame_extended_sp_offset) < f.unextended_sp() + extra_space, "");
324 }
325
326 #endif // CPU_RISCV_CONTINUATIONFREEZETHAW_RISCV_INLINE_HPP
|
177
178 *(hf.sp() - 1) = (intptr_t)hf.pc();
179
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 intptr_t* AnchorMark::anchor_mark_set_pd() {
198 return _top_frame.sp();
199 }
200
201 inline void AnchorMark::anchor_mark_clear_pd() {
202 }
203
204 //////// Thaw
205
206 // Fast path
207
208 inline void ThawBase::prefetch_chunk_pd(void* start, int size) {
209 size <<= LogBytesPerWord;
210 Prefetch::read(start, size);
211 Prefetch::read(start, size - 64);
212 }
213
214 template <typename ConfigT>
215 inline void Thaw<ConfigT>::patch_caller_links(intptr_t* sp, intptr_t* bottom) {
216 // Fast path depends on !PreserveFramePointer. See can_thaw_fast().
217 assert(!PreserveFramePointer, "Frame pointers need to be fixed");
218 }
219
220 // Slow path
221
222 inline frame ThawBase::new_entry_frame() {
223 intptr_t* sp = _cont.entrySP();
299 inline void ThawBase::patch_pd(frame& f, const frame& caller) {
300 patch_callee_link(caller, caller.fp());
301 }
302
303 inline void ThawBase::patch_pd(frame& f, intptr_t* caller_sp) {
304 intptr_t* fp = caller_sp - frame::sender_sp_offset;
305 patch_callee_link(f, fp);
306 }
307
308 inline intptr_t* ThawBase::push_cleanup_continuation() {
309 frame enterSpecial = new_entry_frame();
310 intptr_t* sp = enterSpecial.sp();
311
312 sp[-1] = (intptr_t)ContinuationEntry::cleanup_pc();
313 sp[-2] = (intptr_t)enterSpecial.fp();
314
315 log_develop_trace(continuations, preempt)("push_cleanup_continuation initial sp: " INTPTR_FORMAT " final sp: " INTPTR_FORMAT, p2i(sp + 2 * frame::metadata_words), p2i(sp));
316 return sp;
317 }
318
319 inline intptr_t* ThawBase::push_preempt_adapter() {
320 Unimplemented();
321 return nullptr;
322 }
323
324 inline void ThawBase::derelativize_interpreted_frame_metadata(const frame& hf, const frame& f) {
325 // Make sure that last_sp is kept relativized.
326 assert((intptr_t*)f.at_relative(frame::interpreter_frame_last_sp_offset) == f.unextended_sp(), "");
327
328 // Make sure that monitor_block_top is still relativized.
329 assert(f.at_absolute(frame::interpreter_frame_monitor_block_top_offset) <= frame::interpreter_frame_initial_sp_offset, "");
330
331 DEBUG_ONLY(Method* m = hf.interpreter_frame_method();)
332 DEBUG_ONLY(int extra_space = m->is_object_wait0() ? m->size_of_parameters() : 0;) // see comment in relativize_interpreted_frame_metadata()
333
334 // Make sure that extended_sp is kept relativized.
335 assert((intptr_t*)f.at_relative(frame::interpreter_frame_extended_sp_offset) < f.unextended_sp() + extra_space, "");
336 }
337
338 #endif // CPU_RISCV_CONTINUATIONFREEZETHAW_RISCV_INLINE_HPP
|