Now NO push or pop instructions here, and the weird jump instructions of Python like JUMP_IF_TRUE_OR_POP are translated into JmpIf and Phi, instead of using the magic of stack machine.
When there is no exception handling, only 10 instructions are sufficient to express Python virtual machine:
data App(Instr) f:Repr args:t.List[Repr];
data Ass(Instr) reg:Reg val:Repr;
data Load(Instr) reg:Reg;
data Store(Instr) reg:Reg val:Repr;
data JmpIf(Instr) label:object cond:Repr;
data Jmp(Instr) label:object;
data Label(Instr) label:object phi:t.Dict[object,t.Dict[Reg, Repr]];
data Return(Instr) val:Repr;
data PyGlob(Instr) qual:str name:str;
data CyGlob(Instr) qual:str name:str;
The use of stack machine is removed now for the Cython back end(does not support Python's exception handling instructions yet).
produces
Now NO push or pop instructions here, and the weird jump instructions of Python like
JUMP_IF_TRUE_OR_POP
are translated intoJmpIf
andPhi
, instead of using the magic of stack machine.When there is no exception handling, only 10 instructions are sufficient to express Python virtual machine: