[pypy-svn] r65930 - pypy/branch/pyjitpl5/pypy/jit/tl/spli

benjamin at codespeak.net benjamin at codespeak.net
Wed Jun 24 20:53:46 CEST 2009


Author: benjamin
Date: Wed Jun 24 20:53:44 2009
New Revision: 65930

Modified:
   pypy/branch/pyjitpl5/pypy/jit/tl/spli/interpreter.py
Log:
use faster opcode dispatch for tests

Modified: pypy/branch/pyjitpl5/pypy/jit/tl/spli/interpreter.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/tl/spli/interpreter.py	(original)
+++ pypy/branch/pyjitpl5/pypy/jit/tl/spli/interpreter.py	Wed Jun 24 20:53:44 2009
@@ -4,6 +4,7 @@
 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.objectmodel import we_are_translated
 
 import dis
 
@@ -35,7 +36,7 @@
     frame = SPLIFrame(pyco)
     for i, arg in enumerate(args):
         frame.locals[i] = space.wrap(arg)
-    return frame.run()    
+    return frame.run()
 
 class BlockUnroller(Exception):
     pass
@@ -75,13 +76,17 @@
                 instr_index += 2
             else:
                 oparg = 0
-            for opdesc in unrolling_opcode_descs:
-                if op == opdesc.index:
-                    meth = getattr(self, opdesc.methodname)
-                    instr_index = meth(oparg, instr_index)
-                    break
+            if we_are_translated():
+                for opdesc in unrolling_opcode_descs:
+                    if op == opdesc.index:
+                        meth = getattr(self, opdesc.methodname)
+                        instr_index = meth(oparg, instr_index)
+                        break
+                else:
+                    raise MissingOpcode(op)
             else:
-                raise MissingOpcode(op)
+                meth = getattr(self, opcode_method_names[op])
+                instr_index = meth(oparg, instr_index)
 
     def push(self, value):
         self.value_stack[self.stack_depth] = value



More information about the Pypy-commit mailing list