< 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/compiledMethod.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 }

 54 
 55 inline bool frame::is_first_frame() const {
 56   return (is_entry_frame() && entry_frame_is_first())
 57       // Upcall stub frames entry frames are only present on certain platforms
 58       || (is_upcall_stub_frame() && upcall_stub_frame_is_first());
 59 }
 60 
 61 inline bool frame::is_upcall_stub_frame() const {
 62   return _cb != nullptr && _cb->is_upcall_stub();
 63 }
 64 
 65 inline bool frame::is_compiled_frame() const {
 66   if (_cb != nullptr &&
 67       _cb->is_compiled() &&
 68       ((CompiledMethod*)_cb)->is_java_method()) {
 69     return true;
 70   }
 71   return false;
 72 }
 73 



























 74 template <typename RegisterMapT>
 75 inline address frame::oopmapreg_to_location(VMReg reg, const RegisterMapT* reg_map) const {
 76   if (reg->is_reg()) {
 77     // If it is passed in a register, it got spilled in the stub frame.
 78     return reg_map->location(reg, sp());
 79   } else {
 80     int sp_offset_in_bytes = reg->reg2stack() * VMRegImpl::stack_slot_size;
 81     if (reg_map->in_cont()) {
 82       return (address)((intptr_t)reg_map->as_RegisterMap()->stack_chunk()->relativize_usp_offset(*this, sp_offset_in_bytes));
 83     }
 84     address usp = (address)unextended_sp();
 85     assert(reg_map->thread() == nullptr || reg_map->thread()->is_in_usable_stack(usp), INTPTR_FORMAT, p2i(usp));
 86     return (usp + sp_offset_in_bytes);
 87   }
 88 }
 89 
 90 template <typename RegisterMapT>
 91 inline oop* frame::oopmapreg_to_oop_location(VMReg reg, const RegisterMapT* reg_map) const {
 92   return (oop*)oopmapreg_to_location(reg, reg_map);
 93 }

 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/compiledMethod.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 }

 55 
 56 inline bool frame::is_first_frame() const {
 57   return (is_entry_frame() && entry_frame_is_first())
 58       // Upcall stub frames entry frames are only present on certain platforms
 59       || (is_upcall_stub_frame() && upcall_stub_frame_is_first());
 60 }
 61 
 62 inline bool frame::is_upcall_stub_frame() const {
 63   return _cb != nullptr && _cb->is_upcall_stub();
 64 }
 65 
 66 inline bool frame::is_compiled_frame() const {
 67   if (_cb != nullptr &&
 68       _cb->is_compiled() &&
 69       ((CompiledMethod*)_cb)->is_java_method()) {
 70     return true;
 71   }
 72   return false;
 73 }
 74 
 75 #ifdef ASSERT
 76 static address get_register_address_in_stub(const frame& stub_fr, VMReg reg) {
 77   RegisterMap map(nullptr,
 78                   RegisterMap::UpdateMap::include,
 79                   RegisterMap::ProcessFrames::skip,
 80                   RegisterMap::WalkContinuation::skip);
 81   stub_fr.oop_map()->update_register_map(&stub_fr, &map);
 82   return map.location(reg, stub_fr.sp());
 83 }
 84 #endif
 85 
 86 inline JavaThread** frame::saved_thread_address(const frame& f) {
 87   CodeBlob* cb = f.cb();
 88   assert(cb != nullptr && cb->is_runtime_stub(), "invalid frame");
 89 
 90   JavaThread** thread_addr;
 91   if (cb == Runtime1::blob_for(Runtime1::monitorenter_id) ||
 92       cb == Runtime1::blob_for(Runtime1::monitorenter_nofpu_id)) {
 93     thread_addr = (JavaThread**)(f.sp() + Runtime1::runtime_blob_current_thread_offset(f));
 94   } else {
 95     // c2 only saves rbp in the stub frame so nothing to do.
 96     thread_addr = nullptr;
 97   }
 98   assert(get_register_address_in_stub(f, SharedRuntime::thread_register()) == (address)thread_addr, "wrong thread address");
 99   return thread_addr;
100 }
101 
102 template <typename RegisterMapT>
103 inline address frame::oopmapreg_to_location(VMReg reg, const RegisterMapT* reg_map) const {
104   if (reg->is_reg()) {
105     // If it is passed in a register, it got spilled in the stub frame.
106     return reg_map->location(reg, sp());
107   } else {
108     int sp_offset_in_bytes = reg->reg2stack() * VMRegImpl::stack_slot_size;
109     if (reg_map->in_cont()) {
110       return (address)((intptr_t)reg_map->as_RegisterMap()->stack_chunk()->relativize_usp_offset(*this, sp_offset_in_bytes));
111     }
112     address usp = (address)unextended_sp();
113     assert(reg_map->thread() == nullptr || reg_map->thread()->is_in_usable_stack(usp), INTPTR_FORMAT, p2i(usp));
114     return (usp + sp_offset_in_bytes);
115   }
116 }
117 
118 template <typename RegisterMapT>
119 inline oop* frame::oopmapreg_to_oop_location(VMReg reg, const RegisterMapT* reg_map) const {
120   return (oop*)oopmapreg_to_location(reg, reg_map);
121 }
< prev index next >