Serhiy Storchaka <[email protected]> added the comment:
1. This will actually simplify the code for calculating the stack size. Instead
of supporting special cases for jumping instructions in stackdepth_walk() you
could just write something like
new_depth = depth + PyCompile_OpcodeStackEffectEx(opcode, oparg, 0);
if (new_depth > maxdepth)
maxdepth = new_depth;
if (isjump) {
target_depth = depth + PyCompile_OpcodeStackEffectEx(opcode, oparg, 1);
maxdepth = stackdepth_walk(c, instr->i_target, target_depth, maxdepth);
}
depth = new_depth;
After adding new opcodes or changing existing opcodes you would need to change
the code only in one place.
2. This will simplify third-party compilers (like
https://github.com/vstinner/bytecode). They wouldn't need to duplicate the
complicated code.
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue32455>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com