Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34k
gh-107265: Fix initialize/remove_tools for ENTER_EXECUTOR case#108482
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.
Conversation
corona10 commented Aug 25, 2023
@gvanrossum |
gvanrossum left a comment
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.
I don't know this code very well; let's see if @markshannon wants to review it.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
gvanrossum left a comment
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.
LG except formatting/naming nits.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
gvanrossum left a comment
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.
Green light! Thanks so much for powering through these.
bedevere-bot commented Aug 27, 2023
|
markshannon left a comment
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.
All the removed opcode != ENTER_EXECUTOR assertions were correct.
There should never be instrumented ENTER_EXECUTOR instructions.
I think the correct fix is to remove all ENTER_EXECUTOR instructions in _Py_Instrument() prior to calling update_instrumentation_data(), some thing like:
if (code->co_executors->size > 0){// Walk code removing ENTER_EXECUTOR // Clear all executors } | _Py_CODEUNIT*instr=&_PyCode_CODE(code)[i]; | ||
| uint8_t*opcode_ptr=&instr->op.code; | ||
| intopcode=*opcode_ptr; | ||
| assert(opcode!=ENTER_EXECUTOR); |
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.
This assertion is correct. Please don't remove assertions, unless you are really sure that they are incorrect.
ENTER_EXECUTOR should never have associated instrumentation.
corona10Aug 27, 2023 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
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.
It was moved to L574, it will be the same effect no?
| assert(event!=PY_MONITORING_EVENT_LINE); | ||
| assert(event!=PY_MONITORING_EVENT_INSTRUCTION); | ||
| assert(PY_MONITORING_IS_INSTRUMENTED_EVENT(event)); | ||
| assert(opcode_has_event(_Py_GetBaseOpcode(code, offset))); |
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.
This is also correct, provided the assertion assert(PY_MONITORING_IS_INSTRUMENTED_EVENT(event)) is true.
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.
Hmm, it will guarantee that the opcode is not ENTER_EXECUTOR?
| elseif (opcode==INSTRUMENTED_LINE){ | ||
| opcode=code->_co_monitoring->lines[i].original_opcode; | ||
| } | ||
| assert(opcode!=ENTER_EXECUTOR); |
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.
This assert should be moved before the original if (opcode == INSTRUMENTED_LINE){, we shouldn't get here with and ENTER_EXECUTOR present.
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.
Move it to L1310 will be enough?
markshannon commented Aug 27, 2023
Note that it is OK to have instrumented instructions and |
corona10 commented Aug 27, 2023
I will try to apply this approach :) |
…OR case (pythongh-108482)" This reverts commit 6cb48f0.
Uh oh!
There was an error while loading. Please reload this page.