< prev index next >

src/hotspot/share/c1/c1_ValueMap.hpp

Print this page

130 
131 typedef GrowableArray<ValueMap*> ValueMapArray;
132 
133 class ValueNumberingVisitor: public InstructionVisitor {
134  protected:
135   // called by visitor functions for instructions that kill values
136   virtual void kill_memory() = 0;
137   virtual void kill_field(ciField* field, bool all_offsets) = 0;
138   virtual void kill_array(ValueType* type) = 0;
139 
140   // visitor functions
141   void do_StoreField     (StoreField*      x) {
142     if (x->is_init_point() ||  // putstatic is an initialization point so treat it as a wide kill
143         // This is actually too strict and the JMM doesn't require
144         // this in all cases (e.g. load a; volatile store b; load a)
145         // but possible future optimizations might require this.
146         x->field()->is_volatile()) {
147       kill_memory();
148     } else {
149       kill_field(x->field(), x->needs_patching());



150     }
151   }
152   void do_StoreIndexed   (StoreIndexed*    x) { kill_array(x->type()); }
153   void do_MonitorEnter   (MonitorEnter*    x) { kill_memory(); }
154   void do_MonitorExit    (MonitorExit*     x) { kill_memory(); }
155   void do_Invoke         (Invoke*          x) { kill_memory(); }
156   void do_UnsafePut      (UnsafePut*       x) { kill_memory(); }
157   void do_UnsafeGetAndSet(UnsafeGetAndSet* x) { kill_memory(); }
158   void do_UnsafeGet      (UnsafeGet*       x) {
159     if (x->is_volatile()) { // the JMM requires this
160       kill_memory();
161     }
162   }
163   void do_Intrinsic      (Intrinsic*       x) { if (!x->preserves_state()) kill_memory(); }
164 
165   void do_Phi            (Phi*             x) { /* nothing to do */ }
166   void do_Local          (Local*           x) { /* nothing to do */ }
167   void do_Constant       (Constant*        x) {
168     if (x->kills_memory()) {
169       assert(x->can_trap(), "already linked");

189   void do_TypeCast       (TypeCast*        x) { /* nothing to do */ }
190   void do_NewInstance    (NewInstance*     x) { /* nothing to do */ }
191   void do_NewTypeArray   (NewTypeArray*    x) { /* nothing to do */ }
192   void do_NewObjectArray (NewObjectArray*  x) { /* nothing to do */ }
193   void do_NewMultiArray  (NewMultiArray*   x) { /* nothing to do */ }
194   void do_CheckCast      (CheckCast*       x) { /* nothing to do */ }
195   void do_InstanceOf     (InstanceOf*      x) { /* nothing to do */ }
196   void do_BlockBegin     (BlockBegin*      x) { /* nothing to do */ }
197   void do_Goto           (Goto*            x) { /* nothing to do */ }
198   void do_If             (If*              x) { /* nothing to do */ }
199   void do_TableSwitch    (TableSwitch*     x) { /* nothing to do */ }
200   void do_LookupSwitch   (LookupSwitch*    x) { /* nothing to do */ }
201   void do_Return         (Return*          x) { /* nothing to do */ }
202   void do_Throw          (Throw*           x) { /* nothing to do */ }
203   void do_Base           (Base*            x) { /* nothing to do */ }
204   void do_OsrEntry       (OsrEntry*        x) { /* nothing to do */ }
205   void do_ExceptionObject(ExceptionObject* x) { /* nothing to do */ }
206   void do_RoundFP        (RoundFP*         x) { /* nothing to do */ }
207   void do_ProfileCall    (ProfileCall*     x) { /* nothing to do */ }
208   void do_ProfileReturnType (ProfileReturnType*  x) { /* nothing to do */ }

209   void do_ProfileInvoke  (ProfileInvoke*   x) { /* nothing to do */ };
210   void do_RuntimeCall    (RuntimeCall*     x) { /* nothing to do */ };
211   void do_MemBar         (MemBar*          x) { /* nothing to do */ };
212   void do_RangeCheckPredicate(RangeCheckPredicate* x) { /* nothing to do */ };
213 #ifdef ASSERT
214   void do_Assert         (Assert*          x) { /* nothing to do */ };
215 #endif
216 };
217 
218 
219 class ValueNumberingEffects: public ValueNumberingVisitor {
220  private:
221   ValueMap*     _map;
222 
223  public:
224   // implementation for abstract methods of ValueNumberingVisitor
225   void          kill_memory()                                 { _map->kill_memory(); }
226   void          kill_field(ciField* field, bool all_offsets)  { _map->kill_field(field, all_offsets); }
227   void          kill_array(ValueType* type)                   { _map->kill_array(type); }
228 

130 
131 typedef GrowableArray<ValueMap*> ValueMapArray;
132 
133 class ValueNumberingVisitor: public InstructionVisitor {
134  protected:
135   // called by visitor functions for instructions that kill values
136   virtual void kill_memory() = 0;
137   virtual void kill_field(ciField* field, bool all_offsets) = 0;
138   virtual void kill_array(ValueType* type) = 0;
139 
140   // visitor functions
141   void do_StoreField     (StoreField*      x) {
142     if (x->is_init_point() ||  // putstatic is an initialization point so treat it as a wide kill
143         // This is actually too strict and the JMM doesn't require
144         // this in all cases (e.g. load a; volatile store b; load a)
145         // but possible future optimizations might require this.
146         x->field()->is_volatile()) {
147       kill_memory();
148     } else {
149       kill_field(x->field(), x->needs_patching());
150       if (x->enclosing_field() != nullptr) {
151         kill_field(x->enclosing_field(), true);
152       }
153     }
154   }
155   void do_StoreIndexed   (StoreIndexed*    x) { kill_array(x->type()); }
156   void do_MonitorEnter   (MonitorEnter*    x) { kill_memory(); }
157   void do_MonitorExit    (MonitorExit*     x) { kill_memory(); }
158   void do_Invoke         (Invoke*          x) { kill_memory(); }
159   void do_UnsafePut      (UnsafePut*       x) { kill_memory(); }
160   void do_UnsafeGetAndSet(UnsafeGetAndSet* x) { kill_memory(); }
161   void do_UnsafeGet      (UnsafeGet*       x) {
162     if (x->is_volatile()) { // the JMM requires this
163       kill_memory();
164     }
165   }
166   void do_Intrinsic      (Intrinsic*       x) { if (!x->preserves_state()) kill_memory(); }
167 
168   void do_Phi            (Phi*             x) { /* nothing to do */ }
169   void do_Local          (Local*           x) { /* nothing to do */ }
170   void do_Constant       (Constant*        x) {
171     if (x->kills_memory()) {
172       assert(x->can_trap(), "already linked");

192   void do_TypeCast       (TypeCast*        x) { /* nothing to do */ }
193   void do_NewInstance    (NewInstance*     x) { /* nothing to do */ }
194   void do_NewTypeArray   (NewTypeArray*    x) { /* nothing to do */ }
195   void do_NewObjectArray (NewObjectArray*  x) { /* nothing to do */ }
196   void do_NewMultiArray  (NewMultiArray*   x) { /* nothing to do */ }
197   void do_CheckCast      (CheckCast*       x) { /* nothing to do */ }
198   void do_InstanceOf     (InstanceOf*      x) { /* nothing to do */ }
199   void do_BlockBegin     (BlockBegin*      x) { /* nothing to do */ }
200   void do_Goto           (Goto*            x) { /* nothing to do */ }
201   void do_If             (If*              x) { /* nothing to do */ }
202   void do_TableSwitch    (TableSwitch*     x) { /* nothing to do */ }
203   void do_LookupSwitch   (LookupSwitch*    x) { /* nothing to do */ }
204   void do_Return         (Return*          x) { /* nothing to do */ }
205   void do_Throw          (Throw*           x) { /* nothing to do */ }
206   void do_Base           (Base*            x) { /* nothing to do */ }
207   void do_OsrEntry       (OsrEntry*        x) { /* nothing to do */ }
208   void do_ExceptionObject(ExceptionObject* x) { /* nothing to do */ }
209   void do_RoundFP        (RoundFP*         x) { /* nothing to do */ }
210   void do_ProfileCall    (ProfileCall*     x) { /* nothing to do */ }
211   void do_ProfileReturnType (ProfileReturnType*  x) { /* nothing to do */ }
212   void do_ProfileACmpTypes(ProfileACmpTypes*  x) { /* nothing to do */ }
213   void do_ProfileInvoke  (ProfileInvoke*   x) { /* nothing to do */ };
214   void do_RuntimeCall    (RuntimeCall*     x) { /* nothing to do */ };
215   void do_MemBar         (MemBar*          x) { /* nothing to do */ };
216   void do_RangeCheckPredicate(RangeCheckPredicate* x) { /* nothing to do */ };
217 #ifdef ASSERT
218   void do_Assert         (Assert*          x) { /* nothing to do */ };
219 #endif
220 };
221 
222 
223 class ValueNumberingEffects: public ValueNumberingVisitor {
224  private:
225   ValueMap*     _map;
226 
227  public:
228   // implementation for abstract methods of ValueNumberingVisitor
229   void          kill_memory()                                 { _map->kill_memory(); }
230   void          kill_field(ciField* field, bool all_offsets)  { _map->kill_field(field, all_offsets); }
231   void          kill_array(ValueType* type)                   { _map->kill_array(type); }
232 
< prev index next >