diff --git a/src/hotspot/share/c1/c1_LIRGenerator.hpp b/src/hotspot/share/c1/c1_LIRGenerator.hpp index 22d1235..25bbff2 100644 --- a/src/hotspot/share/c1/c1_LIRGenerator.hpp +++ b/src/hotspot/share/c1/c1_LIRGenerator.hpp @@ -25,6 +25,8 @@ #ifndef SHARE_VM_C1_C1_LIRGENERATOR_HPP #define SHARE_VM_C1_C1_LIRGENERATOR_HPP +#include "gc/shared/c1/barrierSetC1.hpp" +#include "c1/c1_Decorators.hpp" #include "c1/c1_Instruction.hpp" #include "c1/c1_LIR.hpp" #include "ci/ciMethodData.hpp" @@ -150,6 +152,10 @@ class PhiResolver: public CompilationResourceObj { // only the classes below belong in the same file class LIRGenerator: public InstructionVisitor, public BlockClosure { + friend class BarrierSetC1; + friend class ModRefBarrierSetC1; + friend class CardTableBarrierSetC1; + friend class G1BarrierSetC1; // LIRGenerator should never get instatiated on the heap. private: void* operator new(size_t size) throw(); @@ -165,7 +171,6 @@ class LIRGenerator: public InstructionVisitor, public BlockClosure { 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; @@ -269,23 +274,31 @@ class LIRGenerator: public InstructionVisitor, public BlockClosure { // generic interface - 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); + void access_store_at(DecoratorSet decorators, BasicType type, + LIRItem& base, LIR_Opr offset, LIR_Opr value, + CodeEmitInfo* patch_info, CodeEmitInfo* store_emit_info); - // specific implementations - // pre barriers + void access_load_at(DecoratorSet decorators, BasicType type, + LIRItem& base, LIR_Opr offset, LIR_Opr result, + CodeEmitInfo* patch_info, CodeEmitInfo* load_emit_info); - void G1BarrierSet_pre_barrier(LIR_Opr addr_opr, LIR_Opr pre_val, - bool do_load, bool patch, CodeEmitInfo* info); + LIR_Opr access_atomic_cmpxchg_at(DecoratorSet decorators, BasicType type, + LIRItem& base, LIRItem& offset, LIRItem& cmp_value, LIRItem& new_value); - // post barriers + LIR_Opr access_atomic_xchg_at(DecoratorSet decorators, BasicType type, + LIRItem& base, LIRItem& offset, LIRItem& value); - 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 + 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 + 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 +367,7 @@ class LIRGenerator: public InstructionVisitor, public BlockClosure { 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 +446,6 @@ class LIRGenerator: public InstructionVisitor, public BlockClosure { 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 +463,7 @@ class LIRGenerator: public InstructionVisitor, public BlockClosure { 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: @@ -479,7 +491,6 @@ class LIRGenerator: public InstructionVisitor, public BlockClosure { , _method(method) , _virtual_register_number(LIR_OprDesc::vreg_base) , _vreg_flags(num_vreg_flags) { - init(); } // for virtual registers, maps them back to Phi's or Local's