Commits

Maciej Fijalkowski committed 026b0ff

fix hashing

Comments (0)

Files changed (3)

pypy/jit/metainterp/optimizeopt/pure.py

         self.emitted_pure_operations = []
 
     def optimize_default(self, op):
+        orig_op = op
         op = self.getforwarded(op)
         canfold = op.is_always_pure()
         if op.is_ovf():
                 return
 
             # did we do the exact same operation already?
-            oldop = self.pure_operations.get(op)
+            oldop = self.pure_operations.get(orig_op)
             if oldop is not None:
-                self.replace(op, oldop)
+                self.optimizer.replace(op, oldop)
                 return
             else:
-                self.pure_operations.set(op, op)
+                self.pure_operations.set(orig_op, op)
                 self.remember_emitting_pure(op)
 
         # otherwise, the operation remains

pypy/jit/metainterp/optimizeopt/test/test_optimizebasic.py

         ops = """
         [i0]
         i1 = int_is_true(i0)
-        guard_true(i1) []
+        guard_true(i1)
         i2 = int_is_true(i0)
-        guard_true(i2) []
+        guard_true(i2)
         jump(i0)
         """
         expected = """
         [i0]
         i1 = int_is_true(i0)
-        guard_true(i1) []
+        guard_true(i1)
         jump(i0)
         """
         self.optimize_loop(ops, expected)

pypy/jit/metainterp/optmodel.py

 from pypy.jit.metainterp.resoperation import opclasses, opclasses_mutable, rop,\
      INT, REF, ConstInt, Const
 from pypy.jit.metainterp.optimizeopt.intutils import ImmutableIntUnbounded,\
-     ConstantIntBound
+     ConstantIntBound, IntBound
 
 class __extend__(ConstInt):
     def getintbound(self):
         return False
 
     def int_is_nonnull(self):
-        xxx
+        intbound = self.getintbound()
+        if intbound is not None:
+            if intbound.known_gt(IntBound(0, 0)) or \
+               intbound.known_lt(IntBound(0, 0)):
+                return True
+            return False
+        return False
 
     def ref_is_null(self):
         return False
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.