18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 19 * 20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 21 * or visit www.oracle.com if you need additional information or have any 22 * questions. 23 * 24 */ 25 26 #ifndef CPU_AARCH64_VM_INTERP_MASM_AARCH64_64_HPP 27 #define CPU_AARCH64_VM_INTERP_MASM_AARCH64_64_HPP 28 29 #include "asm/macroAssembler.hpp" 30 #include "asm/macroAssembler.inline.hpp" 31 #include "interpreter/invocationCounter.hpp" 32 #include "runtime/frame.hpp" 33 34 // This file specializes the assember with interpreter-specific macros 35 36 37 class InterpreterMacroAssembler: public MacroAssembler { 38 #ifndef CC_INTERP 39 protected: 40 41 protected: 42 using MacroAssembler::call_VM_leaf_base; 43 44 // Interpreter specific version of call_VM_base 45 using MacroAssembler::call_VM_leaf_base; 46 47 virtual void call_VM_leaf_base(address entry_point, 48 int number_of_arguments); 49 50 virtual void call_VM_base(Register oop_result, 51 Register java_thread, 52 Register last_java_sp, 53 address entry_point, 54 int number_of_arguments, 55 bool check_exceptions); 56 57 virtual void check_and_handle_popframe(Register java_thread); 58 virtual void check_and_handle_earlyret(Register java_thread); 59 60 // base routine for all dispatches 61 void dispatch_base(TosState state, address* table, bool verifyoop = true); 62 #endif // CC_INTERP 63 64 public: 65 InterpreterMacroAssembler(CodeBuffer* code) : MacroAssembler(code) {} 66 67 void load_earlyret_value(TosState state); 68 69 void jump_to_entry(address entry); 70 71 #ifdef CC_INTERP 72 void save_bcp() { /* not needed in c++ interpreter and harmless */ } 73 void restore_bcp() { /* not needed in c++ interpreter and harmless */ } 74 75 // Helpers for runtime call arguments/results 76 void get_method(Register reg); 77 78 #else 79 80 // Interpreter-specific registers 81 void save_bcp() { 82 str(rbcp, Address(rfp, frame::interpreter_frame_bcp_offset * wordSize)); 83 } 84 85 void restore_bcp() { 86 ldr(rbcp, Address(rfp, frame::interpreter_frame_bcp_offset * wordSize)); 87 } 88 89 void restore_locals() { 90 ldr(rlocals, Address(rfp, frame::interpreter_frame_locals_offset * wordSize)); 91 } 92 93 void restore_constant_pool_cache() { 94 ldr(rcpool, Address(rfp, frame::interpreter_frame_cache_offset * wordSize)); 95 } 96 97 void get_dispatch(); 98 99 // Helpers for runtime call arguments/results 185 void prepare_to_jump_from_interpreted(); 186 void jump_from_interpreted(Register method, Register temp); 187 188 189 // Returning from interpreted functions 190 // 191 // Removes the current activation (incl. unlocking of monitors) 192 // and sets up the return address. This code is also used for 193 // exception unwindwing. In that case, we do not want to throw 194 // IllegalMonitorStateExceptions, since that might get us into an 195 // infinite rethrow exception loop. 196 // Additionally this code is used for popFrame and earlyReturn. 197 // In popFrame case we want to skip throwing an exception, 198 // installing an exception, and notifying jvmdi. 199 // In earlyReturn case we only want to skip throwing an exception 200 // and installing an exception. 201 void remove_activation(TosState state, 202 bool throw_monitor_exception = true, 203 bool install_monitor_exception = true, 204 bool notify_jvmdi = true); 205 #endif // CC_INTERP 206 207 // FIXME: Give us a valid frame at a null check. 208 virtual void null_check(Register reg, int offset = -1) { 209 // #ifdef ASSERT 210 // save_bcp(); 211 // set_last_Java_frame(esp, rfp, (address) pc()); 212 // #endif 213 MacroAssembler::null_check(reg, offset); 214 // #ifdef ASSERT 215 // reset_last_Java_frame(true, false); 216 // #endif 217 } 218 219 // Object locking 220 void lock_object (Register lock_reg); 221 void unlock_object(Register lock_reg); 222 223 #ifndef CC_INTERP 224 225 // Interpreter profiling operations 226 void set_method_data_pointer_for_bcp(); 227 void test_method_data_pointer(Register mdp, Label& zero_continue); 228 void verify_method_data_pointer(); 229 230 void set_mdp_data_at(Register mdp_in, int constant, Register value); 231 void increment_mdp_data_at(Address data, bool decrement = false); 232 void increment_mdp_data_at(Register mdp_in, int constant, 233 bool decrement = false); 234 void increment_mdp_data_at(Register mdp_in, Register reg, int constant, 235 bool decrement = false); 236 void increment_mask_and_jump(Address counter_addr, 237 int increment, Address mask, 238 Register scratch, Register scratch2, 239 bool preloaded, Condition cond, 240 Label* where); 241 void set_mdp_flag_at(Register mdp_in, int flag_constant); 242 void test_mdp_data_at(Register mdp_in, int offset, Register value, 243 Register test_value_out, 244 Label& not_equal_continue); 262 Register scratch2, 263 bool receiver_can_be_null = false); 264 void profile_ret(Register return_bci, Register mdp); 265 void profile_null_seen(Register mdp); 266 void profile_typecheck(Register mdp, Register klass, Register scratch); 267 void profile_typecheck_failed(Register mdp); 268 void profile_switch_default(Register mdp); 269 void profile_switch_case(Register index_in_scratch, Register mdp, 270 Register scratch2); 271 272 void profile_obj_type(Register obj, const Address& mdo_addr); 273 void profile_arguments_type(Register mdp, Register callee, Register tmp, bool is_virtual); 274 void profile_return_type(Register mdp, Register ret, Register tmp); 275 void profile_parameters_type(Register mdp, Register tmp1, Register tmp2); 276 277 // Debugging 278 // only if +VerifyOops && state == atos 279 void verify_oop(Register reg, TosState state = atos); 280 // only if +VerifyFPU && (state == ftos || state == dtos) 281 void verify_FPU(int stack_depth, TosState state = ftos); 282 283 #endif // !CC_INTERP 284 285 typedef enum { NotifyJVMTI, SkipNotifyJVMTI } NotifyMethodExitMode; 286 287 // support for jvmti/dtrace 288 void notify_method_entry(); 289 void notify_method_exit(TosState state, NotifyMethodExitMode mode); 290 291 virtual void _call_Unimplemented(address call_site) { 292 save_bcp(); 293 set_last_Java_frame(esp, rfp, (address) pc(), rscratch1); 294 MacroAssembler::_call_Unimplemented(call_site); 295 } 296 }; 297 298 #endif // CPU_AARCH64_VM_INTERP_MASM_AARCH64_64_HPP | 18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 19 * 20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 21 * or visit www.oracle.com if you need additional information or have any 22 * questions. 23 * 24 */ 25 26 #ifndef CPU_AARCH64_VM_INTERP_MASM_AARCH64_64_HPP 27 #define CPU_AARCH64_VM_INTERP_MASM_AARCH64_64_HPP 28 29 #include "asm/macroAssembler.hpp" 30 #include "asm/macroAssembler.inline.hpp" 31 #include "interpreter/invocationCounter.hpp" 32 #include "runtime/frame.hpp" 33 34 // This file specializes the assember with interpreter-specific macros 35 36 37 class InterpreterMacroAssembler: public MacroAssembler { 38 protected: 39 40 protected: 41 using MacroAssembler::call_VM_leaf_base; 42 43 // Interpreter specific version of call_VM_base 44 using MacroAssembler::call_VM_leaf_base; 45 46 virtual void call_VM_leaf_base(address entry_point, 47 int number_of_arguments); 48 49 virtual void call_VM_base(Register oop_result, 50 Register java_thread, 51 Register last_java_sp, 52 address entry_point, 53 int number_of_arguments, 54 bool check_exceptions); 55 56 virtual void check_and_handle_popframe(Register java_thread); 57 virtual void check_and_handle_earlyret(Register java_thread); 58 59 // base routine for all dispatches 60 void dispatch_base(TosState state, address* table, bool verifyoop = true); 61 62 public: 63 InterpreterMacroAssembler(CodeBuffer* code) : MacroAssembler(code) {} 64 65 void load_earlyret_value(TosState state); 66 67 void jump_to_entry(address entry); 68 69 // Interpreter-specific registers 70 void save_bcp() { 71 str(rbcp, Address(rfp, frame::interpreter_frame_bcp_offset * wordSize)); 72 } 73 74 void restore_bcp() { 75 ldr(rbcp, Address(rfp, frame::interpreter_frame_bcp_offset * wordSize)); 76 } 77 78 void restore_locals() { 79 ldr(rlocals, Address(rfp, frame::interpreter_frame_locals_offset * wordSize)); 80 } 81 82 void restore_constant_pool_cache() { 83 ldr(rcpool, Address(rfp, frame::interpreter_frame_cache_offset * wordSize)); 84 } 85 86 void get_dispatch(); 87 88 // Helpers for runtime call arguments/results 174 void prepare_to_jump_from_interpreted(); 175 void jump_from_interpreted(Register method, Register temp); 176 177 178 // Returning from interpreted functions 179 // 180 // Removes the current activation (incl. unlocking of monitors) 181 // and sets up the return address. This code is also used for 182 // exception unwindwing. In that case, we do not want to throw 183 // IllegalMonitorStateExceptions, since that might get us into an 184 // infinite rethrow exception loop. 185 // Additionally this code is used for popFrame and earlyReturn. 186 // In popFrame case we want to skip throwing an exception, 187 // installing an exception, and notifying jvmdi. 188 // In earlyReturn case we only want to skip throwing an exception 189 // and installing an exception. 190 void remove_activation(TosState state, 191 bool throw_monitor_exception = true, 192 bool install_monitor_exception = true, 193 bool notify_jvmdi = true); 194 195 // FIXME: Give us a valid frame at a null check. 196 virtual void null_check(Register reg, int offset = -1) { 197 // #ifdef ASSERT 198 // save_bcp(); 199 // set_last_Java_frame(esp, rfp, (address) pc()); 200 // #endif 201 MacroAssembler::null_check(reg, offset); 202 // #ifdef ASSERT 203 // reset_last_Java_frame(true, false); 204 // #endif 205 } 206 207 // Object locking 208 void lock_object (Register lock_reg); 209 void unlock_object(Register lock_reg); 210 211 // Interpreter profiling operations 212 void set_method_data_pointer_for_bcp(); 213 void test_method_data_pointer(Register mdp, Label& zero_continue); 214 void verify_method_data_pointer(); 215 216 void set_mdp_data_at(Register mdp_in, int constant, Register value); 217 void increment_mdp_data_at(Address data, bool decrement = false); 218 void increment_mdp_data_at(Register mdp_in, int constant, 219 bool decrement = false); 220 void increment_mdp_data_at(Register mdp_in, Register reg, int constant, 221 bool decrement = false); 222 void increment_mask_and_jump(Address counter_addr, 223 int increment, Address mask, 224 Register scratch, Register scratch2, 225 bool preloaded, Condition cond, 226 Label* where); 227 void set_mdp_flag_at(Register mdp_in, int flag_constant); 228 void test_mdp_data_at(Register mdp_in, int offset, Register value, 229 Register test_value_out, 230 Label& not_equal_continue); 248 Register scratch2, 249 bool receiver_can_be_null = false); 250 void profile_ret(Register return_bci, Register mdp); 251 void profile_null_seen(Register mdp); 252 void profile_typecheck(Register mdp, Register klass, Register scratch); 253 void profile_typecheck_failed(Register mdp); 254 void profile_switch_default(Register mdp); 255 void profile_switch_case(Register index_in_scratch, Register mdp, 256 Register scratch2); 257 258 void profile_obj_type(Register obj, const Address& mdo_addr); 259 void profile_arguments_type(Register mdp, Register callee, Register tmp, bool is_virtual); 260 void profile_return_type(Register mdp, Register ret, Register tmp); 261 void profile_parameters_type(Register mdp, Register tmp1, Register tmp2); 262 263 // Debugging 264 // only if +VerifyOops && state == atos 265 void verify_oop(Register reg, TosState state = atos); 266 // only if +VerifyFPU && (state == ftos || state == dtos) 267 void verify_FPU(int stack_depth, TosState state = ftos); 268 269 typedef enum { NotifyJVMTI, SkipNotifyJVMTI } NotifyMethodExitMode; 270 271 // support for jvmti/dtrace 272 void notify_method_entry(); 273 void notify_method_exit(TosState state, NotifyMethodExitMode mode); 274 275 virtual void _call_Unimplemented(address call_site) { 276 save_bcp(); 277 set_last_Java_frame(esp, rfp, (address) pc(), rscratch1); 278 MacroAssembler::_call_Unimplemented(call_site); 279 } 280 }; 281 282 #endif // CPU_AARCH64_VM_INTERP_MASM_AARCH64_64_HPP |