Author: Ronan Lamy <[email protected]>
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)
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit