Skip to content

Commit

Permalink
Fix some incorrect indentation around the main switch (#98177)
Browse files Browse the repository at this point in the history
The `}` marked with `/* End instructions */` is the end of the switch.
There is another pair of `{}` around the switch, which is vestigial
from ancient times when it was `for (;;) { switch (opcode) { ... } }`.
All `DISPATCH` macro calls should be inside that pair.
  • Loading branch information
gvanrossum authored Oct 11, 2022
1 parent 5ecf961 commit f5d7107
Showing 1 changed file with 20 additions and 21 deletions.
41 changes: 20 additions & 21 deletions Python/ceval.c
Original file line number Diff line number Diff line change
Expand Up @@ -1152,12 +1152,11 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int

{
/* Start instructions */
#if USE_COMPUTED_GOTOS
{
#else
#if !USE_COMPUTED_GOTOS
dispatch_opcode:
switch (opcode) {
switch (opcode)
#endif
{

/* BEWARE!
It is essential that any operation that fails must goto error
Expand Down Expand Up @@ -5102,23 +5101,23 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int
/* Specialization misses */

miss:
{
STAT_INC(opcode, miss);
opcode = _PyOpcode_Deopt[opcode];
STAT_INC(opcode, miss);
/* The counter is always the first cache entry: */
_Py_CODEUNIT *counter = (_Py_CODEUNIT *)next_instr;
*counter -= 1;
if (*counter == 0) {
int adaptive_opcode = _PyOpcode_Adaptive[opcode];
assert(adaptive_opcode);
_Py_SET_OPCODE(next_instr[-1], adaptive_opcode);
STAT_INC(opcode, deopt);
*counter = adaptive_counter_start();
}
next_instr--;
DISPATCH_GOTO();
}
{
STAT_INC(opcode, miss);
opcode = _PyOpcode_Deopt[opcode];
STAT_INC(opcode, miss);
/* The counter is always the first cache entry: */
_Py_CODEUNIT *counter = (_Py_CODEUNIT *)next_instr;
*counter -= 1;
if (*counter == 0) {
int adaptive_opcode = _PyOpcode_Adaptive[opcode];
assert(adaptive_opcode);
_Py_SET_OPCODE(next_instr[-1], adaptive_opcode);
STAT_INC(opcode, deopt);
*counter = adaptive_counter_start();
}
next_instr--;
DISPATCH_GOTO();
}

unbound_local_error:
{
Expand Down

0 comments on commit f5d7107

Please sign in to comment.