[pypy-commit] pypy Opcode-class: Add hook to customize opcode decoding

rlamy noreply at buildbot.pypy.org
Sat May 4 02:05:44 CEST 2013


Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: Opcode-class
Changeset: r63835:a436f69d22e4
Date: 2013-05-02 15:29 +0100
http://bitbucket.org/pypy/pypy/changeset/a436f69d22e4/

Log:	Add hook to customize opcode decoding

diff --git a/rpython/flowspace/bytecode.py b/rpython/flowspace/bytecode.py
--- a/rpython/flowspace/bytecode.py
+++ b/rpython/flowspace/bytecode.py
@@ -107,7 +107,7 @@
         if opnum in opcode.hasjrel:
             oparg += next_instr
         try:
-            op = Opcode.num2op[opnum](oparg, pos)
+            op = Opcode.num2op[opnum].decode(oparg, pos, self)
         except KeyError:
             op = Opcode(opnum, oparg, pos)
         return next_instr, op
@@ -126,5 +126,9 @@
         self.arg = arg
         self.offset = offset
 
+    @classmethod
+    def decode(cls, arg, offset, code):
+        return cls(arg, offset)
+
     def eval(self, frame):
         return getattr(frame, self.name)(self.arg)


More information about the pypy-commit mailing list