2016-02-05 21:35 GMT+01:00 Serhiy Storchaka <storchaka@gmail.com>:
LGTM. I did have the same idea when added specialized 8-bit opcodes.

Some optimization (like constant folding) it is worth to move yet one step earlier, to AST.

In fact. In WPython I moved all constant folding to the ASDL.
 
Other idea - instead of EXTENDED_ARG have two sets of instructions: short 16-bit with 8-bit arg, and long 32-bit with 24-bit arg. For simplicity initially only long instructions are emitted (if it makes sense).

Don't do it with all instructions, but only with the jump ones, which are the only susceptible of such changes. In all other cases you already know the size of the argument, which will not change.

Regards,
Cesare