Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion Include/internal/pycore_optimizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ typedef struct {
uint8_t oparg;
uint8_t valid;
uint8_t chain_depth; // Must be big enough for MAX_CHAIN_DEPTH - 1.
bool warm;
bool cold;
uint8_t pending_deletion;
int32_t index; // Index of ENTER_EXECUTOR (if code isn't NULL, below).
_PyBloomFilter bloom;
Expand Down
2 changes: 1 addition & 1 deletion Python/bytecodes.c
Original file line number Diff line number Diff line change
Expand Up @@ -5474,7 +5474,7 @@ dummy_func(
}

tier2 op(_MAKE_WARM, (--)) {
current_executor->vm_data.warm = true;
current_executor->vm_data.cold = false;
}

tier2 op(_FATAL_ERROR, (--)) {
Expand Down
8 changes: 4 additions & 4 deletions Python/executor_cases.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions Python/optimizer.c
Original file line number Diff line number Diff line change
Expand Up @@ -1408,9 +1408,9 @@ make_executor_from_uops(_PyThreadStateImpl *tstate, _PyUOpInstruction *buffer, i
#ifdef _Py_JIT
executor->jit_code = NULL;
executor->jit_size = 0;
// This is initialized to true so we can prevent the executor
// This is initialized to false so we can prevent the executor
// from being immediately detected as cold and invalidated.
executor->vm_data.warm = true;
executor->vm_data.cold = false;
if (_PyJIT_Compile(executor, executor->trace, length)) {
Py_DECREF(executor);
return NULL;
Expand Down Expand Up @@ -1698,9 +1698,9 @@ make_cold_executor(uint16_t opcode)
Py_FatalError("Cannot allocate core JIT code");
}
((_PyUOpInstruction *)cold->trace)->opcode = opcode;
// This is initialized to true so we can prevent the executor
// This is initialized to false so we can prevent the executor
// from being immediately detected as cold and invalidated.
cold->vm_data.warm = true;
cold->vm_data.cold = false;
#ifdef _Py_JIT
cold->jit_code = NULL;
cold->jit_size = 0;
Expand Down Expand Up @@ -1895,11 +1895,11 @@ _Py_Executors_InvalidateCold(PyInterpreterState *interp)
assert(exec->vm_data.valid);
_PyExecutorObject *next = exec->vm_data.links.next;

if (!exec->vm_data.warm && PyList_Append(invalidate, (PyObject *)exec) < 0) {
if (exec->vm_data.cold && PyList_Append(invalidate, (PyObject *)exec) < 0) {
goto error;
}
else {
exec->vm_data.warm = false;
exec->vm_data.cold = true;
}

exec = next;
Expand Down
4 changes: 2 additions & 2 deletions Python/pystate.c
Original file line number Diff line number Diff line change
Expand Up @@ -820,15 +820,15 @@ interpreter_clear(PyInterpreterState *interp, PyThreadState *tstate)
if (cold != NULL) {
interp->cold_executor = NULL;
assert(cold->vm_data.valid);
assert(cold->vm_data.warm);
assert(!cold->vm_data.cold);
_PyExecutor_Free(cold);
}

struct _PyExecutorObject *cold_dynamic = interp->cold_dynamic_executor;
if (cold_dynamic != NULL) {
interp->cold_dynamic_executor = NULL;
assert(cold_dynamic->vm_data.valid);
assert(cold_dynamic->vm_data.warm);
assert(!cold_dynamic->vm_data.cold);
_PyExecutor_Free(cold_dynamic);
}
/* We don't clear sysdict and builtins until the end of this function.
Expand Down
Loading