src/share/vm/c1/c1_ValueMap.hpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File 6756768 Sdiff src/share/vm/c1

src/share/vm/c1/c1_ValueMap.hpp

Print this page




 116 #ifndef PRODUCT
 117   // debugging/printing
 118   void print();
 119 
 120   static void reset_statistics();
 121   static void print_statistics();
 122 #endif
 123 };
 124 
 125 define_array(ValueMapArray, ValueMap*)
 126 
 127 
 128 class ValueNumberingVisitor: public InstructionVisitor {
 129  protected:
 130   // called by visitor functions for instructions that kill values
 131   virtual void kill_memory() = 0;
 132   virtual void kill_field(ciField* field) = 0;
 133   virtual void kill_array(ValueType* type) = 0;
 134 
 135   // visitor functions
 136   void do_StoreField     (StoreField*      x) { kill_field(x->field()); };
 137   void do_StoreIndexed   (StoreIndexed*    x) { kill_array(x->type()); };
 138   void do_MonitorEnter   (MonitorEnter*    x) { kill_memory(); };
 139   void do_MonitorExit    (MonitorExit*     x) { kill_memory(); };
 140   void do_Invoke         (Invoke*          x) { kill_memory(); };
 141   void do_UnsafePutRaw   (UnsafePutRaw*    x) { kill_memory(); };
 142   void do_UnsafePutObject(UnsafePutObject* x) { kill_memory(); };
 143   void do_Intrinsic      (Intrinsic*       x) { if (!x->preserves_state()) kill_memory(); };






 144 
 145   void do_Phi            (Phi*             x) { /* nothing to do */ };
 146   void do_Local          (Local*           x) { /* nothing to do */ };
 147   void do_Constant       (Constant*        x) { /* nothing to do */ };
 148   void do_LoadField      (LoadField*       x) { /* nothing to do */ };
 149   void do_ArrayLength    (ArrayLength*     x) { /* nothing to do */ };
 150   void do_LoadIndexed    (LoadIndexed*     x) { /* nothing to do */ };
 151   void do_NegateOp       (NegateOp*        x) { /* nothing to do */ };
 152   void do_ArithmeticOp   (ArithmeticOp*    x) { /* nothing to do */ };
 153   void do_ShiftOp        (ShiftOp*         x) { /* nothing to do */ };
 154   void do_LogicOp        (LogicOp*         x) { /* nothing to do */ };
 155   void do_CompareOp      (CompareOp*       x) { /* nothing to do */ };
 156   void do_IfOp           (IfOp*            x) { /* nothing to do */ };
 157   void do_Convert        (Convert*         x) { /* nothing to do */ };
 158   void do_NullCheck      (NullCheck*       x) { /* nothing to do */ };
 159   void do_NewInstance    (NewInstance*     x) { /* nothing to do */ };
 160   void do_NewTypeArray   (NewTypeArray*    x) { /* nothing to do */ };
 161   void do_NewObjectArray (NewObjectArray*  x) { /* nothing to do */ };
 162   void do_NewMultiArray  (NewMultiArray*   x) { /* nothing to do */ };
 163   void do_CheckCast      (CheckCast*       x) { /* nothing to do */ };
 164   void do_InstanceOf     (InstanceOf*      x) { /* nothing to do */ };
 165   void do_BlockBegin     (BlockBegin*      x) { /* nothing to do */ };
 166   void do_Goto           (Goto*            x) { /* nothing to do */ };
 167   void do_If             (If*              x) { /* nothing to do */ };
 168   void do_IfInstanceOf   (IfInstanceOf*    x) { /* nothing to do */ };
 169   void do_TableSwitch    (TableSwitch*     x) { /* nothing to do */ };
 170   void do_LookupSwitch   (LookupSwitch*    x) { /* nothing to do */ };
 171   void do_Return         (Return*          x) { /* nothing to do */ };
 172   void do_Throw          (Throw*           x) { /* nothing to do */ };
 173   void do_Base           (Base*            x) { /* nothing to do */ };
 174   void do_OsrEntry       (OsrEntry*        x) { /* nothing to do */ };
 175   void do_ExceptionObject(ExceptionObject* x) { /* nothing to do */ };
 176   void do_RoundFP        (RoundFP*         x) { /* nothing to do */ };
 177   void do_UnsafeGetRaw   (UnsafeGetRaw*    x) { /* nothing to do */ };
 178   void do_UnsafeGetObject(UnsafeGetObject* x) { /* nothing to do */ };
 179   void do_UnsafePrefetchRead (UnsafePrefetchRead*  x) { /* nothing to do */ };
 180   void do_UnsafePrefetchWrite(UnsafePrefetchWrite* x) { /* nothing to do */ };
 181   void do_ProfileCall    (ProfileCall*     x) { /* nothing to do */ };
 182   void do_ProfileCounter (ProfileCounter*  x) { /* nothing to do */ };




 183 };
 184 














 185 
 186 class GlobalValueNumbering: public ValueNumberingVisitor {
 187  private:
 188   ValueMap*     _current_map;     // value map of current block
 189   ValueMapArray _value_maps;      // list of value maps for all blocks
 190 
 191  public:
 192   // accessors
 193   ValueMap*     current_map()                    { return _current_map; }
 194   ValueMap*     value_map_of(BlockBegin* block)  { return _value_maps.at(block->linear_scan_number()); }
 195   void          set_value_map_of(BlockBegin* block, ValueMap* map)   { assert(value_map_of(block) == NULL, ""); _value_maps.at_put(block->linear_scan_number(), map); }
 196 
 197   // implementation for abstract methods of ValueNumberingVisitor
 198   void          kill_memory()                    { current_map()->kill_memory(); }
 199   void          kill_field(ciField* field)       { current_map()->kill_field(field); }
 200   void          kill_array(ValueType* type)      { current_map()->kill_array(type); }
 201 
 202   // main entry point that performs global value numbering
 203   GlobalValueNumbering(IR* ir);
 204 };


 116 #ifndef PRODUCT
 117   // debugging/printing
 118   void print();
 119 
 120   static void reset_statistics();
 121   static void print_statistics();
 122 #endif
 123 };
 124 
 125 define_array(ValueMapArray, ValueMap*)
 126 
 127 
 128 class ValueNumberingVisitor: public InstructionVisitor {
 129  protected:
 130   // called by visitor functions for instructions that kill values
 131   virtual void kill_memory() = 0;
 132   virtual void kill_field(ciField* field) = 0;
 133   virtual void kill_array(ValueType* type) = 0;
 134 
 135   // visitor functions
 136   void do_StoreField     (StoreField*      x) {
 137     if (!x->is_initialized()) {
 138       kill_memory();
 139     } else {
 140       kill_field(x->field());
 141     }
 142   }
 143   void do_StoreIndexed   (StoreIndexed*    x) { kill_array(x->type()); }
 144   void do_MonitorEnter   (MonitorEnter*    x) { kill_memory(); }
 145   void do_MonitorExit    (MonitorExit*     x) { kill_memory(); }
 146   void do_Invoke         (Invoke*          x) { kill_memory(); }
 147   void do_UnsafePutRaw   (UnsafePutRaw*    x) { kill_memory(); }
 148   void do_UnsafePutObject(UnsafePutObject* x) { kill_memory(); }
 149   void do_Intrinsic      (Intrinsic*       x) { if (!x->preserves_state()) kill_memory(); }
 150 
 151   void do_Phi            (Phi*             x) { /* nothing to do */ }
 152   void do_Local          (Local*           x) { /* nothing to do */ }
 153   void do_Constant       (Constant*        x) { /* nothing to do */ }
 154   void do_LoadField      (LoadField*       x) {
 155     if (!x->is_initialized()) {
 156       kill_memory();
 157     }
 158   }
 159   void do_ArrayLength    (ArrayLength*     x) { /* nothing to do */ }
 160   void do_LoadIndexed    (LoadIndexed*     x) { /* nothing to do */ }
 161   void do_NegateOp       (NegateOp*        x) { /* nothing to do */ }
 162   void do_ArithmeticOp   (ArithmeticOp*    x) { /* nothing to do */ }
 163   void do_ShiftOp        (ShiftOp*         x) { /* nothing to do */ }
 164   void do_LogicOp        (LogicOp*         x) { /* nothing to do */ }
 165   void do_CompareOp      (CompareOp*       x) { /* nothing to do */ }
 166   void do_IfOp           (IfOp*            x) { /* nothing to do */ }
 167   void do_Convert        (Convert*         x) { /* nothing to do */ }
 168   void do_NullCheck      (NullCheck*       x) { /* nothing to do */ }
 169   void do_NewInstance    (NewInstance*     x) { /* nothing to do */ }
 170   void do_NewTypeArray   (NewTypeArray*    x) { /* nothing to do */ }
 171   void do_NewObjectArray (NewObjectArray*  x) { /* nothing to do */ }
 172   void do_NewMultiArray  (NewMultiArray*   x) { /* nothing to do */ }
 173   void do_CheckCast      (CheckCast*       x) { /* nothing to do */ }
 174   void do_InstanceOf     (InstanceOf*      x) { /* nothing to do */ }
 175   void do_BlockBegin     (BlockBegin*      x) { /* nothing to do */ }
 176   void do_Goto           (Goto*            x) { /* nothing to do */ }
 177   void do_If             (If*              x) { /* nothing to do */ }
 178   void do_IfInstanceOf   (IfInstanceOf*    x) { /* nothing to do */ }
 179   void do_TableSwitch    (TableSwitch*     x) { /* nothing to do */ }
 180   void do_LookupSwitch   (LookupSwitch*    x) { /* nothing to do */ }
 181   void do_Return         (Return*          x) { /* nothing to do */ }
 182   void do_Throw          (Throw*           x) { /* nothing to do */ }
 183   void do_Base           (Base*            x) { /* nothing to do */ }
 184   void do_OsrEntry       (OsrEntry*        x) { /* nothing to do */ }
 185   void do_ExceptionObject(ExceptionObject* x) { /* nothing to do */ }
 186   void do_RoundFP        (RoundFP*         x) { /* nothing to do */ }
 187   void do_UnsafeGetRaw   (UnsafeGetRaw*    x) { /* nothing to do */ }
 188   void do_UnsafeGetObject(UnsafeGetObject* x) { /* nothing to do */ }
 189   void do_UnsafePrefetchRead (UnsafePrefetchRead*  x) { /* nothing to do */ }
 190   void do_UnsafePrefetchWrite(UnsafePrefetchWrite* x) { /* nothing to do */ }
 191   void do_ProfileCall    (ProfileCall*     x) { /* nothing to do */ }
 192   void do_ProfileCounter (ProfileCounter*  x) { /* nothing to do */ }
 193 };
 194 
 195 
 196 class ValueNumberingEffects: public ValueNumberingVisitor {
 197  private:
 198   ValueMap*     _map;
 199 
 200  public:
 201   // implementation for abstract methods of ValueNumberingVisitor
 202   void          kill_memory()                    { _map->kill_memory(); }
 203   void          kill_field(ciField* field)       { _map->kill_field(field); }
 204   void          kill_array(ValueType* type)      { _map->kill_array(type); }
 205 
 206   ValueNumberingEffects(ValueMap* map): _map(map) {}
 207 };
 208 
 209 
 210 class GlobalValueNumbering: public ValueNumberingVisitor {
 211  private:
 212   ValueMap*     _current_map;     // value map of current block
 213   ValueMapArray _value_maps;      // list of value maps for all blocks
 214 
 215  public:
 216   // accessors
 217   ValueMap*     current_map()                    { return _current_map; }
 218   ValueMap*     value_map_of(BlockBegin* block)  { return _value_maps.at(block->linear_scan_number()); }
 219   void          set_value_map_of(BlockBegin* block, ValueMap* map)   { assert(value_map_of(block) == NULL, ""); _value_maps.at_put(block->linear_scan_number(), map); }
 220 
 221   // implementation for abstract methods of ValueNumberingVisitor
 222   void          kill_memory()                    { current_map()->kill_memory(); }
 223   void          kill_field(ciField* field)       { current_map()->kill_field(field); }
 224   void          kill_array(ValueType* type)      { current_map()->kill_array(type); }
 225 
 226   // main entry point that performs global value numbering
 227   GlobalValueNumbering(IR* ir);
 228 };
src/share/vm/c1/c1_ValueMap.hpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File