< 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");

171     }
172   }
173   void do_LoadField      (LoadField*       x) {
174     if (x->is_init_point() ||         // getstatic is an initialization point so treat it as a wide kill
175         x->field()->is_volatile()) {  // the JMM requires this
176       kill_memory();
177     }
178   }
179   void do_ArrayLength    (ArrayLength*     x) { /* nothing to do */ }
180   void do_LoadIndexed    (LoadIndexed*     x) { /* nothing to do */ }
181   void do_NegateOp       (NegateOp*        x) { /* nothing to do */ }
182   void do_ArithmeticOp   (ArithmeticOp*    x) { /* nothing to do */ }
183   void do_ShiftOp        (ShiftOp*         x) { /* nothing to do */ }
184   void do_LogicOp        (LogicOp*         x) { /* nothing to do */ }
185   void do_CompareOp      (CompareOp*       x) { /* nothing to do */ }
186   void do_IfOp           (IfOp*            x) { /* nothing to do */ }
187   void do_Convert        (Convert*         x) { /* nothing to do */ }
188   void do_NullCheck      (NullCheck*       x) { /* nothing to do */ }
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() != NULL) {
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");

174     }
175   }
176   void do_LoadField      (LoadField*       x) {
177     if (x->is_init_point() ||         // getstatic is an initialization point so treat it as a wide kill
178         x->field()->is_volatile()) {  // the JMM requires this
179       kill_memory();
180     }
181   }
182   void do_ArrayLength    (ArrayLength*     x) { /* nothing to do */ }
183   void do_LoadIndexed    (LoadIndexed*     x) { /* nothing to do */ }
184   void do_NegateOp       (NegateOp*        x) { /* nothing to do */ }
185   void do_ArithmeticOp   (ArithmeticOp*    x) { /* nothing to do */ }
186   void do_ShiftOp        (ShiftOp*         x) { /* nothing to do */ }
187   void do_LogicOp        (LogicOp*         x) { /* nothing to do */ }
188   void do_CompareOp      (CompareOp*       x) { /* nothing to do */ }
189   void do_IfOp           (IfOp*            x) { /* nothing to do */ }
190   void do_Convert        (Convert*         x) { /* nothing to do */ }
191   void do_NullCheck      (NullCheck*       x) { /* nothing to do */ }
192   void do_TypeCast       (TypeCast*        x) { /* nothing to do */ }
193   void do_NewInstance    (NewInstance*     x) { /* nothing to do */ }
194   void do_NewInlineTypeInstance(NewInlineTypeInstance* x) { /* nothing to do */ }
195   void do_NewTypeArray   (NewTypeArray*    x) { /* nothing to do */ }
196   void do_NewObjectArray (NewObjectArray*  x) { /* nothing to do */ }
197   void do_NewMultiArray  (NewMultiArray*   x) { /* nothing to do */ }
198   void do_Deoptimize     (Deoptimize*      x) { /* nothing to do */ }
199   void do_CheckCast      (CheckCast*       x) { /* nothing to do */ }
200   void do_InstanceOf     (InstanceOf*      x) { /* nothing to do */ }
201   void do_BlockBegin     (BlockBegin*      x) { /* nothing to do */ }
202   void do_Goto           (Goto*            x) { /* nothing to do */ }
203   void do_If             (If*              x) { /* nothing to do */ }
204   void do_TableSwitch    (TableSwitch*     x) { /* nothing to do */ }
205   void do_LookupSwitch   (LookupSwitch*    x) { /* nothing to do */ }
206   void do_Return         (Return*          x) { /* nothing to do */ }
207   void do_Throw          (Throw*           x) { /* nothing to do */ }
208   void do_Base           (Base*            x) { /* nothing to do */ }
209   void do_OsrEntry       (OsrEntry*        x) { /* nothing to do */ }
210   void do_ExceptionObject(ExceptionObject* x) { /* nothing to do */ }
211   void do_RoundFP        (RoundFP*         x) { /* nothing to do */ }
212   void do_ProfileCall    (ProfileCall*     x) { /* nothing to do */ }
213   void do_ProfileReturnType (ProfileReturnType*  x) { /* nothing to do */ }
214   void do_ProfileACmpTypes(ProfileACmpTypes*  x) { /* nothing to do */ }
215   void do_ProfileInvoke  (ProfileInvoke*   x) { /* nothing to do */ };
216   void do_RuntimeCall    (RuntimeCall*     x) { /* nothing to do */ };
217   void do_MemBar         (MemBar*          x) { /* nothing to do */ };
218   void do_RangeCheckPredicate(RangeCheckPredicate* x) { /* nothing to do */ };
219 #ifdef ASSERT
220   void do_Assert         (Assert*          x) { /* nothing to do */ };
221 #endif
222 };
223 
224 
225 class ValueNumberingEffects: public ValueNumberingVisitor {
226  private:
227   ValueMap*     _map;
228 
229  public:
230   // implementation for abstract methods of ValueNumberingVisitor
231   void          kill_memory()                                 { _map->kill_memory(); }
232   void          kill_field(ciField* field, bool all_offsets)  { _map->kill_field(field, all_offsets); }
233   void          kill_array(ValueType* type)                   { _map->kill_array(type); }
234 
< prev index next >