Commits

Hakan Ardo committed 71ffca3

better propataging of interned refs

  • Participants
  • Parent commits a645fff
  • Branches jit-short_from_state

Comments (0)

Files changed (3)

File pypy/jit/metainterp/optimizeopt/optimizer.py

 
         for ref, box in self.interned_refs.items():
             value = self.getvalue(box)
-            if isinstance(value, ConstantValue): # These are the only values surviving without being cloned
-                new.interned_refs[ref] = box
-                new.values[box] = value
+            assert value.is_constant()
+            new.interned_refs[ref] = box
+            new.values[box] = value.get_cloned(new, valuemap)
             
         new.pure_operations = args_dict()
         for key, op in self.pure_operations.items():
 
         for value in valuemap.values():
             box = value.get_key_box()
+            box = new.getinterned(box)
             if box not in new.values:
                 new.values[box] = value
 
         short_boxes = {}
         for box in inputargs:
             short_boxes[box] = None
-        
+
         for box in potential_ops.keys():
             try:
                 self.produce_short_preamble_box(box, short_boxes,

File pypy/jit/metainterp/optimizeopt/unroll.py

             loop.preamble.quasi_immutable_deps = (
                 self.optimizer.quasi_immutable_deps)
             self.optimizer = self.optimizer.reconstruct_for_next_iteration(sb, jump_args)
-
+            
             self.constant_inputargs = {}
             loop.quasi_immutable_deps = self.optimizer.quasi_immutable_deps            
             for box in jump_args:

File pypy/jit/metainterp/test/test_optimizeopt.py

         jump(i3, i4)
         """
         self.optimize_loop(ops, expected)
+
+    def test_constant_getfield(self):
+        ops = """
+        [p1, p187, i184]
+        p188 = getarrayitem_gc(p187, i184, descr=<GcPtrArrayDescr>)
+        guard_value(p188, ConstPtr(myptr)) []
+        p25 = getfield_gc(ConstPtr(myptr), descr=otherdescr)
+        jump(p25, p187, i184)
+        """
+        expected = """
+        [p25, p187, i184]
+        jump(p25, p187, i184)
+        """
+        self.optimize_loop(ops, expected, ops)
+        # FIXME: check jumparg 0 == getfield_gc()