Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork34k
gh-111786: Use separate opcode vars for Tier 1 and Tier 2#112289
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
Uh oh!
There was an error while loading.Please reload this page.
Merged
Changes fromall commits
Commits
Show all changes
2 commits Select commitHold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -689,7 +689,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int | ||
| #ifdef Py_STATS | ||
| int lastopcode = 0; | ||
| #endif | ||
| uint8_t opcode; /* Current opcode */ | ||
| int oparg; /* Current opcode argument, if any */ | ||
| #ifdef LLTRACE | ||
| int lltrace = 0; | ||
| @@ -776,9 +776,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int | ||
| /* Start instructions */ | ||
| #if !USE_COMPUTED_GOTOS | ||
| dispatch_opcode: | ||
| switch (opcode) | ||
| #endif | ||
| { | ||
| @@ -822,7 +820,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int | ||
| #if USE_COMPUTED_GOTOS | ||
| _unknown_opcode: | ||
| #else | ||
| EXTRA_CASES // Frompycore_opcode_metadata.h, a 'case' for each unused opcode | ||
gvanrossum marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| #endif | ||
| /* Tell C compilers not to hold the opcode variable in the loop. | ||
| next_instr points the current instruction without TARGET(). */ | ||
| @@ -994,28 +992,29 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int | ||
| OPT_STAT_INC(traces_executed); | ||
| _PyUOpInstruction *next_uop = current_executor->trace; | ||
| uint16_t uopcode; | ||
| #ifdef Py_STATS | ||
| uint64_t trace_uop_execution_counter = 0; | ||
| #endif | ||
| for (;;) { | ||
| uopcode = next_uop->opcode; | ||
| DPRINTF(3, | ||
| "%4d: uop %s, oparg %d, operand %" PRIu64 ", target %d, stack_level %d\n", | ||
| (int)(next_uop - current_executor->trace), | ||
| _PyUopName(uopcode), | ||
| next_uop->oparg, | ||
| next_uop->operand, | ||
| next_uop->target, | ||
| (int)(stack_pointer - _PyFrame_Stackbase(frame))); | ||
| next_uop++; | ||
| OPT_STAT_INC(uops_executed); | ||
| UOP_STAT_INC(uopcode, execution_count); | ||
| #ifdef Py_STATS | ||
| trace_uop_execution_counter++; | ||
| #endif | ||
| switch (uopcode) { | ||
| #include "executor_cases.c.h" | ||
| @@ -1053,7 +1052,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int | ||
| STACK_SHRINK(1); | ||
| error_tier_two: | ||
| DPRINTF(2, "Error: [Uop %d (%s), oparg %d, operand %" PRIu64 ", target %d @ %d]\n", | ||
| uopcode, _PyUopName(uopcode), next_uop[-1].oparg, next_uop[-1].operand, next_uop[-1].target, | ||
| (int)(next_uop - current_executor->trace - 1)); | ||
| OPT_HIST(trace_uop_execution_counter, trace_run_length_hist); | ||
| frame->return_offset = 0; // Don't leave this random | ||
| @@ -1066,10 +1065,10 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int | ||
| // On DEOPT_IF we just repeat the last instruction. | ||
| // This presumes nothing was popped from the stack (nor pushed). | ||
| DPRINTF(2, "DEOPT: [Uop %d (%s), oparg %d, operand %" PRIu64 ", target %d @ %d]\n", | ||
| uopcode, _PyUopName(uopcode), next_uop[-1].oparg, next_uop[-1].operand, next_uop[-1].target, | ||
| (int)(next_uop - current_executor->trace - 1)); | ||
| OPT_HIST(trace_uop_execution_counter, trace_run_length_hist); | ||
| UOP_STAT_INC(uopcode, miss); | ||
| frame->return_offset = 0; // Dispatch to frame->instr_ptr | ||
| _PyFrame_SetStackPointer(frame, stack_pointer); | ||
| frame->instr_ptr = next_uop[-1].target + _PyCode_CODE(_PyFrame_GetCode(frame)); | ||
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.