Skip to content

gh-105481: add OPCODE_IS_INSTRUMENTED (generated from bytecodes.c) to replace MIN_INSTRUMENTED_OPCODE (defined in opcode.py) #107276

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

Closed
wants to merge 4 commits into from

Conversation

iritkatriel
Copy link
Member

@iritkatriel iritkatriel commented Jul 25, 2023

….c) to replace MIN_INSTRUMENTED_OPCODE (defined in opcode.py)
@@ -283,7 +283,8 @@ def write_metadata(self, metadata_filename: str, pymetadata_filename: str) -> No
self.out.emit(
"#define IS_VALID_OPCODE(OP) \\\n"
" (((OP) >= 0) && ((OP) < OPCODE_METADATA_SIZE) && \\\n"
" (_PyOpcode_opcode_metadata[(OP)].valid_entry))"
" (_PyOpcode_opcode_metadata[(OP)].valid_entry)) || \\\n"
" ((OP) == INSTRUMENTED_LINE)" # implemented in ceval.c, not bytecodes.c
Copy link
Member Author

@iritkatriel iritkatriel Jul 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to special-case INSTRUMENTED_LINE because it's implemented in ceval.c rather than bytecodes.c, so doesn't appear in the metadata. We could instead do something else like add it to the instr list after bytecode.c is parsed. I'm not sure which option is less bad.

@iritkatriel iritkatriel marked this pull request as draft July 26, 2023 15:42
@iritkatriel
Copy link
Member Author

After speaking to @markshannon I decided not to add this metadata but to generate MIN_INSTRUMENTED_OPCODE to replicate what we have now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants