46 47 // [pointer to locals ] = locals() locals_offset 48 // [constant pool cache ] = cache() cache_offset 49 50 // [methodData ] = mdp() mdx_offset 51 // [methodOop ] = method() method_offset 52 53 // [last esp ] = last_sp() last_sp_offset 54 // [old stack pointer ] (sender_sp) sender_sp_offset 55 56 // [old frame pointer ] <- fp = link() 57 // [return pc ] 58 59 // [last sp ] 60 // [oop temp ] (only for native calls) 61 62 // [locals and parameters ] 63 // <- sender sp 64 // ------------------------------ Asm interpreter ---------------------------------------- 65 66 // ------------------------------ C++ interpreter ---------------------------------------- 67 // 68 // Layout of C++ interpreter frame: (While executing in BytecodeInterpreter::run) 69 // 70 // <- SP (current esp/rsp) 71 // [local variables ] BytecodeInterpreter::run local variables 72 // ... BytecodeInterpreter::run local variables 73 // [local variables ] BytecodeInterpreter::run local variables 74 // [old frame pointer ] fp [ BytecodeInterpreter::run's ebp/rbp ] 75 // [return pc ] (return to frame manager) 76 // [interpreter_state* ] (arg to BytecodeInterpreter::run) -------------- 77 // [expression stack ] <- last_Java_sp | 78 // [... ] * <- interpreter_state.stack | 79 // [expression stack ] * <- interpreter_state.stack_base | 80 // [monitors ] \ | 81 // ... | monitor block size | 82 // [monitors ] / <- interpreter_state.monitor_base | 83 // [struct interpretState ] <-----------------------------------------| 84 // [return pc ] (return to callee of frame manager [1] 85 // [locals and parameters ] 86 // <- sender sp 87 88 // [1] When the c++ interpreter calls a new method it returns to the frame 89 // manager which allocates a new frame on the stack. In that case there 90 // is no real callee of this newly allocated frame. The frame manager is 91 // aware of the additional frame(s) and will pop them as nested calls 92 // complete. Howevers tTo make it look good in the debugger the frame 93 // manager actually installs a dummy pc pointing to RecursiveInterpreterActivation 94 // with a fake interpreter_state* parameter to make it easy to debug 95 // nested calls. 96 97 // Note that contrary to the layout for the assembly interpreter the 98 // expression stack allocated for the C++ interpreter is full sized. 99 // However this is not as bad as it seems as the interpreter frame_manager 100 // will truncate the unused space on succesive method calls. 101 // 102 // ------------------------------ C++ interpreter ---------------------------------------- 103 104 public: 105 enum { 106 pc_return_offset = 0, 107 // All frames 108 link_offset = 0, 109 return_addr_offset = 1, 110 sender_sp_offset = 2, 111 112 #ifndef CC_INTERP 113 114 // Interpreter frames 115 interpreter_frame_oop_temp_offset = 3, // for native calls only 116 117 interpreter_frame_sender_sp_offset = -1, 118 // outgoing sp before a call to an invoked method 119 interpreter_frame_last_sp_offset = interpreter_frame_sender_sp_offset - 1, 120 interpreter_frame_method_offset = interpreter_frame_last_sp_offset - 1, 121 interpreter_frame_mdp_offset = interpreter_frame_method_offset - 1, 122 interpreter_frame_cache_offset = interpreter_frame_mdp_offset - 1, 123 interpreter_frame_locals_offset = interpreter_frame_cache_offset - 1, 124 interpreter_frame_bcp_offset = interpreter_frame_locals_offset - 1, 125 interpreter_frame_initial_sp_offset = interpreter_frame_bcp_offset - 1, 126 127 interpreter_frame_monitor_block_top_offset = interpreter_frame_initial_sp_offset, 128 interpreter_frame_monitor_block_bottom_offset = interpreter_frame_initial_sp_offset, 129 130 #endif // CC_INTERP 131 132 // Entry frames 133 // n.b. these values are determined by the layout defined in 134 // stubGenerator for the Java call stub 135 entry_frame_after_call_words = 27, 136 entry_frame_call_wrapper_offset = -8, 137 138 // we don't need a save area 139 arg_reg_save_area_bytes = 0 140 141 }; 142 143 intptr_t ptr_at(int offset) const { 144 return *ptr_at_addr(offset); 145 } 146 147 void ptr_at_put(int offset, intptr_t value) { 148 *ptr_at_addr(offset) = value; 149 } 150 151 private: 176 frame(intptr_t* sp, intptr_t* fp, address pc); 177 178 frame(intptr_t* sp, intptr_t* unextended_sp, intptr_t* fp, address pc); 179 180 frame(intptr_t* sp, intptr_t* fp); 181 182 void init(intptr_t* sp, intptr_t* fp, address pc); 183 184 // accessors for the instance variables 185 // Note: not necessarily the real 'frame pointer' (see real_fp) 186 intptr_t* fp() const { return _fp; } 187 188 inline address* sender_pc_addr() const; 189 190 // expression stack tos if we are nested in a java call 191 intptr_t* interpreter_frame_last_sp() const; 192 193 // helper to update a map with callee-saved RBP 194 static void update_map_with_saved_link(RegisterMap* map, intptr_t** link_addr); 195 196 #ifndef CC_INTERP 197 // deoptimization support 198 void interpreter_frame_set_last_sp(intptr_t* sp); 199 #endif // CC_INTERP 200 201 #ifdef CC_INTERP 202 inline interpreterState get_interpreterState() const; 203 #endif // CC_INTERP 204 205 #endif // CPU_AARCH64_VM_FRAME_AARCH64_HPP | 46 47 // [pointer to locals ] = locals() locals_offset 48 // [constant pool cache ] = cache() cache_offset 49 50 // [methodData ] = mdp() mdx_offset 51 // [methodOop ] = method() method_offset 52 53 // [last esp ] = last_sp() last_sp_offset 54 // [old stack pointer ] (sender_sp) sender_sp_offset 55 56 // [old frame pointer ] <- fp = link() 57 // [return pc ] 58 59 // [last sp ] 60 // [oop temp ] (only for native calls) 61 62 // [locals and parameters ] 63 // <- sender sp 64 // ------------------------------ Asm interpreter ---------------------------------------- 65 66 public: 67 enum { 68 pc_return_offset = 0, 69 // All frames 70 link_offset = 0, 71 return_addr_offset = 1, 72 sender_sp_offset = 2, 73 74 // Interpreter frames 75 interpreter_frame_oop_temp_offset = 3, // for native calls only 76 77 interpreter_frame_sender_sp_offset = -1, 78 // outgoing sp before a call to an invoked method 79 interpreter_frame_last_sp_offset = interpreter_frame_sender_sp_offset - 1, 80 interpreter_frame_method_offset = interpreter_frame_last_sp_offset - 1, 81 interpreter_frame_mdp_offset = interpreter_frame_method_offset - 1, 82 interpreter_frame_cache_offset = interpreter_frame_mdp_offset - 1, 83 interpreter_frame_locals_offset = interpreter_frame_cache_offset - 1, 84 interpreter_frame_bcp_offset = interpreter_frame_locals_offset - 1, 85 interpreter_frame_initial_sp_offset = interpreter_frame_bcp_offset - 1, 86 87 interpreter_frame_monitor_block_top_offset = interpreter_frame_initial_sp_offset, 88 interpreter_frame_monitor_block_bottom_offset = interpreter_frame_initial_sp_offset, 89 90 // Entry frames 91 // n.b. these values are determined by the layout defined in 92 // stubGenerator for the Java call stub 93 entry_frame_after_call_words = 27, 94 entry_frame_call_wrapper_offset = -8, 95 96 // we don't need a save area 97 arg_reg_save_area_bytes = 0 98 99 }; 100 101 intptr_t ptr_at(int offset) const { 102 return *ptr_at_addr(offset); 103 } 104 105 void ptr_at_put(int offset, intptr_t value) { 106 *ptr_at_addr(offset) = value; 107 } 108 109 private: 134 frame(intptr_t* sp, intptr_t* fp, address pc); 135 136 frame(intptr_t* sp, intptr_t* unextended_sp, intptr_t* fp, address pc); 137 138 frame(intptr_t* sp, intptr_t* fp); 139 140 void init(intptr_t* sp, intptr_t* fp, address pc); 141 142 // accessors for the instance variables 143 // Note: not necessarily the real 'frame pointer' (see real_fp) 144 intptr_t* fp() const { return _fp; } 145 146 inline address* sender_pc_addr() const; 147 148 // expression stack tos if we are nested in a java call 149 intptr_t* interpreter_frame_last_sp() const; 150 151 // helper to update a map with callee-saved RBP 152 static void update_map_with_saved_link(RegisterMap* map, intptr_t** link_addr); 153 154 // deoptimization support 155 void interpreter_frame_set_last_sp(intptr_t* sp); 156 157 #endif // CPU_AARCH64_VM_FRAME_AARCH64_HPP |