Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 35.2k
gh-137838: Fix JIT trace buffer overrun by increasing possible exit stubs#138177
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
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
31a5157650e55d5d816a2b4aad3ca6fd711917c6f057f6c39ef3c108File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
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 JIT trace buffer overrun by increasing possible exit stubs. | ||
| Patch by Donghee Na. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -591,9 +591,8 @@ translate_bytecode_to_trace( | ||
| for (;;) { | ||
| target = INSTR_IP(instr, code); | ||
| // Need space for _DEOPT | ||
| max_length--; | ||
| // One for possible _DEOPT, one because _CHECK_VALIDITY itself might _DEOPT | ||
| max_length-=2; | ||
Member 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. Needs comment on why 2: | ||
| uint32_t opcode = instr->op.code; | ||
| uint32_t oparg = instr->op.arg; | ||
| @@ -1283,15 +1282,19 @@ uop_optimize( | ||
| _Py_BloomFilter_Init(&dependencies); | ||
| _PyUOpInstruction buffer[UOP_MAX_TRACE_LENGTH]; | ||
| OPT_STAT_INC(attempts); | ||
| char *env_var = Py_GETENV("PYTHON_UOPS_OPTIMIZE"); | ||
| bool is_noopt = true; | ||
| if (env_var == NULL || *env_var == '\0' || *env_var > '0') { | ||
| is_noopt = false; | ||
| } | ||
Comment on lines
+1285
to
+1289
Member 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. Why was this change made? I think the previous code (without the additional variable) made more sense. | ||
| int length = translate_bytecode_to_trace(frame, instr, buffer, UOP_MAX_TRACE_LENGTH, &dependencies, progress_needed); | ||
| if (length <= 0) { | ||
| // Error or nothing translated | ||
| return length; | ||
| } | ||
| assert(length < UOP_MAX_TRACE_LENGTH); | ||
| OPT_STAT_INC(traces_created); | ||
| char *env_var = Py_GETENV("PYTHON_UOPS_OPTIMIZE"); | ||
| if (env_var == NULL || *env_var == '\0' || *env_var > '0') { | ||
| if (!is_noopt) { | ||
| length = _Py_uop_analyze_and_optimize(frame, buffer, | ||
| length, | ||
| curr_stackentries, &dependencies); | ||
Uh oh!
There was an error while loading. Please reload this page.
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.
Wait, why/how does the behavior differ? Sounds like a bug.
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.
Probably should open another issue for this.