[pypy-svn] r77574 - pypy/trunk/pypy/jit/tl/spli

afa at codespeak.net afa at codespeak.net
Mon Oct 4 16:19:43 CEST 2010


Author: afa
Date: Mon Oct  4 16:19:42 2010
New Revision: 77574

Modified:
   pypy/trunk/pypy/jit/tl/spli/interpreter.py
Log:
The "spli" interpreter uses the host CPython to create compiled files,
be sure to use the same opcodes to interpret it.
This fixes the tests when run on top of CPython 2.7.


Modified: pypy/trunk/pypy/jit/tl/spli/interpreter.py
==============================================================================
--- pypy/trunk/pypy/jit/tl/spli/interpreter.py	(original)
+++ pypy/trunk/pypy/jit/tl/spli/interpreter.py	Mon Oct  4 16:19:42 2010
@@ -1,12 +1,14 @@
 import os
-from pypy.tool import stdlib_opcode as opcode
+from pypy.tool import stdlib_opcode
 from pypy.jit.tl.spli import objects, pycode
-from pypy.tool.stdlib_opcode import unrolling_opcode_descs
-from pypy.tool.stdlib_opcode import opcode_method_names
 from pypy.rlib.unroll import unrolling_iterable
 from pypy.rlib.jit import JitDriver, hint, dont_look_inside
 from pypy.rlib.objectmodel import we_are_translated
 
+opcode_method_names = stdlib_opcode.host_bytecode_spec.method_names
+unrolling_opcode_descs = unrolling_iterable(
+    stdlib_opcode.host_bytecode_spec.ordered_opdescs)
+HAVE_ARGUMENT = stdlib_opcode.host_HAVE_ARGUMENT
 
 compare_ops = [
     "cmp_lt",   # "<"
@@ -79,7 +81,7 @@
             self.stack_depth = hint(self.stack_depth, promote=True)
             op = ord(code[instr_index])
             instr_index += 1
-            if op >= opcode.HAVE_ARGUMENT:
+            if op >= HAVE_ARGUMENT:
                 low = ord(code[instr_index])
                 hi = ord(code[instr_index + 1])
                 oparg = (hi << 8) | low
@@ -183,6 +185,12 @@
             next_instr += arg
         return next_instr
 
+    def POP_JUMP_IF_FALSE(self, arg, next_instr, code):
+        w_cond = self.pop()
+        if not w_cond.is_true():
+            next_instr = arg
+        return next_instr
+
     def JUMP_FORWARD(self, arg, next_instr, code):
         return next_instr + arg
 



More information about the Pypy-commit mailing list