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-116422: Tier2 hot/cold splitting#116813
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
9a4879db6b642620a7afe801062d53b90bcaecdfc2d365f58814d0fc97428fa3c2154fa74756d817a590197abba9d0d03c79ec8ef1dc120770b0ff59cfa21296941bec19a18a7ab86e2fa5d14b5217c1243ba2053c4869bb32493371a2cae3f5dc4d6644e66151db6a37627d3File 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 |
|---|---|---|
| @@ -30,16 +30,63 @@ typedef struct{ | ||
| PyCodeObject *code; // Weak (NULL if no corresponding ENTER_EXECUTOR). | ||
| } _PyVMData; | ||
| #define UOP_FORMAT_TARGET 0 | ||
| #define UOP_FORMAT_EXIT 1 | ||
| #define UOP_FORMAT_JUMP 2 | ||
| #define UOP_FORMAT_UNUSED 3 | ||
| /* Depending on the format, | ||
| * the 32 bits between the oparg and operand are: | ||
| * UOP_FORMAT_TARGET: | ||
| * uint32_t target; | ||
| * UOP_FORMAT_EXIT | ||
| * uint16_t exit_index; | ||
| * uint16_t error_target; | ||
| * UOP_FORMAT_JUMP | ||
| * uint16_t jump_target; | ||
| * uint16_t error_target; | ||
| */ | ||
| typedef struct{ | ||
| uint16_t opcode; | ||
| uint16_t opcode:14; | ||
| uint16_t format:2; | ||
| uint16_t oparg; | ||
| union{ | ||
| uint32_t target; | ||
| uint32_t exit_index; | ||
| struct{ | ||
| union{ | ||
| uint16_t exit_index; | ||
| uint16_t jump_target; | ||
| }; | ||
| uint16_t error_target; | ||
| }; | ||
| }; | ||
| uint64_t operand; // A cache entry | ||
| } _PyUOpInstruction; | ||
markshannon marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading. Please reload this page. | ||
| static inline uint32_t uop_get_target(const _PyUOpInstruction *inst) | ||
| { | ||
| assert(inst->format == UOP_FORMAT_TARGET); | ||
| return inst->target; | ||
| } | ||
| static inline uint16_t uop_get_exit_index(const _PyUOpInstruction *inst) | ||
| { | ||
| assert(inst->format == UOP_FORMAT_EXIT); | ||
| return inst->exit_index; | ||
| } | ||
| static inline uint16_t uop_get_jump_target(const _PyUOpInstruction *inst) | ||
| { | ||
| assert(inst->format == UOP_FORMAT_JUMP); | ||
| return inst->jump_target; | ||
| } | ||
| static inline uint16_t uop_get_error_target(const _PyUOpInstruction *inst) | ||
| { | ||
| assert(inst->format != UOP_FORMAT_TARGET); | ||
| return inst->error_target; | ||
| } | ||
| typedef struct _exit_data{ | ||
| uint32_t target; | ||
| int16_t temperature; | ||
Large diffs are not rendered by default.
Uh oh!
There was an error while loading. Please reload this page.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -12,7 +12,7 @@ extern "C"{ | ||
| #include <stdbool.h> | ||
| // This is the length of the trace we project initially. | ||
| #define UOP_MAX_TRACE_LENGTH 512 | ||
| #define UOP_MAX_TRACE_LENGTH 800 | ||
markshannon marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading. Please reload this page. | ||
| #define TRACE_STACK_SIZE 5 | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.
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.
I still think that
formatis a property of the oparg, not the instruction itself. It is never correct to execute an instruction with the wrong format for its oparg, so it feels wrong to provide it separately here and allow them to drift out of sync (which I just spent a lot of time debugging yesterday). Bonus points for not needing a bitfield.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 may never correct to execute an instruction with the wrong format, but this is primarily a format for optimization.
The "target" format is the correct format for all instructions during optimization.
If we care about tier 2 interpreter performance, we will want a different format for execution anyway.
What we could do is use different formats before and after
prepare_for_execution, but I'd rather leave that for another PR.What's wrong with bitfields?