173 void pop(Register r) { ((MacroAssembler*)this)->pop(r); }
174 void push(Register r) { ((MacroAssembler*)this)->push(r); }
175 void push(int32_t imm ) { ((MacroAssembler*)this)->push(imm); }
176
177 void pop(TosState state); // transition vtos -> state
178 void push(TosState state); // transition state -> vtos
179
180 void empty_expression_stack() {
181 movptr(rsp, Address(rbp, frame::interpreter_frame_monitor_block_top_offset * wordSize));
182 // null last_sp until next java call
183 movptr(Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize), NULL_WORD);
184 NOT_LP64(empty_FPU_stack());
185 }
186
187 // Helpers for swap and dup
188 void load_ptr(int n, Register val);
189 void store_ptr(int n, Register val);
190
191 // Generate a subtype check: branch to ok_is_subtype if sub_klass is
192 // a subtype of super_klass.
193 void gen_subtype_check( Register sub_klass, Label &ok_is_subtype );
194
195 // Dispatching
196 void dispatch_prolog(TosState state, int step = 0);
197 void dispatch_epilog(TosState state, int step = 0);
198 // dispatch via rbx (assume rbx is loaded already)
199 void dispatch_only(TosState state, bool generate_poll = false);
200 // dispatch normal table via rbx (assume rbx is loaded already)
201 void dispatch_only_normal(TosState state);
202 void dispatch_only_noverify(TosState state);
203 // load rbx from [_bcp_register + step] and dispatch via rbx
204 void dispatch_next(TosState state, int step = 0, bool generate_poll = false);
205 // load rbx from [_bcp_register] and dispatch via rbx and table
206 void dispatch_via (TosState state, address* table);
207
208 // jump to an invoked target
209 void prepare_to_jump_from_interpreted();
210 void jump_from_interpreted(Register method, Register temp);
211
212 // narrow int return value
213 void narrow(Register result);
214
215 // Returning from interpreted functions
216 //
217 // Removes the current activation (incl. unlocking of monitors)
218 // and sets up the return address. This code is also used for
219 // exception unwindwing. In that case, we do not want to throw
220 // IllegalMonitorStateExceptions, since that might get us into an
221 // infinite rethrow exception loop.
222 // Additionally this code is used for popFrame and earlyReturn.
223 // In popFrame case we want to skip throwing an exception,
224 // installing an exception, and notifying jvmdi.
225 // In earlyReturn case we only want to skip throwing an exception
226 // and installing an exception.
227 void remove_activation(TosState state, Register ret_addr,
228 bool throw_monitor_exception = true,
229 bool install_monitor_exception = true,
230 bool notify_jvmdi = true);
231 void get_method_counters(Register method, Register mcs, Label& skip);
232
233 // Object locking
234 void lock_object (Register lock_reg);
235 void unlock_object(Register lock_reg);
236
237 // Interpreter profiling operations
238 void set_method_data_pointer_for_bcp();
239 void test_method_data_pointer(Register mdp, Label& zero_continue);
240 void verify_method_data_pointer();
241
242 void set_mdp_data_at(Register mdp_in, int constant, Register value);
243 void increment_mdp_data_at(Address data, bool decrement = false);
244 void increment_mdp_data_at(Register mdp_in, int constant,
245 bool decrement = false);
246 void increment_mdp_data_at(Register mdp_in, Register reg, int constant,
247 bool decrement = false);
248 void increment_mask_and_jump(Address counter_addr, Address mask,
249 Register scratch, Label* where);
250 void set_mdp_flag_at(Register mdp_in, int flag_constant);
251 void test_mdp_data_at(Register mdp_in, int offset, Register value,
252 Register test_value_out,
253 Label& not_equal_continue);
254
255 void record_klass_in_profile(Register receiver, Register mdp,
256 Register reg2, bool is_virtual_call);
257 void record_klass_in_profile_helper(Register receiver, Register mdp,
258 Register reg2, int start_row,
259 Label& done, bool is_virtual_call);
260 void record_item_in_profile_helper(Register item, Register mdp,
261 Register reg2, int start_row, Label& done, int total_rows,
262 OffsetFunction item_offset_fn, OffsetFunction item_count_offset_fn,
263 int non_profiled_offset);
264
265 void update_mdp_by_offset(Register mdp_in, int offset_of_offset);
266 void update_mdp_by_offset(Register mdp_in, Register reg, int offset_of_disp);
267 void update_mdp_by_constant(Register mdp_in, int constant);
268 void update_mdp_for_ret(Register return_bci);
269
270 void profile_taken_branch(Register mdp, Register bumped_count);
271 void profile_not_taken_branch(Register mdp);
272 void profile_call(Register mdp);
273 void profile_final_call(Register mdp);
274 void profile_virtual_call(Register receiver, Register mdp,
275 Register scratch2,
276 bool receiver_can_be_null = false);
277 void profile_ret(Register return_bci, Register mdp);
278 void profile_null_seen(Register mdp);
279 void profile_typecheck(Register mdp, Register klass, Register scratch);
280 void profile_typecheck_failed(Register mdp);
281 void profile_switch_default(Register mdp);
282 void profile_switch_case(Register index_in_scratch, Register mdp,
283 Register scratch2);
284
285 // Debugging
286 // only if +VerifyOops && state == atos
287 #define interp_verify_oop(reg, state) _interp_verify_oop(reg, state, __FILE__, __LINE__);
288 void _interp_verify_oop(Register reg, TosState state, const char* file, int line);
289 // only if +VerifyFPU && (state == ftos || state == dtos)
290 void verify_FPU(int stack_depth, TosState state = ftos);
291
292 typedef enum { NotifyJVMTI, SkipNotifyJVMTI } NotifyMethodExitMode;
293
294 // support for jvmti/dtrace
295 void notify_method_entry();
296 void notify_method_exit(TosState state, NotifyMethodExitMode mode);
297
298 private:
299
300 Register _locals_register; // register that contains the pointer to the locals
301 Register _bcp_register; // register that contains the bcp
302
303 public:
|
173 void pop(Register r) { ((MacroAssembler*)this)->pop(r); }
174 void push(Register r) { ((MacroAssembler*)this)->push(r); }
175 void push(int32_t imm ) { ((MacroAssembler*)this)->push(imm); }
176
177 void pop(TosState state); // transition vtos -> state
178 void push(TosState state); // transition state -> vtos
179
180 void empty_expression_stack() {
181 movptr(rsp, Address(rbp, frame::interpreter_frame_monitor_block_top_offset * wordSize));
182 // null last_sp until next java call
183 movptr(Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize), NULL_WORD);
184 NOT_LP64(empty_FPU_stack());
185 }
186
187 // Helpers for swap and dup
188 void load_ptr(int n, Register val);
189 void store_ptr(int n, Register val);
190
191 // Generate a subtype check: branch to ok_is_subtype if sub_klass is
192 // a subtype of super_klass.
193 void gen_subtype_check(Register sub_klass, Label &ok_is_subtype, bool profile = true);
194
195 // Dispatching
196 void dispatch_prolog(TosState state, int step = 0);
197 void dispatch_epilog(TosState state, int step = 0);
198 // dispatch via rbx (assume rbx is loaded already)
199 void dispatch_only(TosState state, bool generate_poll = false);
200 // dispatch normal table via rbx (assume rbx is loaded already)
201 void dispatch_only_normal(TosState state);
202 void dispatch_only_noverify(TosState state);
203 // load rbx from [_bcp_register + step] and dispatch via rbx
204 void dispatch_next(TosState state, int step = 0, bool generate_poll = false);
205 // load rbx from [_bcp_register] and dispatch via rbx and table
206 void dispatch_via (TosState state, address* table);
207
208 // jump to an invoked target
209 void prepare_to_jump_from_interpreted();
210 void jump_from_interpreted(Register method, Register temp);
211
212 // narrow int return value
213 void narrow(Register result);
214
215 // Returning from interpreted functions
216 //
217 // Removes the current activation (incl. unlocking of monitors)
218 // and sets up the return address. This code is also used for
219 // exception unwindwing. In that case, we do not want to throw
220 // IllegalMonitorStateExceptions, since that might get us into an
221 // infinite rethrow exception loop.
222 // Additionally this code is used for popFrame and earlyReturn.
223 // In popFrame case we want to skip throwing an exception,
224 // installing an exception, and notifying jvmdi.
225 // In earlyReturn case we only want to skip throwing an exception
226 // and installing an exception.
227 void remove_activation(TosState state, Register ret_addr,
228 bool throw_monitor_exception = true,
229 bool install_monitor_exception = true,
230 bool notify_jvmdi = true);
231 void get_method_counters(Register method, Register mcs, Label& skip);
232
233 // Kills t1 and t2, perserves klass, return allocation in new_obj
234 void allocate_instance(Register klass, Register new_obj,
235 Register t1, Register t2,
236 bool clear_fields, Label& alloc_failed);
237 // Allocate instance in "obj" and read in the content of the inline field
238 // NOTES:
239 // - input holder object via "obj", which must be rax,
240 // will return new instance via the same reg
241 // - assumes holder_klass and valueKlass field klass have both been resolved
242 // - 32 bits: kills rdi and rsi
243 void read_flat_field(Register holder_klass,
244 Register field_index, Register field_offset,
245 Register obj = rax);
246
247 // Allocate value buffer in "obj" and read in flat element at the given index
248 // NOTES:
249 // - Return via "obj" must be rax
250 // - kills all given regs
251 // - 32 bits: kills rdi and rsi
252 void read_flat_element(Register array, Register index,
253 Register t1, Register t2,
254 Register obj = rax);
255
256 // Object locking
257 void lock_object (Register lock_reg);
258 void unlock_object(Register lock_reg);
259
260 // Interpreter profiling operations
261 void set_method_data_pointer_for_bcp();
262 void test_method_data_pointer(Register mdp, Label& zero_continue);
263 void verify_method_data_pointer();
264
265 void set_mdp_data_at(Register mdp_in, int constant, Register value);
266 void increment_mdp_data_at(Address data, bool decrement = false);
267 void increment_mdp_data_at(Register mdp_in, int constant,
268 bool decrement = false);
269 void increment_mdp_data_at(Register mdp_in, Register reg, int constant,
270 bool decrement = false);
271 void increment_mask_and_jump(Address counter_addr, Address mask,
272 Register scratch, Label* where);
273 void set_mdp_flag_at(Register mdp_in, int flag_constant);
274 void test_mdp_data_at(Register mdp_in, int offset, Register value,
275 Register test_value_out,
276 Label& not_equal_continue);
277
278 void record_klass_in_profile(Register receiver, Register mdp,
279 Register reg2, bool is_virtual_call);
280 void record_klass_in_profile_helper(Register receiver, Register mdp,
281 Register reg2, int start_row,
282 Label& done, bool is_virtual_call);
283 void record_item_in_profile_helper(Register item, Register mdp,
284 Register reg2, int start_row, Label& done, int total_rows,
285 OffsetFunction item_offset_fn, OffsetFunction item_count_offset_fn,
286 int non_profiled_offset);
287
288 void update_mdp_by_offset(Register mdp_in, int offset_of_offset);
289 void update_mdp_by_offset(Register mdp_in, Register reg, int offset_of_disp);
290 void update_mdp_by_constant(Register mdp_in, int constant);
291 void update_mdp_for_ret(Register return_bci);
292
293 void profile_taken_branch(Register mdp, Register bumped_count);
294 void profile_not_taken_branch(Register mdp, bool acmp = false);
295 void profile_call(Register mdp);
296 void profile_final_call(Register mdp);
297 void profile_virtual_call(Register receiver, Register mdp,
298 Register scratch2,
299 bool receiver_can_be_null = false);
300 void profile_ret(Register return_bci, Register mdp);
301 void profile_null_seen(Register mdp);
302 void profile_typecheck(Register mdp, Register klass, Register scratch);
303 void profile_typecheck_failed(Register mdp);
304 void profile_switch_default(Register mdp);
305 void profile_switch_case(Register index_in_scratch, Register mdp,
306 Register scratch2);
307 void profile_array(Register mdp, Register array, Register tmp);
308 void profile_element(Register mdp, Register element, Register tmp);
309 void profile_acmp(Register mdp, Register left, Register right, Register tmp);
310
311 // Debugging
312 // only if +VerifyOops && state == atos
313 #define interp_verify_oop(reg, state) _interp_verify_oop(reg, state, __FILE__, __LINE__);
314 void _interp_verify_oop(Register reg, TosState state, const char* file, int line);
315 // only if +VerifyFPU && (state == ftos || state == dtos)
316 void verify_FPU(int stack_depth, TosState state = ftos);
317
318 typedef enum { NotifyJVMTI, SkipNotifyJVMTI } NotifyMethodExitMode;
319
320 // support for jvmti/dtrace
321 void notify_method_entry();
322 void notify_method_exit(TosState state, NotifyMethodExitMode mode);
323
324 private:
325
326 Register _locals_register; // register that contains the pointer to the locals
327 Register _bcp_register; // register that contains the bcp
328
329 public:
|