diff -r a09af8ef8e5c -r 4bb58f644e4e src/hotspot/share/c1/c1_LIRGenerator.hpp --- a/src/hotspot/share/c1/c1_LIRGenerator.hpp Thu Apr 26 12:48:35 2018 -0700 +++ b/src/hotspot/share/c1/c1_LIRGenerator.hpp Thu Apr 26 20:42:43 2018 +0200 @@ -25,12 +25,16 @@ #ifndef SHARE_VM_C1_C1_LIRGENERATOR_HPP #define SHARE_VM_C1_C1_LIRGENERATOR_HPP +#include "c1/c1_Decorators.hpp" #include "c1/c1_Instruction.hpp" #include "c1/c1_LIR.hpp" #include "ci/ciMethodData.hpp" +#include "gc/shared/barrierSet.hpp" #include "utilities/macros.hpp" #include "utilities/sizes.hpp" +class BarrierSetC1; + // The classes responsible for code emission and register allocation @@ -165,7 +169,6 @@ Values _instruction_for_operand; BitMap2D _vreg_flags; // flags which can be set on a per-vreg basis LIR_List* _lir; - BarrierSet* _bs; LIRGenerator* gen() { return this; @@ -173,6 +176,7 @@ void print_if_not_loaded(const NewInstance* new_instance) PRODUCT_RETURN; + public: #ifdef ASSERT LIR_List* lir(const char * file, int line) const { _lir->set_file_and_line(file, line); @@ -183,6 +187,7 @@ return _lir; } + private: // a simple cache of constants used within a block GrowableArray _constants; LIR_OprList _reg_for_constants; @@ -190,6 +195,7 @@ friend class PhiResolver; + public: // unified bailout support void bailout(const char* msg) const { compilation()->bailout(msg); } bool bailed_out() const { return compilation()->bailed_out(); } @@ -233,14 +239,15 @@ void move_to_phi(PhiResolver* resolver, Value cur_val, Value sux_val); void move_to_phi(ValueStack* cur_state); - // code emission - void do_ArithmeticOp_Long (ArithmeticOp* x); - void do_ArithmeticOp_Int (ArithmeticOp* x); - void do_ArithmeticOp_FPU (ArithmeticOp* x); - // platform dependent LIR_Opr getThreadPointer(); + private: + // code emission + void do_ArithmeticOp_Long(ArithmeticOp* x); + void do_ArithmeticOp_Int (ArithmeticOp* x); + void do_ArithmeticOp_FPU (ArithmeticOp* x); + void do_RegisterFinalizer(Intrinsic* x); void do_isInstance(Intrinsic* x); void do_isPrimitive(Intrinsic* x); @@ -258,6 +265,7 @@ void do_update_CRC32C(Intrinsic* x); void do_vectorizedMismatch(Intrinsic* x); + public: LIR_Opr call_runtime(BasicTypeArray* signature, LIRItemList* args, address entry, ValueType* result_type, CodeEmitInfo* info); LIR_Opr call_runtime(BasicTypeArray* signature, LIR_OprList* args, address entry, ValueType* result_type, CodeEmitInfo* info); @@ -265,27 +273,37 @@ LIR_Opr call_runtime(Value arg1, address entry, ValueType* result_type, CodeEmitInfo* info); LIR_Opr call_runtime(Value arg1, Value arg2, address entry, ValueType* result_type, CodeEmitInfo* info); - // GC Barriers + // Access API + + private: + BarrierSetC1 *_barrier_set; + + public: + void access_store_at(DecoratorSet decorators, BasicType type, + LIRItem& base, LIR_Opr offset, LIR_Opr value, + CodeEmitInfo* patch_info = NULL, CodeEmitInfo* store_emit_info = NULL); + + void access_load_at(DecoratorSet decorators, BasicType type, + LIRItem& base, LIR_Opr offset, LIR_Opr result, + CodeEmitInfo* patch_info = NULL, CodeEmitInfo* load_emit_info = NULL); - // generic interface + LIR_Opr access_atomic_cmpxchg_at(DecoratorSet decorators, BasicType type, + LIRItem& base, LIRItem& offset, LIRItem& cmp_value, LIRItem& new_value); + + LIR_Opr access_atomic_xchg_at(DecoratorSet decorators, BasicType type, + LIRItem& base, LIRItem& offset, LIRItem& value); - void pre_barrier(LIR_Opr addr_opr, LIR_Opr pre_val, bool do_load, bool patch, CodeEmitInfo* info); - void post_barrier(LIR_OprDesc* addr, LIR_OprDesc* new_val); + LIR_Opr access_atomic_add_at(DecoratorSet decorators, BasicType type, + LIRItem& base, LIRItem& offset, LIRItem& value); + + // These need to guarantee JMM volatile semantics are preserved on each platform + // and requires one implementation per architecture. + LIR_Opr atomic_cmpxchg(BasicType type, LIR_Opr addr, LIRItem& cmp_value, LIRItem& new_value); + LIR_Opr atomic_xchg(BasicType type, LIR_Opr addr, LIRItem& new_value); + LIR_Opr atomic_add(BasicType type, LIR_Opr addr, LIRItem& new_value); // specific implementations - // pre barriers - - void G1BarrierSet_pre_barrier(LIR_Opr addr_opr, LIR_Opr pre_val, - bool do_load, bool patch, CodeEmitInfo* info); - - // post barriers - - void G1BarrierSet_post_barrier(LIR_OprDesc* addr, LIR_OprDesc* new_val); - void CardTableBarrierSet_post_barrier(LIR_OprDesc* addr, LIR_OprDesc* new_val); -#ifdef CARDTABLEBARRIERSET_POST_BARRIER_HELPER - void CardTableBarrierSet_post_barrier_helper(LIR_OprDesc* addr, LIR_Const* card_table_base); -#endif - + void array_store_check(LIR_Opr value, LIR_Opr array, CodeEmitInfo* store_check_info, ciMethod* profiled_method, int profiled_bci); static LIR_Opr result_register_for(ValueType* type, bool callee = false); @@ -354,7 +372,7 @@ LIR_Address* generate_address(LIR_Opr base, int disp, BasicType type) { return generate_address(base, LIR_OprFact::illegalOpr, 0, disp, type); } - LIR_Address* emit_array_address(LIR_Opr array_opr, LIR_Opr index_opr, BasicType type, bool needs_card_mark); + LIR_Address* emit_array_address(LIR_Opr array_opr, LIR_Opr index_opr, BasicType type); // the helper for generate_address void add_large_constant(LIR_Opr src, int c, LIR_Opr dest); @@ -433,8 +451,6 @@ void do_soft_float_compare(If *x); #endif // __SOFTFP__ - void init(); - SwitchRangeArray* create_lookup_ranges(TableSwitch* x); SwitchRangeArray* create_lookup_ranges(LookupSwitch* x); void do_SwitchRanges(SwitchRangeArray* x, LIR_Opr value, BlockBegin* default_sux); @@ -452,6 +468,7 @@ void profile_arguments(ProfileCall* x); void profile_parameters(Base* x); void profile_parameters_at_call(ProfileCall* x); + LIR_Opr mask_boolean(LIR_Opr array, LIR_Opr value, CodeEmitInfo*& null_check_info); LIR_Opr maybe_mask_boolean(StoreIndexed* x, LIR_Opr array, LIR_Opr value, CodeEmitInfo*& null_check_info); public: @@ -478,8 +495,8 @@ : _compilation(compilation) , _method(method) , _virtual_register_number(LIR_OprDesc::vreg_base) - , _vreg_flags(num_vreg_flags) { - init(); + , _vreg_flags(num_vreg_flags) + , _barrier_set(BarrierSet::barrier_set()->barrier_set_c1()) { } // for virtual registers, maps them back to Phi's or Local's