Author: Ronan Lamy <[email protected]>
Branch: framestate
Changeset: r74664:34072670478e
Date: 2013-05-02 15:29 +0100
http://bitbucket.org/pypy/pypy/changeset/34072670478e/
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
@@ -109,7 +109,7 @@
if opnum in opcode.hasjrel:
oparg += next_offset
try:
- op = BCInstruction.num2op[opnum](oparg, offset)
+ op = BCInstruction.num2op[opnum].decode(oparg, offset, self)
except KeyError:
op = BCInstruction(opnum, oparg, offset)
return next_offset, op
@@ -133,6 +133,10 @@
self.arg = arg
self.offset = offset
+ @classmethod
+ def decode(cls, arg, offset, code):
+ return cls(arg, offset)
+
def eval(self, ctx):
return getattr(ctx, self.name)(self.arg)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit