Redundant stack spills on subsequent escaping calls separated by comments
未关闭
还没有人认领这个 Issue。
interpreter-core
type-bug
- 主要语言
- Python
- 星标
- 77.2k
- 派生
- 36k
- PR 合并指标
- PR 指标待抓取
描述
Bug report
Bug description:
Tier 1 case generator emits stack spill for every subsequent escaping call, when subsequent escaping calls are separated by comment(s). Example:
Subsequent escaping calls without comments in between:
Bytecode definition:
pure inst(NOP, (--)) {
escaping_call1();
escaping_call2();
escaping_call3();
}
Generated case:
TARGET(NOP) {
frame->instr_ptr = next_instr;
next_instr += 1;
INSTRUCTION_STATS(NOP);
_PyFrame_SetStackPointer(frame, stack_pointer);
escaping_call1();
escaping_call2();
escaping_call3();
stack_pointer = _PyFrame_GetStackPointer(frame);
DISPATCH();
}
Subsequent escaping calls with comments in between:
Bytecode definition:
pure inst(NOP, (--)) {
escaping_call1();
// comment1
escaping_call2();
// comment2
escaping_call3();
}
Generated case:
TARGET(NOP) {
frame->instr_ptr = next_instr;
next_instr += 1;
INSTRUCTION_STATS(NOP);
_PyFrame_SetStackPointer(frame, stack_pointer);
escaping_call1();
stack_pointer = _PyFrame_GetStackPointer(frame);
// comment1
_PyFrame_SetStackPointer(frame, stack_pointer);
escaping_call2();
stack_pointer = _PyFrame_GetStackPointer(frame);
// comment2
_PyFrame_SetStackPointer(frame, stack_pointer);
escaping_call3();
stack_pointer = _PyFrame_GetStackPointer(frame);
DISPATCH();
}
CPython versions tested on:
CPython main branch
Operating systems tested on:
No response
Linked PRs
- gh-128761
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
先从报告中展示的 Tier 1 case generator 和 bytecode definition 开始,然后查看链接的 PR gh-128761 以了解当前工作。使用位于 escaping 调用之间的注释重现这些示例,并验证生成的 case 只发出必要的 stack-pointer 操作。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- c, python
- 领域
- compilers
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 25/100