< prev index next >

src/hotspot/cpu/riscv/continuationHelper_riscv.inline.hpp

Print this page

 23  */
 24 
 25 #ifndef CPU_RISCV_CONTINUATIONHELPER_RISCV_INLINE_HPP
 26 #define CPU_RISCV_CONTINUATIONHELPER_RISCV_INLINE_HPP
 27 
 28 #include "runtime/continuationHelper.hpp"
 29 
 30 #include "runtime/continuationEntry.inline.hpp"
 31 #include "runtime/frame.inline.hpp"
 32 #include "runtime/registerMap.hpp"
 33 #include "utilities/macros.hpp"
 34 
 35 template<typename FKind>
 36 static inline intptr_t** link_address(const frame& f) {
 37   assert(FKind::is_instance(f), "");
 38   return FKind::interpreted
 39             ? (intptr_t**)(f.fp() + frame::link_offset)
 40             : (intptr_t**)(f.unextended_sp() + f.cb()->frame_size() - 2);
 41 }
 42 




 43 inline int ContinuationHelper::frame_align_words(int size) {
 44 #ifdef _LP64
 45   return size & 1;
 46 #else
 47   return 0;
 48 #endif
 49 }
 50 
 51 inline intptr_t* ContinuationHelper::frame_align_pointer(intptr_t* sp) {
 52 #ifdef _LP64
 53   sp = align_down(sp, frame::frame_alignment);
 54 #endif
 55   return sp;
 56 }
 57 
 58 template<typename FKind>
 59 inline void ContinuationHelper::update_register_map(const frame& f, RegisterMap* map) {
 60   frame::update_map_with_saved_link(map, link_address<FKind>(f));
 61 }
 62 
 63 inline void ContinuationHelper::update_register_map_with_callee(const frame& f, RegisterMap* map) {
 64   frame::update_map_with_saved_link(map, ContinuationHelper::Frame::callee_link_address(f));
 65 }
 66 
 67 inline void ContinuationHelper::push_pd(const frame& f) {
 68   *(intptr_t**)(f.sp() - 2) = f.fp();
 69 }
 70 
 71 inline void ContinuationHelper::set_anchor_to_entry_pd(JavaFrameAnchor* anchor, ContinuationEntry* entry) {
 72   anchor->set_last_Java_fp(entry->entry_fp());
 73 }
 74 
 75 #ifdef ASSERT
 76 inline void ContinuationHelper::set_anchor_pd(JavaFrameAnchor* anchor, intptr_t* sp) {
 77   intptr_t* fp = *(intptr_t**)(sp - 2);
 78   anchor->set_last_Java_fp(fp);
 79 }
 80 

 81 inline bool ContinuationHelper::Frame::assert_frame_laid_out(frame f) {
 82   intptr_t* sp = f.sp();
 83   address pc = *(address*)(sp - frame::sender_sp_ret_address_offset());
 84   intptr_t* fp = *(intptr_t**)(sp - 2);
 85   assert(f.raw_pc() == pc, "f.ra_pc: " INTPTR_FORMAT " actual: " INTPTR_FORMAT, p2i(f.raw_pc()), p2i(pc));
 86   assert(f.fp() == fp, "f.fp: " INTPTR_FORMAT " actual: " INTPTR_FORMAT, p2i(f.fp()), p2i(fp));
 87   return f.raw_pc() == pc && f.fp() == fp;
 88 }
 89 #endif
 90 
 91 inline intptr_t** ContinuationHelper::Frame::callee_link_address(const frame& f) {
 92   return (intptr_t**)(f.sp() - 2);
 93 }
 94 
 95 inline address* ContinuationHelper::Frame::return_pc_address(const frame& f) {
 96   return (address*)(f.real_fp() - 1);
 97 }
 98 
 99 inline address* ContinuationHelper::InterpretedFrame::return_pc_address(const frame& f) {
100   return (address*)(f.fp() + frame::return_addr_offset);

 23  */
 24 
 25 #ifndef CPU_RISCV_CONTINUATIONHELPER_RISCV_INLINE_HPP
 26 #define CPU_RISCV_CONTINUATIONHELPER_RISCV_INLINE_HPP
 27 
 28 #include "runtime/continuationHelper.hpp"
 29 
 30 #include "runtime/continuationEntry.inline.hpp"
 31 #include "runtime/frame.inline.hpp"
 32 #include "runtime/registerMap.hpp"
 33 #include "utilities/macros.hpp"
 34 
 35 template<typename FKind>
 36 static inline intptr_t** link_address(const frame& f) {
 37   assert(FKind::is_instance(f), "");
 38   return FKind::interpreted
 39             ? (intptr_t**)(f.fp() + frame::link_offset)
 40             : (intptr_t**)(f.unextended_sp() + f.cb()->frame_size() - 2);
 41 }
 42 
 43 static inline void patch_return_pc_with_preempt_stub(frame& f) {
 44   Unimplemented();
 45 }
 46 
 47 inline int ContinuationHelper::frame_align_words(int size) {
 48 #ifdef _LP64
 49   return size & 1;
 50 #else
 51   return 0;
 52 #endif
 53 }
 54 
 55 inline intptr_t* ContinuationHelper::frame_align_pointer(intptr_t* sp) {
 56 #ifdef _LP64
 57   sp = align_down(sp, frame::frame_alignment);
 58 #endif
 59   return sp;
 60 }
 61 
 62 template<typename FKind>
 63 inline void ContinuationHelper::update_register_map(const frame& f, RegisterMap* map) {
 64   frame::update_map_with_saved_link(map, link_address<FKind>(f));
 65 }
 66 
 67 inline void ContinuationHelper::update_register_map_with_callee(const frame& f, RegisterMap* map) {
 68   frame::update_map_with_saved_link(map, ContinuationHelper::Frame::callee_link_address(f));
 69 }
 70 
 71 inline void ContinuationHelper::push_pd(const frame& f) {
 72   *(intptr_t**)(f.sp() - 2) = f.fp();
 73 }
 74 
 75 inline void ContinuationHelper::set_anchor_to_entry_pd(JavaFrameAnchor* anchor, ContinuationEntry* entry) {
 76   anchor->set_last_Java_fp(entry->entry_fp());
 77 }
 78 

 79 inline void ContinuationHelper::set_anchor_pd(JavaFrameAnchor* anchor, intptr_t* sp) {
 80   intptr_t* fp = *(intptr_t**)(sp - 2);
 81   anchor->set_last_Java_fp(fp);
 82 }
 83 
 84 #ifdef ASSERT
 85 inline bool ContinuationHelper::Frame::assert_frame_laid_out(frame f) {
 86   intptr_t* sp = f.sp();
 87   address pc = *(address*)(sp - frame::sender_sp_ret_address_offset());
 88   intptr_t* fp = *(intptr_t**)(sp - 2);
 89   assert(f.raw_pc() == pc, "f.ra_pc: " INTPTR_FORMAT " actual: " INTPTR_FORMAT, p2i(f.raw_pc()), p2i(pc));
 90   assert(f.fp() == fp, "f.fp: " INTPTR_FORMAT " actual: " INTPTR_FORMAT, p2i(f.fp()), p2i(fp));
 91   return f.raw_pc() == pc && f.fp() == fp;
 92 }
 93 #endif
 94 
 95 inline intptr_t** ContinuationHelper::Frame::callee_link_address(const frame& f) {
 96   return (intptr_t**)(f.sp() - 2);
 97 }
 98 
 99 inline address* ContinuationHelper::Frame::return_pc_address(const frame& f) {
100   return (address*)(f.real_fp() - 1);
101 }
102 
103 inline address* ContinuationHelper::InterpretedFrame::return_pc_address(const frame& f) {
104   return (address*)(f.fp() + frame::return_addr_offset);
< prev index next >