Exemplo n.º 1
0
 def dispatch(self, code):
     opcode = self.nextbyte(code)
     if argwidth(opcode) == 2:
         oparg = self.nextshort(code)
     elif argwidth(opcode) == 1:
         oparg = self.nextbyte(code)
     else:
         oparg = 0
     for someop, somemethod in unrolled_handlers:
         if someop == opcode:
             somemethod(self, oparg)
             break
Exemplo n.º 2
0
 def dispatch(self, code):
     opcode = self.nextbyte(code)
     if argwidth(opcode) == 2:
         oparg = self.nextshort(code)
     elif argwidth(opcode) == 1:
         oparg = self.nextbyte(code)
     else:
         oparg = 0
     for someop, somemethod in unrolled_handlers:
         if someop == opcode:
             somemethod(self, oparg)
             break
Exemplo n.º 3
0
def dis_once(pc, code):
    opcode = ord(code[pc])
    width = argwidth(opcode)
    if width == 0:
        arg = ''
    elif width == 1:
        arg = str(ord(code[pc + 1]))
    else:
        assert width == 2
        arg = str(ord(code[pc + 1]) | (ord(code[pc + 2]) << 8))
    return width, '%s:%s(%s)' % (pc, codenames[opcode], arg)