Repository navigation
gh-157875: Fix a reference leak when rewinding JIT traces #157888
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| Fix a reference leak in the JIT when a trace is rewound after encountering | ||
| unsupported bytecode. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe just say when tracing is rewound? I think this get's triggered for standard supported JIT traces hit natural endings such as jumps
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems too detailed. We can ask others?👀 |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -789,6 +789,9 @@ _PyJit_translate_single_bytecode_to_trace( | |
| { | ||
| _PyUOpInstruction *curr = uop_buffer_last(trace); | ||
| while (curr->opcode != _SET_IP && uop_buffer_length(trace) > 2) { | ||
| if (_PyUop_Flags[curr->opcode] & HAS_RECORDS_VALUE_FLAG) { | ||
| Py_XDECREF((PyObject *)(uintptr_t)curr->operand0); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we now have a very similar pattern three times in this file, maybe worth seeing if it's worth to make it a common operation
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it would be better to focus on the bug fix scope of this PR. However, currently the JIT has been suspended and only bug fixes are accepted |
||
| } | ||
| trace->next--; | ||
| curr = uop_buffer_last(trace); | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this test assert that the rewinding happened? Or would that make the test too brittle?