8000 GH-122548: Implement branch taken and not taken events for sys.monitoring by markshannon · Pull Request #122564 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

GH-122548: Implement branch taken and not taken events for sys.monitoring #122564

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

Merged
merged 13 commits into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Tidy up test for conditional opcodes
  • Loading branch information
markshannon committed Dec 19, 2024
commit 0258694d2509ddb87e5fb94946cfc7790a880faa
6 changes: 6 additions & 0 deletions Include/internal/pycore_opcode_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ extern "C" {
(opcode) == JUMP_BACKWARD || \
(opcode) == JUMP_BACKWARD_NO_INTERRUPT)

#define IS_CONDITIONAL_JUMP_OPCODE(opcode) \
((opcode) == POP_JUMP_IF_FALSE || \
(opcode) == POP_JUMP_IF_TRUE || \
(opcode) == POP_JUMP_IF_NONE || \
(opcode) == POP_JUMP_IF_NOT_NONE)

#define IS_SCOPE_EXIT_OPCODE(opcode) \
((opcode) == RETURN_VALUE || \
(opcode) == RAISE_VARARGS || \
Expand Down
9 changes: 2 additions & 7 deletions Python/codegen.c
Original file line number Diff line number Diff line change
Expand Up @@ -409,13 +409,8 @@ codegen_addop_j(instr_sequence *seq, location loc,
if (_PyInstructionSequence_Addop(seq, opcode, target.id, loc) != SUCCESS) {
return ERROR;
}
switch (opcode) {
case POP_JUMP_IF_FALSE:
case POP_JUMP_IF_TRUE:
case POP_JUMP_IF_NONE:
case POP_JUMP_IF_NOT_NONE:
case FOR_ITER:
return _PyInstructionSequence_Addop(seq, NOT_TAKEN, 0, NO_LOCATION);
if (IS_CONDITIONAL_JUMP_OPCODE(opcode) || opcode == FOR_ITER) {
return _PyInstructionSequence_Addop(seq, NOT_TAKEN, 0, NO_LOCATION);
}
return SUCCESS;
}
Expand Down
0