< prev index next >

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

BarrierSetC1_v3

BarrierSetC1_v2

16  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.                                                                     
17  *                                                                                                                                   
18  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA                                                           
19  * or visit www.oracle.com if you need additional information or have any                                                            
20  * questions.                                                                                                                        
21  *                                                                                                                                   
22  */                                                                                                                                  
23 
24 #ifndef SHARE_GC_SHARED_C1_BARRIERSETC1_HPP                                                                                          
25 #define SHARE_GC_SHARED_C1_BARRIERSETC1_HPP                                                                                          
26 
27 #include "c1/c1_Decorators.hpp"                                                                                                      
28 #include "c1/c1_LIRGenerator.hpp"                                                                                                    
29 #include "c1/c1_Instruction.hpp"                                                                                                     
30 #include "c1/c1_LIR.hpp"                                                                                                             
31 #include "memory/allocation.hpp"                                                                                                     
32 
33 class LIRGenerator;                                                                                                                  
34 class LIRItem;                                                                                                                       
35 
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
36 class BarrierSetC1: public CHeapObj<mtGC> {                                                                                          
37 protected:                                                                                                                           
38   virtual LIR_Opr resolve_address(LIRGenerator* lir_generator, DecoratorSet decorators, BasicType type,                              
39                                   LIRItem& base, LIR_Opr offset, bool resolve_in_register);                                          
40 
41   virtual void generate_referent_check(LIRGenerator* lir_generator, LIRItem& base, LIR_Opr offset, LabelObj* cont);                  
42 
43   // Accesses with resolved address                                                                                                  
44   virtual void store_at_resolved(LIRGenerator* lir_generator, DecoratorSet decorators, BasicType type,                               
45                                  LIR_Opr addr, LIRItem& base, LIR_Opr offset, LIR_Opr value,                                         
46                                  CodeEmitInfo* patch_info, CodeEmitInfo* store_emit_info);                                           
47                                                                                                                                      
48   virtual void load_at_resolved(LIRGenerator* lir_generator, DecoratorSet decorators, BasicType type,                                
49                                 LIR_Opr addr, LIRItem& base, LIR_Opr offset, LIR_Opr result,                                         
50                                 CodeEmitInfo* patch_info, CodeEmitInfo* load_emit_info);                                             
51                                                                                                                                      
52   virtual LIR_Opr atomic_cmpxchg_resolved(LIRGenerator* lir_generator, DecoratorSet decorators, BasicType type,                      
53                                           LIR_Opr addr, LIRItem& base, LIRItem& offset, LIRItem& cmp_value, LIRItem& new_value);     
54 
55   virtual LIR_Opr atomic_xchg_resolved(LIRGenerator* lir_generator, DecoratorSet decorators, BasicType type,                         
56                                        LIR_Opr addr, LIRItem& base, LIRItem& offset, LIRItem& value);                                
57 
58   virtual LIR_Opr atomic_add_at_resolved(LIRGenerator* lir_generator, DecoratorSet decorators, BasicType type,                       
59                                          LIR_Opr addr, LIRItem& base, LIRItem& offset, LIRItem& value);                              
60 
61 public:                                                                                                                              
62   virtual void store_at(LIRGenerator* lir_generator, DecoratorSet decorators, BasicType type,                                        
63                         LIRItem& base, LIR_Opr offset, LIR_Opr value,                                                                
64                         CodeEmitInfo* patch_info, CodeEmitInfo* store_emit_info);                                                    
65                                                                                                                                      
66   virtual void load_at(LIRGenerator* lir_generator, DecoratorSet decorators, BasicType type,                                         
67                        LIRItem& base, LIR_Opr offset, LIR_Opr result,                                                                
68                        CodeEmitInfo* patch_info, CodeEmitInfo* load_emit_info);                                                      
69                                                                                                                                      
70   virtual LIR_Opr atomic_cmpxchg_at(LIRGenerator* lir_generator, DecoratorSet decorators, BasicType type,                            
71                                     LIRItem& base, LIRItem& offset, LIRItem& cmp_value, LIRItem& new_value);                         
72 
73   virtual LIR_Opr atomic_xchg(LIRGenerator* lir_generator, DecoratorSet decorators, BasicType type,                                  
74                               LIRItem& base, LIRItem& offset, LIRItem& value);                                                       
75 
76   virtual LIR_Opr atomic_add_at(LIRGenerator* lir_generator, DecoratorSet decorators, BasicType type,                                
77                                 LIRItem& base, LIRItem& offset, LIRItem& value);                                                     
78 
79   virtual void generate_c1_runtime_stubs(BufferBlob* buffer_blob) {}                                                                 
80 };                                                                                                                                   
81 
82 #endif // SHARE_GC_SHARED_C1_BARRIERSETC1_HPP                                                                                        

16  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
17  *
18  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
19  * or visit www.oracle.com if you need additional information or have any
20  * questions.
21  *
22  */
23 
24 #ifndef SHARE_GC_SHARED_C1_BARRIERSETC1_HPP
25 #define SHARE_GC_SHARED_C1_BARRIERSETC1_HPP
26 
27 #include "c1/c1_Decorators.hpp"
28 #include "c1/c1_LIRGenerator.hpp"
29 #include "c1/c1_Instruction.hpp"
30 #include "c1/c1_LIR.hpp"
31 #include "memory/allocation.hpp"
32 
33 class LIRGenerator;
34 class LIRItem;
35 
36 // The LIRAddressOpr comprises either a LIRItem or a LIR_Opr to describe elements
37 // of an access in the C1 Access API. Both of them allow asking for the opr() which
38 // will correspond to either _item.result() or _opr if there is no _item.
39 class LIRAddressOpr: public StackObj {
40   LIRItem* _item;
41   LIR_Opr  _opr;
42 public:
43   LIRAddressOpr(LIRItem& item) : _item(&item), _opr(NULL) {}
44   LIRAddressOpr(LIR_Opr opr) : _item(NULL), _opr(opr) {}
45   LIRAddressOpr(const LIRAddressOpr& other) : _item(other._item), _opr(other._opr) {}
46 
47   LIRItem& item() const {
48     assert(_item != NULL, "sanity");
49     return *_item;
50   }
51 
52   LIR_Opr opr() const {
53     if (_item == NULL) {
54       return _opr;
55     } else {
56       return _item->result();
57     }
58   }
59 };
60 
61 // The LIRAccess class wraps shared context parameters required for performing
62 // the right access in C1. This includes the address of the offset and the decorators.
63 class LIRAccess: public StackObj {
64   LIRGenerator* _gen;
65   DecoratorSet  _decorators;
66   LIRAddressOpr _base;
67   LIRAddressOpr _offset;
68   BasicType     _type;
69   LIR_Opr       _resolved_addr;
70   CodeEmitInfo* _patch_info;
71   CodeEmitInfo* _access_emit_info;
72 
73 public:
74   LIRAccess(LIRGenerator* gen, DecoratorSet decorators,
75             LIRAddressOpr base, LIRAddressOpr offset, BasicType type,
76             CodeEmitInfo* patch_info = NULL, CodeEmitInfo* access_emit_info = NULL) :
77     _gen(gen),
78     _decorators(AccessInternal::decorator_fixup(decorators)),
79     _base(base),
80     _offset(offset),
81     _type(type),
82     _resolved_addr(NULL),
83     _patch_info(patch_info),
84     _access_emit_info(access_emit_info) {}
85 
86   void load_base()   { _base.item().load_item(); }
87   void load_offset() { _offset.item().load_nonconstant(); }
88 
89   void load_address() {
90     load_base();
91     load_offset();
92   }
93 
94   LIRGenerator* gen() const            { return _gen; }
95   CodeEmitInfo*& patch_info()          { return _patch_info; }
96   CodeEmitInfo*& access_emit_info()    { return _access_emit_info; }
97   LIRAddressOpr& base()                { return _base; }
98   LIRAddressOpr& offset()              { return _offset; }
99   BasicType type() const               { return _type; }
100   LIR_Opr resolved_addr() const        { return _resolved_addr; }
101   void set_resolved_addr(LIR_Opr addr) { _resolved_addr = addr; }
102   bool is_oop() const                  { return _type == T_ARRAY || _type == T_OBJECT; }
103   DecoratorSet decorators() const      { return _decorators; }
104   bool is_raw() const                  { return (_decorators & AS_RAW) != 0; }
105 };
106 
107 // The BarrierSetC1 class is the main entry point for the GC backend of the Access API in C1.
108 // It is called by the LIRGenerator::access_* functions, which is the main entry poing for
109 // access calls in C1.
110 
111 class BarrierSetC1: public CHeapObj<mtGC> {
112 protected:
113   virtual LIR_Opr resolve_address(LIRAccess& access, bool resolve_in_register);

114 
115   virtual void generate_referent_check(LIRAccess& access, LabelObj* cont);
116 
117   // Accesses with resolved address
118   virtual void store_at_resolved(LIRAccess& access, LIR_Opr value);
119   virtual void load_at_resolved(LIRAccess& access, LIR_Opr result);








120 
121   virtual LIR_Opr atomic_cmpxchg_resolved(LIRAccess& access, LIRItem& cmp_value, LIRItem& new_value);

122 
123   virtual LIR_Opr atomic_xchg_resolved(LIRAccess& access, LIRItem& value);
124   virtual LIR_Opr atomic_add_at_resolved(LIRAccess& access, LIRItem& value);
125 
126 public:
127   virtual void store_at(LIRAccess& access, LIR_Opr value);
128   virtual void load_at(LIRAccess& access, LIR_Opr result);








129 
130   virtual LIR_Opr atomic_cmpxchg_at(LIRAccess& access, LIRItem& cmp_value, LIRItem& new_value);

131 
132   virtual LIR_Opr atomic_xchg(LIRAccess& access, LIRItem& value);
133   virtual LIR_Opr atomic_add_at(LIRAccess& access, LIRItem& value);
134 
135   virtual void generate_c1_runtime_stubs(BufferBlob* buffer_blob) {}
136 };
137 
138 #endif // SHARE_GC_SHARED_C1_BARRIERSETC1_HPP
< prev index next >