< prev index next >

src/hotspot/cpu/aarch64/continuationHelper_aarch64.inline.hpp

Print this page
@@ -38,10 +38,29 @@
    return FKind::interpreted
              ? (intptr_t**)(f.fp() + frame::link_offset)
              : (intptr_t**)(f.unextended_sp() + f.cb()->frame_size() - frame::sender_sp_offset);
  }
  
+ static inline void patch_return_pc_with_preempt_stub(frame& f) {
+   // Unlike x86 we don't know where in the callee frame the return pc is
+   // saved so we can't patch the return from the VM call back to Java. If
+   // the target is coming from compiled code we will patch the return from
+   // the safepoint handler blob back to the compiled method instead. If
+   // it's coming from the interpreter, the target will check for preemption
+   // once it returns to the interpreter and will manually jump to the
+   // preempt stub.
+   if (!f.is_interpreted_frame()) {
+     assert(f.is_runtime_frame(), "invariant");
+     intptr_t* caller_sp = f.sp() + f.cb()->frame_size();
+     caller_sp[-1] = (intptr_t)StubRoutines::cont_preempt_stub();
+   } else {
+     JavaThread *thread = JavaThread::current();
+     thread->set_preempt_alternate_return(StubRoutines::cont_preempt_stub());
+     thread->set_preempt_alternate_return_sp((address)f.sp());
+   }
+ }
+ 
  inline int ContinuationHelper::frame_align_words(int size) {
  #ifdef _LP64
    return size & 1;
  #else
    return 0;

@@ -81,16 +100,16 @@
  
  inline void ContinuationHelper::set_anchor_to_entry_pd(JavaFrameAnchor* anchor, ContinuationEntry* entry) {
    anchor->set_last_Java_fp(entry->entry_fp());
  }
  
- #ifdef ASSERT
  inline void ContinuationHelper::set_anchor_pd(JavaFrameAnchor* anchor, intptr_t* sp) {
    intptr_t* fp = *(intptr_t**)(sp - frame::sender_sp_offset);
    anchor->set_last_Java_fp(fp);
  }
  
+ #ifdef ASSERT
  inline bool ContinuationHelper::Frame::assert_frame_laid_out(frame f) {
    intptr_t* sp = f.sp();
    address pc = ContinuationHelper::return_address_at(
                   sp - frame::sender_sp_ret_address_offset());
    intptr_t* fp = *(intptr_t**)(sp - frame::sender_sp_offset);
< prev index next >