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