183 : (intptr_t)hf.fp();
184 }
185
186 inline void FreezeBase::patch_pd(frame& hf, const frame& caller) {
187 if (caller.is_interpreted_frame()) {
188 assert(!caller.is_empty(), "");
189 patch_callee_link_relative(caller, caller.fp());
190 } else {
191 // If we're the bottom-most frame frozen in this freeze, the caller might have stayed frozen in the chunk,
192 // and its oop-containing fp fixed. We've now just overwritten it, so we must patch it back to its value
193 // as read from the chunk.
194 patch_callee_link(caller, caller.fp());
195 }
196 }
197
198 inline void FreezeBase::patch_pd_unused(intptr_t* sp) {
199 intptr_t* fp_addr = sp - frame::sender_sp_offset;
200 *fp_addr = badAddressVal;
201 }
202
203 //////// Thaw
204
205 // Fast path
206
207 inline void ThawBase::prefetch_chunk_pd(void* start, int size) {
208 size <<= LogBytesPerWord;
209 Prefetch::read(start, size);
210 Prefetch::read(start, size - 64);
211 }
212
213 template <typename ConfigT>
214 inline void Thaw<ConfigT>::patch_caller_links(intptr_t* sp, intptr_t* bottom) {
215 // Fast path depends on !PreserveFramePointer. See can_thaw_fast().
216 assert(!PreserveFramePointer, "Frame pointers need to be fixed");
217 }
218
219 // Slow path
220
221 inline frame ThawBase::new_entry_frame() {
222 intptr_t* sp = _cont.entrySP();
294 inline void ThawBase::patch_pd(frame& f, const frame& caller) {
295 patch_callee_link(caller, caller.fp());
296 }
297
298 inline void ThawBase::patch_pd(frame& f, intptr_t* caller_sp) {
299 intptr_t* fp = caller_sp - frame::sender_sp_offset;
300 patch_callee_link(f, fp);
301 }
302
303 inline intptr_t* ThawBase::push_cleanup_continuation() {
304 frame enterSpecial = new_entry_frame();
305 intptr_t* sp = enterSpecial.sp();
306
307 sp[-1] = (intptr_t)ContinuationEntry::cleanup_pc();
308 sp[-2] = (intptr_t)enterSpecial.fp();
309
310 log_develop_trace(continuations, preempt)("push_cleanup_continuation initial sp: " INTPTR_FORMAT " final sp: " INTPTR_FORMAT, p2i(sp + 2 * frame::metadata_words), p2i(sp));
311 return sp;
312 }
313
314 inline void ThawBase::derelativize_interpreted_frame_metadata(const frame& hf, const frame& f) {
315 // Make sure that last_sp is kept relativized.
316 assert((intptr_t*)f.at_relative(frame::interpreter_frame_last_sp_offset) == f.unextended_sp(), "");
317
318 // Make sure that monitor_block_top is still relativized.
319 assert(f.at_absolute(frame::interpreter_frame_monitor_block_top_offset) <= frame::interpreter_frame_initial_sp_offset, "");
320
321 // Make sure that extended_sp is kept relativized.
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 assert((intptr_t*)f.at_relative(frame::interpreter_frame_extended_sp_offset) < f.unextended_sp() + extra_space, "");
325 }
326
327 #endif // CPU_AARCH64_CONTINUATIONFREEZETHAW_AARCH64_INLINE_HPP
|
183 : (intptr_t)hf.fp();
184 }
185
186 inline void FreezeBase::patch_pd(frame& hf, const frame& caller) {
187 if (caller.is_interpreted_frame()) {
188 assert(!caller.is_empty(), "");
189 patch_callee_link_relative(caller, caller.fp());
190 } else {
191 // If we're the bottom-most frame frozen in this freeze, the caller might have stayed frozen in the chunk,
192 // and its oop-containing fp fixed. We've now just overwritten it, so we must patch it back to its value
193 // as read from the chunk.
194 patch_callee_link(caller, caller.fp());
195 }
196 }
197
198 inline void FreezeBase::patch_pd_unused(intptr_t* sp) {
199 intptr_t* fp_addr = sp - frame::sender_sp_offset;
200 *fp_addr = badAddressVal;
201 }
202
203 inline intptr_t* AnchorMark::anchor_mark_set_pd() {
204 intptr_t* sp = _top_frame.sp();
205 if (_top_frame.is_interpreted_frame()) {
206 // In case the top frame is interpreted we need to set up the anchor using
207 // the last_sp saved in the frame (remove possible alignment added while
208 // thawing, see ThawBase::finish_thaw()). We also need to clear the last_sp
209 // saved in the frame as it is not expected to be set in case we preempt again.
210 _last_sp_from_frame = _top_frame.interpreter_frame_last_sp();
211 assert(_last_sp_from_frame != nullptr, "");
212 _top_frame.interpreter_frame_set_last_sp(nullptr);
213 if (sp != _last_sp_from_frame) {
214 _last_sp_from_frame[-1] = (intptr_t)_top_frame.pc();
215 _last_sp_from_frame[-2] = (intptr_t)_top_frame.fp();
216 }
217 _is_interpreted = true;
218 sp = _last_sp_from_frame;
219 }
220 return sp;
221 }
222
223 inline void AnchorMark::anchor_mark_clear_pd() {
224 if (_is_interpreted) {
225 // Restore last_sp_from_frame and possibly overwritten pc.
226 _top_frame.interpreter_frame_set_last_sp(_last_sp_from_frame);
227 intptr_t* sp = _top_frame.sp();
228 if (sp != _last_sp_from_frame) {
229 sp[-1] = (intptr_t)_top_frame.pc();
230 }
231 }
232 }
233
234 //////// Thaw
235
236 // Fast path
237
238 inline void ThawBase::prefetch_chunk_pd(void* start, int size) {
239 size <<= LogBytesPerWord;
240 Prefetch::read(start, size);
241 Prefetch::read(start, size - 64);
242 }
243
244 template <typename ConfigT>
245 inline void Thaw<ConfigT>::patch_caller_links(intptr_t* sp, intptr_t* bottom) {
246 // Fast path depends on !PreserveFramePointer. See can_thaw_fast().
247 assert(!PreserveFramePointer, "Frame pointers need to be fixed");
248 }
249
250 // Slow path
251
252 inline frame ThawBase::new_entry_frame() {
253 intptr_t* sp = _cont.entrySP();
325 inline void ThawBase::patch_pd(frame& f, const frame& caller) {
326 patch_callee_link(caller, caller.fp());
327 }
328
329 inline void ThawBase::patch_pd(frame& f, intptr_t* caller_sp) {
330 intptr_t* fp = caller_sp - frame::sender_sp_offset;
331 patch_callee_link(f, fp);
332 }
333
334 inline intptr_t* ThawBase::push_cleanup_continuation() {
335 frame enterSpecial = new_entry_frame();
336 intptr_t* sp = enterSpecial.sp();
337
338 sp[-1] = (intptr_t)ContinuationEntry::cleanup_pc();
339 sp[-2] = (intptr_t)enterSpecial.fp();
340
341 log_develop_trace(continuations, preempt)("push_cleanup_continuation initial sp: " INTPTR_FORMAT " final sp: " INTPTR_FORMAT, p2i(sp + 2 * frame::metadata_words), p2i(sp));
342 return sp;
343 }
344
345 inline intptr_t* ThawBase::push_preempt_adapter() {
346 frame enterSpecial = new_entry_frame();
347 intptr_t* sp = enterSpecial.sp();
348
349 sp[-1] = (intptr_t)StubRoutines::cont_preempt_stub();
350
351 log_develop_trace(continuations, preempt)("push_preempt_adapter initial sp: " INTPTR_FORMAT " final sp: " INTPTR_FORMAT, p2i(sp + 2 * frame::metadata_words), p2i(sp));
352 return sp;
353 }
354
355 inline void ThawBase::derelativize_interpreted_frame_metadata(const frame& hf, const frame& f) {
356 // Make sure that last_sp is kept relativized.
357 assert((intptr_t*)f.at_relative(frame::interpreter_frame_last_sp_offset) == f.unextended_sp(), "");
358
359 // Make sure that monitor_block_top is still relativized.
360 assert(f.at_absolute(frame::interpreter_frame_monitor_block_top_offset) <= frame::interpreter_frame_initial_sp_offset, "");
361
362 // Make sure that extended_sp is kept relativized.
363 DEBUG_ONLY(Method* m = hf.interpreter_frame_method();)
364 DEBUG_ONLY(int extra_space = m->is_object_wait0() ? m->size_of_parameters() : 0;) // see comment in relativize_interpreted_frame_metadata()
365 assert((intptr_t*)f.at_relative(frame::interpreter_frame_extended_sp_offset) < f.unextended_sp() + extra_space, "");
366 }
367
368 #endif // CPU_AARCH64_CONTINUATIONFREEZETHAW_AARCH64_INLINE_HPP
|