Commits

Ronan Lamy  committed a436f69

Add hook to customize opcode decoding

  • Participants
  • Parent commits 612e872
  • Branches Opcode-class

Comments (0)

Files changed (1)

File rpython/flowspace/bytecode.py

         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
         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)