Message309452
| Author |
serhiy.storchaka |
| Recipients |
benjamin.peterson, eric.snow, larry, ncoghlan, serhiy.storchaka |
| Date |
2018年01月04日.00:57:30 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1515027450.87.0.467229070634.issue32455@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
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. |
|