mirror of
https://github.com/zrax/pycdc.git
synced 2026-06-23 11:34:07 +00:00
Python 3.11 compiles 'while cond:' with a bottom test: an entry guard (eval cond; POP_JUMP_FORWARD_IF_FALSE end) before the body, and a back-edge (eval cond; POP_JUMP_BACKWARD_IF_TRUE loop_start) at the end. pycdc rendered both halves as separate 'if' blocks, so EVERY while loop came out as 'if cond: ... if not cond: pass' and never looped. - New ScanWhileLoops pre-pass pairs each conditional backward jump with the forward guard immediately preceding its target (guard skipping to the instruction after the back-edge) to identify genuine while loops. - At the guard, open a BLK_WHILE with the condition instead of an if. - At the back-edge, discard the duplicated condition and close the loop, but only when a BLK_WHILE is actually open (guard against a misidentified back-edge collapsing the block stack and crashing). Fixes while loops across all files (including nested loops and continue). decompilation target: 237/239 files, corpus 41/95 (+1: signature; 0 regressions). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| 4.3.3 | ||
| check.dir | ||
| pycdas.dir | ||
| pycdc.dir | ||
| pycxx.dir | ||
| cmake.check_cache | ||
| CMakeConfigureLog.yaml | ||
| CMakeDirectoryInformation.cmake | ||
| CMakeRuleHashes.txt | ||
| InstallScripts.json | ||
| Makefile.cmake | ||
| Makefile2 | ||
| progress.marks | ||
| TargetDirectories.txt | ||