[pypy-svn] r13023 - pypy/branch/pypy-translation-snapshot/interpreter

pedronis at codespeak.net pedronis at codespeak.net
Thu Jun 2 23:25:23 CEST 2005


Author: pedronis
Date: Thu Jun  2 23:25:23 2005
New Revision: 13023

Modified:
   pypy/branch/pypy-translation-snapshot/interpreter/pyopcode.py
Log:
merge MISSING_OPCODE_W_ARG addition



Modified: pypy/branch/pypy-translation-snapshot/interpreter/pyopcode.py
==============================================================================
--- pypy/branch/pypy-translation-snapshot/interpreter/pyopcode.py	(original)
+++ pypy/branch/pypy-translation-snapshot/interpreter/pyopcode.py	Thu Jun  2 23:25:23 2005
@@ -692,7 +692,10 @@
             raise pyframe.BytecodeCorruption            
         fn(f, oparg)
 
-    def MISSING_OPCODE(f, oparg=-1):
+    def MISSING_OPCODE(f):
+        raise pyframe.BytecodeCorruption, "unknown opcode"
+
+    def MISSING_OPCODE_W_ARG(f, oparg):
         raise pyframe.BytecodeCorruption, "unknown opcode"
 
     ### dispatch_table ###
@@ -709,10 +712,11 @@
         opcode_has_arg = []
         dispatch_table_no_arg = []
         dispatch_table_w_arg = []
-        missing_opcode = cls.MISSING_OPCODE
+        missing_opcode = cls.MISSING_OPCODE.im_func
+        missing_opcode_w_arg = cls.MISSING_OPCODE_W_ARG.im_func
         for i in range(256):
             opname = dis.opname[i].replace('+', '_')
-            fn = getattr(cls, opname, missing_opcode)
+            fn = getattr(cls, opname, None)
             fn = getattr(fn, 'im_func',fn)
             has_arg = i >= dis.HAVE_ARGUMENT
             #if fn is missing_opcode and not opname.startswith('<') and i>0:
@@ -720,9 +724,11 @@
             #    warnings.warn("* Warning, missing opcode %s" % opname)
             opcode_has_arg.append(has_arg)
             if has_arg:
+                fn = fn or missing_opcode_w_arg
                 dispatch_table_w_arg.append(fn)
                 dispatch_table_no_arg.append(None)
             else:
+                fn = fn or missing_opcode
                 dispatch_table_no_arg.append(fn)
                 dispatch_table_w_arg.append(None)
 



More information about the Pypy-commit mailing list