diff src/share/vm/c1/c1_ValueMap.hpp @ 459:3a86a8dcf27c

6756768: C1 generates invalid code Reviewed-by: kvn, jrose
author never
date Tue, 25 Nov 2008 13:14:07 -0800
parents a61af66fc99e
children ad8c8ca4ab0f
line wrap: on
line diff
--- a/src/share/vm/c1/c1_ValueMap.hpp	Wed Nov 19 14:20:51 2008 -0800
+++ b/src/share/vm/c1/c1_ValueMap.hpp	Tue Nov 25 13:14:07 2008 -0800
@@ -133,53 +133,77 @@
   virtual void kill_array(ValueType* type) = 0;
 
   // visitor functions
-  void do_StoreField     (StoreField*      x) { kill_field(x->field()); };
-  void do_StoreIndexed   (StoreIndexed*    x) { kill_array(x->type()); };
-  void do_MonitorEnter   (MonitorEnter*    x) { kill_memory(); };
-  void do_MonitorExit    (MonitorExit*     x) { kill_memory(); };
-  void do_Invoke         (Invoke*          x) { kill_memory(); };
-  void do_UnsafePutRaw   (UnsafePutRaw*    x) { kill_memory(); };
-  void do_UnsafePutObject(UnsafePutObject* x) { kill_memory(); };
-  void do_Intrinsic      (Intrinsic*       x) { if (!x->preserves_state()) kill_memory(); };
+  void do_StoreField     (StoreField*      x) {
+    if (!x->is_initialized()) {
+      kill_memory();
+    } else {
+      kill_field(x->field());
+    }
+  }
+  void do_StoreIndexed   (StoreIndexed*    x) { kill_array(x->type()); }
+  void do_MonitorEnter   (MonitorEnter*    x) { kill_memory(); }
+  void do_MonitorExit    (MonitorExit*     x) { kill_memory(); }
+  void do_Invoke         (Invoke*          x) { kill_memory(); }
+  void do_UnsafePutRaw   (UnsafePutRaw*    x) { kill_memory(); }
+  void do_UnsafePutObject(UnsafePutObject* x) { kill_memory(); }
+  void do_Intrinsic      (Intrinsic*       x) { if (!x->preserves_state()) kill_memory(); }
 
-  void do_Phi            (Phi*             x) { /* nothing to do */ };
-  void do_Local          (Local*           x) { /* nothing to do */ };
-  void do_Constant       (Constant*        x) { /* nothing to do */ };
-  void do_LoadField      (LoadField*       x) { /* nothing to do */ };
-  void do_ArrayLength    (ArrayLength*     x) { /* nothing to do */ };
-  void do_LoadIndexed    (LoadIndexed*     x) { /* nothing to do */ };
-  void do_NegateOp       (NegateOp*        x) { /* nothing to do */ };
-  void do_ArithmeticOp   (ArithmeticOp*    x) { /* nothing to do */ };
-  void do_ShiftOp        (ShiftOp*         x) { /* nothing to do */ };
-  void do_LogicOp        (LogicOp*         x) { /* nothing to do */ };
-  void do_CompareOp      (CompareOp*       x) { /* nothing to do */ };
-  void do_IfOp           (IfOp*            x) { /* nothing to do */ };
-  void do_Convert        (Convert*         x) { /* nothing to do */ };
-  void do_NullCheck      (NullCheck*       x) { /* nothing to do */ };
-  void do_NewInstance    (NewInstance*     x) { /* nothing to do */ };
-  void do_NewTypeArray   (NewTypeArray*    x) { /* nothing to do */ };
-  void do_NewObjectArray (NewObjectArray*  x) { /* nothing to do */ };
-  void do_NewMultiArray  (NewMultiArray*   x) { /* nothing to do */ };
-  void do_CheckCast      (CheckCast*       x) { /* nothing to do */ };
-  void do_InstanceOf     (InstanceOf*      x) { /* nothing to do */ };
-  void do_BlockBegin     (BlockBegin*      x) { /* nothing to do */ };
-  void do_Goto           (Goto*            x) { /* nothing to do */ };
-  void do_If             (If*              x) { /* nothing to do */ };
-  void do_IfInstanceOf   (IfInstanceOf*    x) { /* nothing to do */ };
-  void do_TableSwitch    (TableSwitch*     x) { /* nothing to do */ };
-  void do_LookupSwitch   (LookupSwitch*    x) { /* nothing to do */ };
-  void do_Return         (Return*          x) { /* nothing to do */ };
-  void do_Throw          (Throw*           x) { /* nothing to do */ };
-  void do_Base           (Base*            x) { /* nothing to do */ };
-  void do_OsrEntry       (OsrEntry*        x) { /* nothing to do */ };
-  void do_ExceptionObject(ExceptionObject* x) { /* nothing to do */ };
-  void do_RoundFP        (RoundFP*         x) { /* nothing to do */ };
-  void do_UnsafeGetRaw   (UnsafeGetRaw*    x) { /* nothing to do */ };
-  void do_UnsafeGetObject(UnsafeGetObject* x) { /* nothing to do */ };
-  void do_UnsafePrefetchRead (UnsafePrefetchRead*  x) { /* nothing to do */ };
-  void do_UnsafePrefetchWrite(UnsafePrefetchWrite* x) { /* nothing to do */ };
-  void do_ProfileCall    (ProfileCall*     x) { /* nothing to do */ };
-  void do_ProfileCounter (ProfileCounter*  x) { /* nothing to do */ };
+  void do_Phi            (Phi*             x) { /* nothing to do */ }
+  void do_Local          (Local*           x) { /* nothing to do */ }
+  void do_Constant       (Constant*        x) { /* nothing to do */ }
+  void do_LoadField      (LoadField*       x) {
+    if (!x->is_initialized()) {
+      kill_memory();
+    }
+  }
+  void do_ArrayLength    (ArrayLength*     x) { /* nothing to do */ }
+  void do_LoadIndexed    (LoadIndexed*     x) { /* nothing to do */ }
+  void do_NegateOp       (NegateOp*        x) { /* nothing to do */ }
+  void do_ArithmeticOp   (ArithmeticOp*    x) { /* nothing to do */ }
+  void do_ShiftOp        (ShiftOp*         x) { /* nothing to do */ }
+  void do_LogicOp        (LogicOp*         x) { /* nothing to do */ }
+  void do_CompareOp      (CompareOp*       x) { /* nothing to do */ }
+  void do_IfOp           (IfOp*            x) { /* nothing to do */ }
+  void do_Convert        (Convert*         x) { /* nothing to do */ }
+  void do_NullCheck      (NullCheck*       x) { /* nothing to do */ }
+  void do_NewInstance    (NewInstance*     x) { /* nothing to do */ }
+  void do_NewTypeArray   (NewTypeArray*    x) { /* nothing to do */ }
+  void do_NewObjectArray (NewObjectArray*  x) { /* nothing to do */ }
+  void do_NewMultiArray  (NewMultiArray*   x) { /* nothing to do */ }
+  void do_CheckCast      (CheckCast*       x) { /* nothing to do */ }
+  void do_InstanceOf     (InstanceOf*      x) { /* nothing to do */ }
+  void do_BlockBegin     (BlockBegin*      x) { /* nothing to do */ }
+  void do_Goto           (Goto*            x) { /* nothing to do */ }
+  void do_If             (If*              x) { /* nothing to do */ }
+  void do_IfInstanceOf   (IfInstanceOf*    x) { /* nothing to do */ }
+  void do_TableSwitch    (TableSwitch*     x) { /* nothing to do */ }
+  void do_LookupSwitch   (LookupSwitch*    x) { /* nothing to do */ }
+  void do_Return         (Return*          x) { /* nothing to do */ }
+  void do_Throw          (Throw*           x) { /* nothing to do */ }
+  void do_Base           (Base*            x) { /* nothing to do */ }
+  void do_OsrEntry       (OsrEntry*        x) { /* nothing to do */ }
+  void do_ExceptionObject(ExceptionObject* x) { /* nothing to do */ }
+  void do_RoundFP        (RoundFP*         x) { /* nothing to do */ }
+  void do_UnsafeGetRaw   (UnsafeGetRaw*    x) { /* nothing to do */ }
+  void do_UnsafeGetObject(UnsafeGetObject* x) { /* nothing to do */ }
+  void do_UnsafePrefetchRead (UnsafePrefetchRead*  x) { /* nothing to do */ }
+  void do_UnsafePrefetchWrite(UnsafePrefetchWrite* x) { /* nothing to do */ }
+  void do_ProfileCall    (ProfileCall*     x) { /* nothing to do */ }
+  void do_ProfileCounter (ProfileCounter*  x) { /* nothing to do */ }
+};
+
+
+class ValueNumberingEffects: public ValueNumberingVisitor {
+ private:
+  ValueMap*     _map;
+
+ public:
+  // implementation for abstract methods of ValueNumberingVisitor
+  void          kill_memory()                    { _map->kill_memory(); }
+  void          kill_field(ciField* field)       { _map->kill_field(field); }
+  void          kill_array(ValueType* type)      { _map->kill_array(type); }
+
+  ValueNumberingEffects(ValueMap* map): _map(map) {}
 };