Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/src/cpu/ppc/vm/interp_masm_ppc_64.hpp
32285 views
/*1* Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.2* Copyright 2012, 2014 SAP AG. All rights reserved.3* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.4*5* This code is free software; you can redistribute it and/or modify it6* under the terms of the GNU General Public License version 2 only, as7* published by the Free Software Foundation.8*9* This code is distributed in the hope that it will be useful, but WITHOUT10* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or11* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License12* version 2 for more details (a copy is included in the LICENSE file that13* accompanied this code).14*15* You should have received a copy of the GNU General Public License version16* 2 along with this work; if not, write to the Free Software Foundation,17* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.18*19* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA20* or visit www.oracle.com if you need additional information or have any21* questions.22*23*/2425#ifndef CPU_PPC_VM_INTERP_MASM_PPC_64_HPP26#define CPU_PPC_VM_INTERP_MASM_PPC_64_HPP2728#include "asm/macroAssembler.hpp"29#include "interpreter/invocationCounter.hpp"3031// This file specializes the assembler with interpreter-specific macros.323334class InterpreterMacroAssembler: public MacroAssembler {3536public:37InterpreterMacroAssembler(CodeBuffer* code) : MacroAssembler(code) {}3839void null_check_throw(Register a, int offset, Register temp_reg);4041void branch_to_entry(address entry, Register Rscratch);4243// Handy address generation macros.44#define thread_(field_name) in_bytes(JavaThread::field_name ## _offset()), R16_thread45#define method_(field_name) in_bytes(Method::field_name ## _offset()), R19_method4647#ifdef CC_INTERP48#define state_(field_name) in_bytes(byte_offset_of(BytecodeInterpreter, field_name)), R14_state49#define prev_state_(field_name) in_bytes(byte_offset_of(BytecodeInterpreter, field_name)), R15_prev_state50void pop (TosState state) {}; // Not needed.51void push(TosState state) {}; // Not needed.52#endif5354#ifndef CC_INTERP55virtual void check_and_handle_popframe(Register java_thread);56virtual void check_and_handle_earlyret(Register java_thread);5758// Base routine for all dispatches.59void dispatch_base(TosState state, address* table);6061void load_earlyret_value(TosState state, Register Rscratch1);6263static const Address l_tmp;64static const Address d_tmp;6566// dispatch routines67void dispatch_next(TosState state, int step = 0);68void dispatch_via (TosState state, address* table);69void load_dispatch_table(Register dst, address* table);70void dispatch_Lbyte_code(TosState state, Register bytecode, address* table, bool verify = false);7172// Called by shared interpreter generator.73void dispatch_prolog(TosState state, int step = 0);74void dispatch_epilog(TosState state, int step = 0);7576// Super call_VM calls - correspond to MacroAssembler::call_VM(_leaf) calls.77void super_call_VM_leaf(Register thread_cache, address entry_point, Register arg_1);78void super_call_VM(Register thread_cache, Register oop_result, Register last_java_sp,79address entry_point, Register arg_1, Register arg_2, bool check_exception = true);8081// Generate a subtype check: branch to ok_is_subtype if sub_klass is82// a subtype of super_klass. Blows registers tmp1, tmp2 and tmp3.83void gen_subtype_check(Register sub_klass, Register super_klass,84Register tmp1, Register tmp2, Register tmp3, Label &ok_is_subtype);8586// Load object from cpool->resolved_references(index).87void load_resolved_reference_at_index(Register result, Register index);8889void generate_stack_overflow_check_with_compare_and_throw(Register Rmem_frame_size, Register Rscratch1);90void load_receiver(Register Rparam_count, Register Rrecv_dst);9192// helpers for expression stack93void pop_i( Register r = R17_tos);94void pop_ptr( Register r = R17_tos);95void pop_l( Register r = R17_tos);96void pop_f(FloatRegister f = F15_ftos);97void pop_d(FloatRegister f = F15_ftos );9899void push_i( Register r = R17_tos);100void push_ptr( Register r = R17_tos);101void push_l( Register r = R17_tos);102void push_f(FloatRegister f = F15_ftos );103void push_d(FloatRegister f = F15_ftos);104105void push_2ptrs(Register first, Register second);106107void push_l_pop_d(Register l = R17_tos, FloatRegister d = F15_ftos);108void push_d_pop_l(FloatRegister d = F15_ftos, Register l = R17_tos);109110void pop (TosState state); // transition vtos -> state111void push(TosState state); // transition state -> vtos112void empty_expression_stack(); // Resets both Lesp and SP.113114public:115// Load values from bytecode stream:116117enum signedOrNot { Signed, Unsigned };118enum setCCOrNot { set_CC, dont_set_CC };119120void get_2_byte_integer_at_bcp(int bcp_offset,121Register Rdst,122signedOrNot is_signed);123124void get_4_byte_integer_at_bcp(int bcp_offset,125Register Rdst,126signedOrNot is_signed = Unsigned);127128void get_cache_index_at_bcp(Register Rdst, int bcp_offset, size_t index_size);129130void get_cache_and_index_at_bcp(Register cache, int bcp_offset, size_t index_size = sizeof(u2));131132void get_u4(Register Rdst, Register Rsrc, int offset, signedOrNot is_signed);133134// common code135136void field_offset_at(int n, Register tmp, Register dest, Register base);137int field_offset_at(Register object, address bcp, int offset);138void fast_iaaccess(int n, address bcp);139void fast_iagetfield(address bcp);140void fast_iaputfield(address bcp, bool do_store_check);141142void index_check(Register array, Register index, int index_shift, Register tmp, Register res);143void index_check_without_pop(Register array, Register index, int index_shift, Register tmp, Register res);144145void get_const(Register Rdst);146void get_constant_pool(Register Rdst);147void get_constant_pool_cache(Register Rdst);148void get_cpool_and_tags(Register Rcpool, Register Rtags);149void is_a(Label& L);150151void narrow(Register result);152153// Java Call Helpers154void call_from_interpreter(Register Rtarget_method, Register Rret_addr, Register Rscratch1, Register Rscratch2);155156// --------------------------------------------------157158void unlock_if_synchronized_method(TosState state, bool throw_monitor_exception = true,159bool install_monitor_exception = true);160161// Removes the current activation (incl. unlocking of monitors).162// Additionally this code is used for earlyReturn in which case we163// want to skip throwing an exception and installing an exception.164void remove_activation(TosState state,165bool throw_monitor_exception = true,166bool install_monitor_exception = true);167void merge_frames(Register Rtop_frame_sp, Register return_pc, Register Rscratch1, Register Rscratch2); // merge top frames168169void add_monitor_to_stack(bool stack_is_empty, Register Rtemp1, Register Rtemp2);170171// Local variable access helpers172void load_local_int(Register Rdst_value, Register Rdst_address, Register Rindex);173void load_local_long(Register Rdst_value, Register Rdst_address, Register Rindex);174void load_local_ptr(Register Rdst_value, Register Rdst_address, Register Rindex);175void load_local_float(FloatRegister Rdst_value, Register Rdst_address, Register Rindex);176void load_local_double(FloatRegister Rdst_value, Register Rdst_address, Register Rindex);177void store_local_int(Register Rvalue, Register Rindex);178void store_local_long(Register Rvalue, Register Rindex);179void store_local_ptr(Register Rvalue, Register Rindex);180void store_local_float(FloatRegister Rvalue, Register Rindex);181void store_local_double(FloatRegister Rvalue, Register Rindex);182183// Call VM for std frames184// Special call VM versions that check for exceptions and forward exception185// via short cut (not via expensive forward exception stub).186void check_and_forward_exception(Register Rscratch1, Register Rscratch2);187void call_VM(Register oop_result, address entry_point, bool check_exceptions = true);188void call_VM(Register oop_result, address entry_point, Register arg_1, bool check_exceptions = true);189void call_VM(Register oop_result, address entry_point, Register arg_1, Register arg_2, bool check_exceptions = true);190void call_VM(Register oop_result, address entry_point, Register arg_1, Register arg_2, Register arg_3, bool check_exceptions = true);191// Should not be used:192void call_VM(Register oop_result, Register last_java_sp, address entry_point, bool check_exceptions = true) {ShouldNotReachHere();}193void call_VM(Register oop_result, Register last_java_sp, address entry_point, Register arg_1, bool check_exceptions = true) {ShouldNotReachHere();}194void call_VM(Register oop_result, Register last_java_sp, address entry_point, Register arg_1, Register arg_2, bool check_exceptions = true) {ShouldNotReachHere();}195void 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();}196197Address first_local_in_stack();198199enum LoadOrStore { load, store };200void static_iload_or_store(int which_local, LoadOrStore direction, Register Rtmp);201void static_aload_or_store(int which_local, LoadOrStore direction, Register Rtmp);202void static_dload_or_store(int which_local, LoadOrStore direction);203204void save_interpreter_state(Register scratch);205void restore_interpreter_state(Register scratch, bool bcp_and_mdx_only = false);206207void increment_backedge_counter(const Register Rcounters, Register Rtmp, Register Rtmp2, Register Rscratch);208void test_backedge_count_for_osr(Register backedge_count, Register branch_bcp, Register Rtmp);209210void record_static_call_in_profile(Register Rentry, Register Rtmp);211void record_receiver_call_in_profile(Register Rklass, Register Rentry, Register Rtmp);212#endif // !CC_INTERP213214void get_method_counters(Register method, Register Rcounters, Label& skip);215void increment_invocation_counter(Register iv_be_count, Register Rtmp1, Register Rtmp2_r0);216217// Object locking218void lock_object (Register lock_reg, Register obj_reg);219void unlock_object(Register lock_reg, bool check_for_exceptions = true);220221#ifndef CC_INTERP222223// Interpreter profiling operations224void set_method_data_pointer_for_bcp();225void test_method_data_pointer(Label& zero_continue);226void verify_method_data_pointer();227void test_invocation_counter_for_mdp(Register invocation_count, Register Rscratch, Label &profile_continue);228229void set_mdp_data_at(int constant, Register value);230231void increment_mdp_data_at(int constant, Register counter_addr, Register Rbumped_count, bool decrement = false);232233void increment_mdp_data_at(Register counter_addr, Register Rbumped_count, bool decrement = false);234void increment_mdp_data_at(Register reg, int constant, Register scratch, Register Rbumped_count, bool decrement = false);235236void set_mdp_flag_at(int flag_constant, Register scratch);237void test_mdp_data_at(int offset, Register value, Label& not_equal_continue, Register test_out);238239void update_mdp_by_offset(int offset_of_disp, Register scratch);240void update_mdp_by_offset(Register reg, int offset_of_disp,241Register scratch);242void update_mdp_by_constant(int constant);243void update_mdp_for_ret(TosState state, Register return_bci);244245void profile_taken_branch(Register scratch, Register bumped_count);246void profile_not_taken_branch(Register scratch1, Register scratch2);247void profile_call(Register scratch1, Register scratch2);248void profile_final_call(Register scratch1, Register scratch2);249void profile_virtual_call(Register Rreceiver, Register Rscratch1, Register Rscratch2, bool receiver_can_be_null);250void profile_typecheck(Register Rklass, Register Rscratch1, Register Rscratch2);251void profile_typecheck_failed(Register Rscratch1, Register Rscratch2);252void profile_ret(TosState state, Register return_bci, Register scratch1, Register scratch2);253void profile_switch_default(Register scratch1, Register scratch2);254void profile_switch_case(Register index, Register scratch1,Register scratch2, Register scratch3);255void profile_null_seen(Register Rscratch1, Register Rscratch2);256void record_klass_in_profile(Register receiver, Register scratch1, Register scratch2, bool is_virtual_call);257void record_klass_in_profile_helper(Register receiver, Register scratch1, Register scratch2, int start_row, Label& done, bool is_virtual_call);258259// Argument and return type profiling.260void profile_obj_type(Register obj, Register mdo_addr_base, RegisterOrConstant mdo_addr_offs, Register tmp, Register tmp2);261void profile_arguments_type(Register callee, Register tmp1, Register tmp2, bool is_virtual);262void profile_return_type(Register ret, Register tmp1, Register tmp2);263void profile_parameters_type(Register tmp1, Register tmp2, Register tmp3, Register tmp4);264265#endif // !CC_INTERP266267// Debugging268void verify_oop(Register reg, TosState state = atos); // only if +VerifyOops && state == atos269#ifndef CC_INTERP270void verify_oop_or_return_address(Register reg, Register rtmp); // for astore271void verify_FPU(int stack_depth, TosState state = ftos);272#endif // !CC_INTERP273274typedef enum { NotifyJVMTI, SkipNotifyJVMTI } NotifyMethodExitMode;275276// Support for jvmdi/jvmpi.277void notify_method_entry();278void notify_method_exit(bool is_native_method, TosState state,279NotifyMethodExitMode mode, bool check_exceptions);280281#ifdef CC_INTERP282// Convert the current TOP_IJAVA_FRAME into a PARENT_IJAVA_FRAME283// (using parent_frame_resize) and push a new interpreter284// TOP_IJAVA_FRAME (using frame_size).285void push_interpreter_frame(Register top_frame_size, Register parent_frame_resize,286Register tmp1, Register tmp2, Register tmp3, Register tmp4, Register pc=noreg);287288// Pop the topmost TOP_IJAVA_FRAME and convert the previous289// PARENT_IJAVA_FRAME back into a TOP_IJAVA_FRAME.290void pop_interpreter_frame(Register tmp1, Register tmp2, Register tmp3, Register tmp4);291292// Turn state's interpreter frame into the current TOP_IJAVA_FRAME.293void pop_interpreter_frame_to_state(Register state, Register tmp1, Register tmp2, Register tmp3);294295// Set SP to initial caller's sp, but before fix the back chain.296void resize_frame_to_initial_caller(Register tmp1, Register tmp2);297298// Pop the current interpreter state (without popping the299// correspoding frame) and restore R14_state and R15_prev_state300// accordingly. Use prev_state_may_be_0 to indicate whether301// prev_state may be 0 in order to generate an extra check before302// retrieving prev_state_(_prev_link).303void pop_interpreter_state(bool prev_state_may_be_0);304305void restore_prev_state();306#endif307};308309#endif // CPU_PPC_VM_INTERP_MASM_PPC_64_HPP310311312