32
33 // This file specializes the assember with interpreter-specific macros
34
35 typedef ByteSize (*OffsetFunction)(uint);
36
37 class InterpreterMacroAssembler: public MacroAssembler {
38
39 protected:
40 // Interpreter specific version of call_VM_base
41 virtual void call_VM_leaf_base(address entry_point,
42 int number_of_arguments);
43
44 virtual void call_VM_base(Register oop_result,
45 Register java_thread,
46 Register last_java_sp,
47 address entry_point,
48 int number_of_arguments,
49 bool check_exceptions);
50
51 // base routine for all dispatches
52 void dispatch_base(TosState state, address* table, bool verifyoop = true);
53
54 public:
55 InterpreterMacroAssembler(CodeBuffer* code) : MacroAssembler(code),
56 _locals_register(LP64_ONLY(r14) NOT_LP64(rdi)),
57 _bcp_register(LP64_ONLY(r13) NOT_LP64(rsi)) {}
58
59 void jump_to_entry(address entry);
60
61 virtual void check_and_handle_popframe(Register java_thread);
62 virtual void check_and_handle_earlyret(Register java_thread);
63
64 void load_earlyret_value(TosState state);
65
66 // Interpreter-specific registers
67 void save_bcp() {
68 movptr(Address(rbp, frame::interpreter_frame_bcp_offset * wordSize), _bcp_register);
69 }
70
71 void restore_bcp() {
72 movptr(_bcp_register, Address(rbp, frame::interpreter_frame_bcp_offset * wordSize));
167
168 void empty_expression_stack() {
169 movptr(rsp, Address(rbp, frame::interpreter_frame_monitor_block_top_offset * wordSize));
170 // NULL last_sp until next java call
171 movptr(Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize), (int32_t)NULL_WORD);
172 NOT_LP64(empty_FPU_stack());
173 }
174
175 // Helpers for swap and dup
176 void load_ptr(int n, Register val);
177 void store_ptr(int n, Register val);
178
179 // Generate a subtype check: branch to ok_is_subtype if sub_klass is
180 // a subtype of super_klass.
181 void gen_subtype_check( Register sub_klass, Label &ok_is_subtype );
182
183 // Dispatching
184 void dispatch_prolog(TosState state, int step = 0);
185 void dispatch_epilog(TosState state, int step = 0);
186 // dispatch via rbx (assume rbx is loaded already)
187 void dispatch_only(TosState state);
188 // dispatch normal table via rbx (assume rbx is loaded already)
189 void dispatch_only_normal(TosState state);
190 void dispatch_only_noverify(TosState state);
191 // load rbx from [_bcp_register + step] and dispatch via rbx
192 void dispatch_next(TosState state, int step = 0);
193 // load rbx from [_bcp_register] and dispatch via rbx and table
194 void dispatch_via (TosState state, address* table);
195
196 // jump to an invoked target
197 void prepare_to_jump_from_interpreted();
198 void jump_from_interpreted(Register method, Register temp);
199
200 // narrow int return value
201 void narrow(Register result);
202
203 // Returning from interpreted functions
204 //
205 // Removes the current activation (incl. unlocking of monitors)
206 // and sets up the return address. This code is also used for
207 // exception unwindwing. In that case, we do not want to throw
208 // IllegalMonitorStateExceptions, since that might get us into an
209 // infinite rethrow exception loop.
210 // Additionally this code is used for popFrame and earlyReturn.
211 // In popFrame case we want to skip throwing an exception,
212 // installing an exception, and notifying jvmdi.
|
32
33 // This file specializes the assember with interpreter-specific macros
34
35 typedef ByteSize (*OffsetFunction)(uint);
36
37 class InterpreterMacroAssembler: public MacroAssembler {
38
39 protected:
40 // Interpreter specific version of call_VM_base
41 virtual void call_VM_leaf_base(address entry_point,
42 int number_of_arguments);
43
44 virtual void call_VM_base(Register oop_result,
45 Register java_thread,
46 Register last_java_sp,
47 address entry_point,
48 int number_of_arguments,
49 bool check_exceptions);
50
51 // base routine for all dispatches
52 void dispatch_base(TosState state, address* table, bool verifyoop = true, bool generate_poll = false);
53
54 public:
55 InterpreterMacroAssembler(CodeBuffer* code) : MacroAssembler(code),
56 _locals_register(LP64_ONLY(r14) NOT_LP64(rdi)),
57 _bcp_register(LP64_ONLY(r13) NOT_LP64(rsi)) {}
58
59 void jump_to_entry(address entry);
60
61 virtual void check_and_handle_popframe(Register java_thread);
62 virtual void check_and_handle_earlyret(Register java_thread);
63
64 void load_earlyret_value(TosState state);
65
66 // Interpreter-specific registers
67 void save_bcp() {
68 movptr(Address(rbp, frame::interpreter_frame_bcp_offset * wordSize), _bcp_register);
69 }
70
71 void restore_bcp() {
72 movptr(_bcp_register, Address(rbp, frame::interpreter_frame_bcp_offset * wordSize));
167
168 void empty_expression_stack() {
169 movptr(rsp, Address(rbp, frame::interpreter_frame_monitor_block_top_offset * wordSize));
170 // NULL last_sp until next java call
171 movptr(Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize), (int32_t)NULL_WORD);
172 NOT_LP64(empty_FPU_stack());
173 }
174
175 // Helpers for swap and dup
176 void load_ptr(int n, Register val);
177 void store_ptr(int n, Register val);
178
179 // Generate a subtype check: branch to ok_is_subtype if sub_klass is
180 // a subtype of super_klass.
181 void gen_subtype_check( Register sub_klass, Label &ok_is_subtype );
182
183 // Dispatching
184 void dispatch_prolog(TosState state, int step = 0);
185 void dispatch_epilog(TosState state, int step = 0);
186 // dispatch via rbx (assume rbx is loaded already)
187 void dispatch_only(TosState state, bool generate_poll = false);
188 // dispatch normal table via rbx (assume rbx is loaded already)
189 void dispatch_only_normal(TosState state);
190 void dispatch_only_noverify(TosState state);
191 // load rbx from [_bcp_register + step] and dispatch via rbx
192 void dispatch_next(TosState state, int step = 0, bool generate_poll = false);
193 // load rbx from [_bcp_register] and dispatch via rbx and table
194 void dispatch_via (TosState state, address* table);
195
196 // jump to an invoked target
197 void prepare_to_jump_from_interpreted();
198 void jump_from_interpreted(Register method, Register temp);
199
200 // narrow int return value
201 void narrow(Register result);
202
203 // Returning from interpreted functions
204 //
205 // Removes the current activation (incl. unlocking of monitors)
206 // and sets up the return address. This code is also used for
207 // exception unwindwing. In that case, we do not want to throw
208 // IllegalMonitorStateExceptions, since that might get us into an
209 // infinite rethrow exception loop.
210 // Additionally this code is used for popFrame and earlyReturn.
211 // In popFrame case we want to skip throwing an exception,
212 // installing an exception, and notifying jvmdi.
|