[pypy-commit] pypy jit-leaner-frontend: fix actual bugs, thank you hypothesis

fijal pypy.commits at gmail.com
Fri Mar 4 11:07:27 EST 2016


Author: fijal
Branch: jit-leaner-frontend
Changeset: r82771:80df6e4dfd56
Date: 2016-03-04 18:06 +0200
http://bitbucket.org/pypy/pypy/changeset/80df6e4dfd56/

Log:	fix actual bugs, thank you hypothesis

diff --git a/rpython/jit/metainterp/opencoder.py b/rpython/jit/metainterp/opencoder.py
--- a/rpython/jit/metainterp/opencoder.py
+++ b/rpython/jit/metainterp/opencoder.py
@@ -134,7 +134,7 @@
 
     def _encode(self, box):
         if isinstance(box, Const):
-            if isinstance(box, ConstInt) and box.getint() < MAXINT:
+            if isinstance(box, ConstInt) and 0 <= box.getint() < MAXINT:
                 return tag(TAGINT, box.getint())
             else:
                 self._consts.append(box)
@@ -148,7 +148,7 @@
 
     def _record_op(self, opnum, argboxes, descr=None):
         operations = self._ops
-        pos = len(operations)
+        pos = self._count
         operations.append(opnum)
         if oparity[opnum] == -1:
             operations.append(len(argboxes))
@@ -163,7 +163,7 @@
 
     def _record_raw(self, opnum, tagged_args, tagged_descr=-1):
         operations = self._ops
-        pos = len(operations)
+        pos = self._count
         operations.append(opnum)
         if oparity[opnum] == -1:
             operations.append(len(tagged_args))
@@ -179,9 +179,9 @@
         self._descrs.append(descr)
         return len(self._descrs) - 1
 
-    def record_forwarding(self, op, newtag):
-        index = op._pos
-        self._ops[index] = -newtag - 1
+#    def record_forwarding(self, op, newtag):
+#        index = op._pos
+#        self._ops[index] = -newtag - 1
 
     def record_snapshot_link(self, pos):
         self._ops.append(-pos - 1)
diff --git a/rpython/jit/metainterp/test/test_opencoder.py b/rpython/jit/metainterp/test/test_opencoder.py
--- a/rpython/jit/metainterp/test/test_opencoder.py
+++ b/rpython/jit/metainterp/test/test_opencoder.py
@@ -118,7 +118,8 @@
         inputargs, ops = lst
         t = Trace(inputargs)
         for op in ops:
-            t.record_op(op.getopnum(), op.getarglist())
+            newop = t.record_op(op.getopnum(), op.getarglist())
+            op.position = newop.position
         inpargs, l, iter = self.unpack(t)
         loop1 = TreeLoop("loop1")
         loop1.inputargs = inputargs
@@ -126,4 +127,5 @@
         loop2 = TreeLoop("loop2")
         loop2.inputargs = inpargs
         loop2.operations = l
-        BaseTest.assert_equal(loop1, loop2)
\ No newline at end of file
+        BaseTest.assert_equal(loop1, loop2)
+        print "success"
\ No newline at end of file


More information about the pypy-commit mailing list