< prev index next >

src/hotspot/share/gc/shared/c1/barrierSetC1.hpp

Print this page

 53   LIR_Opr opr() const {
 54     if (_item == nullptr) {
 55       return _opr;
 56     } else {
 57       return _item->result();
 58     }
 59   }
 60 };
 61 
 62 // The LIRAccess class wraps shared context parameters required for performing
 63 // the right access in C1. This includes the address of the offset and the decorators.
 64 class LIRAccess: public StackObj {
 65   LIRGenerator* _gen;
 66   DecoratorSet  _decorators;
 67   LIRAddressOpr _base;
 68   LIRAddressOpr _offset;
 69   BasicType     _type;
 70   LIR_Opr       _resolved_addr;
 71   CodeEmitInfo* _patch_emit_info;
 72   CodeEmitInfo* _access_emit_info;

 73 
 74 public:
 75   LIRAccess(LIRGenerator* gen, DecoratorSet decorators,
 76             LIRAddressOpr base, LIRAddressOpr offset, BasicType type,
 77             CodeEmitInfo* patch_emit_info = nullptr, CodeEmitInfo* access_emit_info = nullptr) :
 78     _gen(gen),
 79     _decorators(AccessInternal::decorator_fixup(decorators, type)),
 80     _base(base),
 81     _offset(offset),
 82     _type(type),
 83     _resolved_addr(),
 84     _patch_emit_info(patch_emit_info),
 85     _access_emit_info(access_emit_info) {}

 86 
 87   void load_base()   { _base.item().load_item(); }
 88   void load_offset() { _offset.item().load_nonconstant(); }
 89 
 90   void load_address() {
 91     load_base();
 92     load_offset();
 93   }
 94 
 95   LIRGenerator* gen() const              { return _gen; }
 96   CodeEmitInfo*& patch_emit_info()       { return _patch_emit_info; }
 97   CodeEmitInfo*& access_emit_info()      { return _access_emit_info; }
 98   LIRAddressOpr& base()                  { return _base; }
 99   LIRAddressOpr& offset()                { return _offset; }
100   BasicType type() const                 { return _type; }
101   LIR_Opr resolved_addr() const          { return _resolved_addr; }
102   void set_resolved_addr(LIR_Opr addr)   { _resolved_addr = addr; }
103   bool is_oop() const                    { return is_reference_type(_type); }
104   DecoratorSet decorators() const        { return _decorators; }
105   void clear_decorators(DecoratorSet ds) { _decorators &= ~ds; }
106   bool is_raw() const                    { return (_decorators & AS_RAW) != 0; }

107 };
108 
109 // The BarrierSetC1 class is the main entry point for the GC backend of the Access API in C1.
110 // It is called by the LIRGenerator::access_* functions, which is the main entry point for
111 // access calls in C1.
112 
113 class BarrierSetC1: public CHeapObj<mtGC> {
114 protected:
115   virtual LIR_Opr resolve_address(LIRAccess& access, bool resolve_in_register);
116 
117   virtual void generate_referent_check(LIRAccess& access, LabelObj* cont);
118 
119   // Accesses with resolved address
120   virtual void store_at_resolved(LIRAccess& access, LIR_Opr value);
121   virtual void load_at_resolved(LIRAccess& access, LIR_Opr result);
122 
123   virtual LIR_Opr atomic_cmpxchg_at_resolved(LIRAccess& access, LIRItem& cmp_value, LIRItem& new_value);
124 
125   virtual LIR_Opr atomic_xchg_at_resolved(LIRAccess& access, LIRItem& value);
126   virtual LIR_Opr atomic_add_at_resolved(LIRAccess& access, LIRItem& value);

 53   LIR_Opr opr() const {
 54     if (_item == nullptr) {
 55       return _opr;
 56     } else {
 57       return _item->result();
 58     }
 59   }
 60 };
 61 
 62 // The LIRAccess class wraps shared context parameters required for performing
 63 // the right access in C1. This includes the address of the offset and the decorators.
 64 class LIRAccess: public StackObj {
 65   LIRGenerator* _gen;
 66   DecoratorSet  _decorators;
 67   LIRAddressOpr _base;
 68   LIRAddressOpr _offset;
 69   BasicType     _type;
 70   LIR_Opr       _resolved_addr;
 71   CodeEmitInfo* _patch_emit_info;
 72   CodeEmitInfo* _access_emit_info;
 73   ciInlineKlass* _vk; // For flat, atomic accesses that might require GC barriers on oop fields
 74 
 75 public:
 76   LIRAccess(LIRGenerator* gen, DecoratorSet decorators,
 77             LIRAddressOpr base, LIRAddressOpr offset, BasicType type,
 78             CodeEmitInfo* patch_emit_info = nullptr, CodeEmitInfo* access_emit_info = nullptr, ciInlineKlass* vk = nullptr) :
 79     _gen(gen),
 80     _decorators(AccessInternal::decorator_fixup(decorators, type)),
 81     _base(base),
 82     _offset(offset),
 83     _type(type),
 84     _resolved_addr(),
 85     _patch_emit_info(patch_emit_info),
 86     _access_emit_info(access_emit_info),
 87     _vk(vk) {}
 88 
 89   void load_base()   { _base.item().load_item(); }
 90   void load_offset() { _offset.item().load_nonconstant(); }
 91 
 92   void load_address() {
 93     load_base();
 94     load_offset();
 95   }
 96 
 97   LIRGenerator* gen() const              { return _gen; }
 98   CodeEmitInfo*& patch_emit_info()       { return _patch_emit_info; }
 99   CodeEmitInfo*& access_emit_info()      { return _access_emit_info; }
100   LIRAddressOpr& base()                  { return _base; }
101   LIRAddressOpr& offset()                { return _offset; }
102   BasicType type() const                 { return _type; }
103   LIR_Opr resolved_addr() const          { return _resolved_addr; }
104   void set_resolved_addr(LIR_Opr addr)   { _resolved_addr = addr; }
105   bool is_oop() const                    { return is_reference_type(_type); }
106   DecoratorSet decorators() const        { return _decorators; }
107   void clear_decorators(DecoratorSet ds) { _decorators &= ~ds; }
108   bool is_raw() const                    { return (_decorators & AS_RAW) != 0; }
109   ciInlineKlass* vk() const              { return _vk; }
110 };
111 
112 // The BarrierSetC1 class is the main entry point for the GC backend of the Access API in C1.
113 // It is called by the LIRGenerator::access_* functions, which is the main entry point for
114 // access calls in C1.
115 
116 class BarrierSetC1: public CHeapObj<mtGC> {
117 protected:
118   virtual LIR_Opr resolve_address(LIRAccess& access, bool resolve_in_register);
119 
120   virtual void generate_referent_check(LIRAccess& access, LabelObj* cont);
121 
122   // Accesses with resolved address
123   virtual void store_at_resolved(LIRAccess& access, LIR_Opr value);
124   virtual void load_at_resolved(LIRAccess& access, LIR_Opr result);
125 
126   virtual LIR_Opr atomic_cmpxchg_at_resolved(LIRAccess& access, LIRItem& cmp_value, LIRItem& new_value);
127 
128   virtual LIR_Opr atomic_xchg_at_resolved(LIRAccess& access, LIRItem& value);
129   virtual LIR_Opr atomic_add_at_resolved(LIRAccess& access, LIRItem& value);
< prev index next >