[SOT] Always generate false_fn
when POP_JUMP_*
breakgraph
#62424
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR types
Others
PR changes
Others
Description
Python 3.12 单测引申问题,当
POP_JUMP_*
breakgraph 时,false_fn
不存在时不可以直接gen_return
,虽然结果可能正确,但其实是未定义行为,debug 版 Python 会直接挂掉单测
jump_if_false_or_pop
3.8 原始字节码如下:
3.12 原始字节码如下:
3.8 原始字节码是
JUMP_IF_FALSE_OR_POP
,因此生成的「跳转分支」可以直接RETURN_VALUE
,因为该分支没有 pop,栈上是保留结果的,RETURN_VALUE
没问题3.12 原始字节码变成了
POP_JUMP_IF_FALSE
,跳转目标仍然是RETURN_VALUE
,但是提前COPY
将栈上变量 x2 了,这样生成的分支当然不能直接RETURN_VALUE
,仍然需要将变量 load 到栈上等操作Pcard-67164