< prev index next >

src/hotspot/share/runtime/frame.inline.hpp

Print this page
@@ -25,10 +25,11 @@
  #ifndef SHARE_RUNTIME_FRAME_INLINE_HPP
  #define SHARE_RUNTIME_FRAME_INLINE_HPP
  
  #include "runtime/frame.hpp"
  
+ #include "c1/c1_Runtime1.hpp"
  #include "code/codeBlob.inline.hpp"
  #include "code/compiledMethod.inline.hpp"
  #include "interpreter/interpreter.hpp"
  #include "oops/stackChunkOop.inline.hpp"
  #include "oops/method.hpp"

@@ -69,10 +70,37 @@
      return true;
    }
    return false;
  }
  
+ #ifdef ASSERT
+ static address get_register_address_in_stub(const frame& stub_fr, VMReg reg) {
+   RegisterMap map(nullptr,
+                   RegisterMap::UpdateMap::include,
+                   RegisterMap::ProcessFrames::skip,
+                   RegisterMap::WalkContinuation::skip);
+   stub_fr.oop_map()->update_register_map(&stub_fr, &map);
+   return map.location(reg, stub_fr.sp());
+ }
+ #endif
+ 
+ inline JavaThread** frame::saved_thread_address(const frame& f) {
+   CodeBlob* cb = f.cb();
+   assert(cb != nullptr && cb->is_runtime_stub(), "invalid frame");
+ 
+   JavaThread** thread_addr;
+   if (cb == Runtime1::blob_for(Runtime1::monitorenter_id) ||
+       cb == Runtime1::blob_for(Runtime1::monitorenter_nofpu_id)) {
+     thread_addr = (JavaThread**)(f.sp() + Runtime1::runtime_blob_current_thread_offset(f));
+   } else {
+     // c2 only saves rbp in the stub frame so nothing to do.
+     thread_addr = nullptr;
+   }
+   assert(get_register_address_in_stub(f, SharedRuntime::thread_register()) == (address)thread_addr, "wrong thread address");
+   return thread_addr;
+ }
+ 
  template <typename RegisterMapT>
  inline address frame::oopmapreg_to_location(VMReg reg, const RegisterMapT* reg_map) const {
    if (reg->is_reg()) {
      // If it is passed in a register, it got spilled in the stub frame.
      return reg_map->location(reg, sp());
< prev index next >