< prev index next >

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

Print this page

 10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 12  * version 2 for more details (a copy is included in the LICENSE file that
 13  * accompanied this code).
 14  *
 15  * You should have received a copy of the GNU General Public License version
 16  * 2 along with this work; if not, write to the Free Software Foundation,
 17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 18  *
 19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 20  * or visit www.oracle.com if you need additional information or have any
 21  * questions.
 22  *
 23  */
 24 
 25 #ifndef SHARE_RUNTIME_FRAME_INLINE_HPP
 26 #define SHARE_RUNTIME_FRAME_INLINE_HPP
 27 
 28 #include "runtime/frame.hpp"
 29 

 30 #include "code/codeBlob.inline.hpp"
 31 #include "code/nmethod.inline.hpp"
 32 #include "interpreter/interpreter.hpp"
 33 #include "oops/stackChunkOop.inline.hpp"
 34 #include "oops/method.hpp"
 35 #include "runtime/continuation.hpp"
 36 #include "runtime/registerMap.hpp"
 37 #include "runtime/stubRoutines.hpp"
 38 #include "utilities/macros.hpp"
 39 #ifdef ZERO
 40 # include "entryFrame_zero.hpp"
 41 # include "fakeStubFrame_zero.hpp"
 42 # include "interpreterFrame_zero.hpp"
 43 #endif
 44 
 45 #include CPU_HEADER_INLINE(frame)
 46 
 47 inline bool frame::is_entry_frame() const {
 48   return StubRoutines::returns_to_call_stub(pc());
 49 }

 64 
 65 inline bool frame::is_compiled_frame() const {
 66   if (_cb != nullptr &&
 67       _cb->is_nmethod() &&
 68       _cb->as_nmethod()->is_java_method()) {
 69     return true;
 70   }
 71   return false;
 72 }
 73 
 74 inline address frame::get_deopt_original_pc() const {
 75   if (_cb == nullptr)  return nullptr;
 76 
 77   nmethod* nm = _cb->as_nmethod_or_null();
 78   if (nm != nullptr && nm->is_deopt_pc(_pc)) {
 79     return nm->get_original_pc(this);
 80   }
 81   return nullptr;
 82 }
 83 



























 84 template <typename RegisterMapT>
 85 inline address frame::oopmapreg_to_location(VMReg reg, const RegisterMapT* reg_map) const {
 86   if (reg->is_reg()) {
 87     // If it is passed in a register, it got spilled in the stub frame.
 88     return reg_map->location(reg, sp());
 89   } else {
 90     int sp_offset_in_bytes = reg->reg2stack() * VMRegImpl::stack_slot_size;
 91     if (reg_map->in_cont()) {
 92       return (address)((intptr_t)reg_map->as_RegisterMap()->stack_chunk()->relativize_usp_offset(*this, sp_offset_in_bytes));
 93     }
 94     address usp = (address)unextended_sp();
 95     assert(reg_map->thread() == nullptr || reg_map->thread()->is_in_usable_stack(usp), INTPTR_FORMAT, p2i(usp));
 96     return (usp + sp_offset_in_bytes);
 97   }
 98 }
 99 
100 template <typename RegisterMapT>
101 inline oop* frame::oopmapreg_to_oop_location(VMReg reg, const RegisterMapT* reg_map) const {
102   return (oop*)oopmapreg_to_location(reg, reg_map);
103 }

 10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 12  * version 2 for more details (a copy is included in the LICENSE file that
 13  * accompanied this code).
 14  *
 15  * You should have received a copy of the GNU General Public License version
 16  * 2 along with this work; if not, write to the Free Software Foundation,
 17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 18  *
 19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 20  * or visit www.oracle.com if you need additional information or have any
 21  * questions.
 22  *
 23  */
 24 
 25 #ifndef SHARE_RUNTIME_FRAME_INLINE_HPP
 26 #define SHARE_RUNTIME_FRAME_INLINE_HPP
 27 
 28 #include "runtime/frame.hpp"
 29 
 30 #include "c1/c1_Runtime1.hpp"
 31 #include "code/codeBlob.inline.hpp"
 32 #include "code/nmethod.inline.hpp"
 33 #include "interpreter/interpreter.hpp"
 34 #include "oops/stackChunkOop.inline.hpp"
 35 #include "oops/method.hpp"
 36 #include "runtime/continuation.hpp"
 37 #include "runtime/registerMap.hpp"
 38 #include "runtime/stubRoutines.hpp"
 39 #include "utilities/macros.hpp"
 40 #ifdef ZERO
 41 # include "entryFrame_zero.hpp"
 42 # include "fakeStubFrame_zero.hpp"
 43 # include "interpreterFrame_zero.hpp"
 44 #endif
 45 
 46 #include CPU_HEADER_INLINE(frame)
 47 
 48 inline bool frame::is_entry_frame() const {
 49   return StubRoutines::returns_to_call_stub(pc());
 50 }

 65 
 66 inline bool frame::is_compiled_frame() const {
 67   if (_cb != nullptr &&
 68       _cb->is_nmethod() &&
 69       _cb->as_nmethod()->is_java_method()) {
 70     return true;
 71   }
 72   return false;
 73 }
 74 
 75 inline address frame::get_deopt_original_pc() const {
 76   if (_cb == nullptr)  return nullptr;
 77 
 78   nmethod* nm = _cb->as_nmethod_or_null();
 79   if (nm != nullptr && nm->is_deopt_pc(_pc)) {
 80     return nm->get_original_pc(this);
 81   }
 82   return nullptr;
 83 }
 84 
 85 #ifdef ASSERT
 86 static address get_register_address_in_stub(const frame& stub_fr, VMReg reg) {
 87   RegisterMap map(nullptr,
 88                   RegisterMap::UpdateMap::include,
 89                   RegisterMap::ProcessFrames::skip,
 90                   RegisterMap::WalkContinuation::skip);
 91   stub_fr.oop_map()->update_register_map(&stub_fr, &map);
 92   return map.location(reg, stub_fr.sp());
 93 }
 94 #endif
 95 
 96 inline JavaThread** frame::saved_thread_address(const frame& f) {
 97   CodeBlob* cb = f.cb();
 98   assert(cb != nullptr && cb->is_runtime_stub(), "invalid frame");
 99 
100   JavaThread** thread_addr;
101   if (cb == Runtime1::blob_for(Runtime1::monitorenter_id) ||
102       cb == Runtime1::blob_for(Runtime1::monitorenter_nofpu_id)) {
103     thread_addr = (JavaThread**)(f.sp() + Runtime1::runtime_blob_current_thread_offset(f));
104   } else {
105     // c2 only saves rbp in the stub frame so nothing to do.
106     thread_addr = nullptr;
107   }
108   assert(get_register_address_in_stub(f, SharedRuntime::thread_register()) == (address)thread_addr, "wrong thread address");
109   return thread_addr;
110 }
111 
112 template <typename RegisterMapT>
113 inline address frame::oopmapreg_to_location(VMReg reg, const RegisterMapT* reg_map) const {
114   if (reg->is_reg()) {
115     // If it is passed in a register, it got spilled in the stub frame.
116     return reg_map->location(reg, sp());
117   } else {
118     int sp_offset_in_bytes = reg->reg2stack() * VMRegImpl::stack_slot_size;
119     if (reg_map->in_cont()) {
120       return (address)((intptr_t)reg_map->as_RegisterMap()->stack_chunk()->relativize_usp_offset(*this, sp_offset_in_bytes));
121     }
122     address usp = (address)unextended_sp();
123     assert(reg_map->thread() == nullptr || reg_map->thread()->is_in_usable_stack(usp), INTPTR_FORMAT, p2i(usp));
124     return (usp + sp_offset_in_bytes);
125   }
126 }
127 
128 template <typename RegisterMapT>
129 inline oop* frame::oopmapreg_to_oop_location(VMReg reg, const RegisterMapT* reg_map) const {
130   return (oop*)oopmapreg_to_location(reg, reg_map);
131 }
< prev index next >