32 // This file specializes the assembler with interpreter-specific macros.
33
34
35 class InterpreterMacroAssembler: public MacroAssembler {
36
37 public:
38 InterpreterMacroAssembler(CodeBuffer* code) : MacroAssembler(code) {}
39
40 void null_check_throw(Register a, int offset, Register temp_reg);
41 void load_klass_check_null_throw(Register dst, Register src, Register temp_reg);
42
43 void jump_to_entry(address entry, Register Rscratch);
44
45 // Handy address generation macros.
46 #define thread_(field_name) in_bytes(JavaThread::field_name ## _offset()), R16_thread
47 #define method_(field_name) in_bytes(Method::field_name ## _offset()), R19_method
48
49 virtual void check_and_handle_popframe(Register scratch_reg);
50 virtual void check_and_handle_earlyret(Register scratch_reg);
51
52 // Base routine for all dispatches.
53 void dispatch_base(TosState state, address* table);
54
55 void load_earlyret_value(TosState state, Register Rscratch1);
56
57 static const Address l_tmp;
58 static const Address d_tmp;
59
60 // dispatch routines
61 void dispatch_next(TosState state, int step = 0, bool generate_poll = false);
62 void dispatch_via (TosState state, address* table);
63 void load_dispatch_table(Register dst, address* table);
64 void dispatch_Lbyte_code(TosState state, Register bytecode, address* table, bool generate_poll = false);
65
66 // Called by shared interpreter generator.
67 void dispatch_prolog(TosState state, int step = 0);
68 void dispatch_epilog(TosState state, int step = 0);
69
70 // Super call_VM calls - correspond to MacroAssembler::call_VM(_leaf) calls.
71 void super_call_VM_leaf(Register thread_cache, address entry_point, Register arg_1);
165 void merge_frames(Register Rtop_frame_sp, Register return_pc, Register Rscratch1, Register Rscratch2); // merge top frames
166
167 void add_monitor_to_stack(bool stack_is_empty, Register Rtemp1, Register Rtemp2);
168
169 // Local variable access helpers
170 void load_local_int(Register Rdst_value, Register Rdst_address, Register Rindex);
171 void load_local_long(Register Rdst_value, Register Rdst_address, Register Rindex);
172 void load_local_ptr(Register Rdst_value, Register Rdst_address, Register Rindex);
173 void load_local_float(FloatRegister Rdst_value, Register Rdst_address, Register Rindex);
174 void load_local_double(FloatRegister Rdst_value, Register Rdst_address, Register Rindex);
175 void store_local_int(Register Rvalue, Register Rindex);
176 void store_local_long(Register Rvalue, Register Rindex);
177 void store_local_ptr(Register Rvalue, Register Rindex);
178 void store_local_float(FloatRegister Rvalue, Register Rindex);
179 void store_local_double(FloatRegister Rvalue, Register Rindex);
180
181 // Call VM for std frames
182 // Special call VM versions that check for exceptions and forward exception
183 // via short cut (not via expensive forward exception stub).
184 void check_and_forward_exception(Register Rscratch1, Register Rscratch2);
185 void call_VM(Register oop_result, address entry_point, bool check_exceptions = true);
186 void call_VM(Register oop_result, address entry_point, Register arg_1, bool check_exceptions = true);
187 void call_VM(Register oop_result, address entry_point, Register arg_1, Register arg_2, bool check_exceptions = true);
188 void call_VM(Register oop_result, address entry_point, Register arg_1, Register arg_2, Register arg_3, bool check_exceptions = true);
189 // Should not be used:
190 void call_VM(Register oop_result, Register last_java_sp, address entry_point, bool check_exceptions = true) {ShouldNotReachHere();}
191 void call_VM(Register oop_result, Register last_java_sp, address entry_point, Register arg_1, bool check_exceptions = true) {ShouldNotReachHere();}
192 void call_VM(Register oop_result, Register last_java_sp, address entry_point, Register arg_1, Register arg_2, bool check_exceptions = true) {ShouldNotReachHere();}
193 void call_VM(Register oop_result, Register last_java_sp, address entry_point, Register arg_1, Register arg_2, Register arg_3, bool check_exceptions = true) {ShouldNotReachHere();}
194
195 Address first_local_in_stack();
196
197 enum LoadOrStore { load, store };
198 void static_iload_or_store(int which_local, LoadOrStore direction, Register Rtmp);
199 void static_aload_or_store(int which_local, LoadOrStore direction, Register Rtmp);
200 void static_dload_or_store(int which_local, LoadOrStore direction);
201
202 void save_interpreter_state(Register scratch);
203 void restore_interpreter_state(Register scratch, bool bcp_and_mdx_only = false, bool restore_top_frame_sp = false);
204
205 void increment_backedge_counter(const Register Rcounters, Register Rtmp, Register Rtmp2, Register Rscratch);
|
32 // This file specializes the assembler with interpreter-specific macros.
33
34
35 class InterpreterMacroAssembler: public MacroAssembler {
36
37 public:
38 InterpreterMacroAssembler(CodeBuffer* code) : MacroAssembler(code) {}
39
40 void null_check_throw(Register a, int offset, Register temp_reg);
41 void load_klass_check_null_throw(Register dst, Register src, Register temp_reg);
42
43 void jump_to_entry(address entry, Register Rscratch);
44
45 // Handy address generation macros.
46 #define thread_(field_name) in_bytes(JavaThread::field_name ## _offset()), R16_thread
47 #define method_(field_name) in_bytes(Method::field_name ## _offset()), R19_method
48
49 virtual void check_and_handle_popframe(Register scratch_reg);
50 virtual void check_and_handle_earlyret(Register scratch_reg);
51
52 void call_VM_preemptable(Register oop_result, address entry_point, Register arg_1, bool check_exceptions = true);
53 void restore_after_resume(Register fp);
54 // R22 and R31 are preserved when a vthread gets preempted in the interpreter.
55 // The interpreter already assumes that these registers are nonvolatile across native calls.
56 bool nonvolatile_accross_vthread_preemtion(Register r) const {
57 return r->is_nonvolatile() && ((r == R22) || (r == R31));
58 }
59
60 // Base routine for all dispatches.
61 void dispatch_base(TosState state, address* table);
62
63 void load_earlyret_value(TosState state, Register Rscratch1);
64
65 static const Address l_tmp;
66 static const Address d_tmp;
67
68 // dispatch routines
69 void dispatch_next(TosState state, int step = 0, bool generate_poll = false);
70 void dispatch_via (TosState state, address* table);
71 void load_dispatch_table(Register dst, address* table);
72 void dispatch_Lbyte_code(TosState state, Register bytecode, address* table, bool generate_poll = false);
73
74 // Called by shared interpreter generator.
75 void dispatch_prolog(TosState state, int step = 0);
76 void dispatch_epilog(TosState state, int step = 0);
77
78 // Super call_VM calls - correspond to MacroAssembler::call_VM(_leaf) calls.
79 void super_call_VM_leaf(Register thread_cache, address entry_point, Register arg_1);
173 void merge_frames(Register Rtop_frame_sp, Register return_pc, Register Rscratch1, Register Rscratch2); // merge top frames
174
175 void add_monitor_to_stack(bool stack_is_empty, Register Rtemp1, Register Rtemp2);
176
177 // Local variable access helpers
178 void load_local_int(Register Rdst_value, Register Rdst_address, Register Rindex);
179 void load_local_long(Register Rdst_value, Register Rdst_address, Register Rindex);
180 void load_local_ptr(Register Rdst_value, Register Rdst_address, Register Rindex);
181 void load_local_float(FloatRegister Rdst_value, Register Rdst_address, Register Rindex);
182 void load_local_double(FloatRegister Rdst_value, Register Rdst_address, Register Rindex);
183 void store_local_int(Register Rvalue, Register Rindex);
184 void store_local_long(Register Rvalue, Register Rindex);
185 void store_local_ptr(Register Rvalue, Register Rindex);
186 void store_local_float(FloatRegister Rvalue, Register Rindex);
187 void store_local_double(FloatRegister Rvalue, Register Rindex);
188
189 // Call VM for std frames
190 // Special call VM versions that check for exceptions and forward exception
191 // via short cut (not via expensive forward exception stub).
192 void check_and_forward_exception(Register Rscratch1, Register Rscratch2);
193 void call_VM(Register oop_result, address entry_point, bool check_exceptions = true, Label* last_java_pc = nullptr);
194 void call_VM(Register oop_result, address entry_point, Register arg_1, bool check_exceptions = true);
195 void call_VM(Register oop_result, address entry_point, Register arg_1, Register arg_2, bool check_exceptions = true);
196 void call_VM(Register oop_result, address entry_point, Register arg_1, Register arg_2, Register arg_3, bool check_exceptions = true);
197 // Should not be used:
198 void call_VM(Register oop_result, Register last_java_sp, address entry_point, bool check_exceptions = true) {ShouldNotReachHere();}
199 void call_VM(Register oop_result, Register last_java_sp, address entry_point, Register arg_1, bool check_exceptions = true) {ShouldNotReachHere();}
200 void call_VM(Register oop_result, Register last_java_sp, address entry_point, Register arg_1, Register arg_2, bool check_exceptions = true) {ShouldNotReachHere();}
201 void call_VM(Register oop_result, Register last_java_sp, address entry_point, Register arg_1, Register arg_2, Register arg_3, bool check_exceptions = true) {ShouldNotReachHere();}
202
203 Address first_local_in_stack();
204
205 enum LoadOrStore { load, store };
206 void static_iload_or_store(int which_local, LoadOrStore direction, Register Rtmp);
207 void static_aload_or_store(int which_local, LoadOrStore direction, Register Rtmp);
208 void static_dload_or_store(int which_local, LoadOrStore direction);
209
210 void save_interpreter_state(Register scratch);
211 void restore_interpreter_state(Register scratch, bool bcp_and_mdx_only = false, bool restore_top_frame_sp = false);
212
213 void increment_backedge_counter(const Register Rcounters, Register Rtmp, Register Rtmp2, Register Rscratch);
|