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