Uh oh!
There was an error while loading. Please reload this page.
gh-107265: Fix initialize/remove_tools for ENTER_EXECUTOR case - #108482
Conversation
corona10
commented
Aug 25, 2023
@gvanrossum |
gvanrossum
left a comment
There was a problem hiding this comment.
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.
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.
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.
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; | ||
| int opcode = *opcode_ptr; | ||
| assert(opcode != ENTER_EXECUTOR); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
This is also correct, provided the assertion assert(PY_MONITORING_IS_INSTRUMENTED_EVENT(event)) is true.
There was a problem hiding this comment.
Hmm, it will guarantee that the opcode is not ENTER_EXECUTOR?
| else if (opcode == INSTRUMENTED_LINE) { | ||
| opcode = code->_co_monitoring->lines[i].original_opcode; | ||
| } | ||
| assert(opcode != ENTER_EXECUTOR); |
There was a problem hiding this comment.
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.
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.