Skip to content

Commit 1be901d

Browse files
committed
global cooling
1 parent 1857a40 commit 1be901d

File tree

5 files changed

+14
-14
lines changed

5 files changed

+14
-14
lines changed

Include/internal/pycore_optimizer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ typedef struct {
2727
uint8_t oparg;
2828
uint8_t valid;
2929
uint8_t chain_depth; // Must be big enough for MAX_CHAIN_DEPTH - 1.
30-
bool warm;
30+
bool cold;
3131
uint8_t pending_deletion;
3232
int32_t index; // Index of ENTER_EXECUTOR (if code isn't NULL, below).
3333
_PyBloomFilter bloom;

Python/bytecodes.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5474,7 +5474,7 @@ dummy_func(
54745474
}
54755475

54765476
tier2 op(_MAKE_WARM, (--)) {
5477-
current_executor->vm_data.warm = true;
5477+
current_executor->vm_data.cold = false;
54785478
}
54795479

54805480
tier2 op(_FATAL_ERROR, (--)) {

Python/executor_cases.c.h

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Python/optimizer.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1408,9 +1408,9 @@ make_executor_from_uops(_PyThreadStateImpl *tstate, _PyUOpInstruction *buffer, i
14081408
#ifdef _Py_JIT
14091409
executor->jit_code = NULL;
14101410
executor->jit_size = 0;
1411-
// This is initialized to true so we can prevent the executor
1411+
// This is initialized to false so we can prevent the executor
14121412
// from being immediately detected as cold and invalidated.
1413-
executor->vm_data.warm = true;
1413+
executor->vm_data.cold = false;
14141414
if (_PyJIT_Compile(executor, executor->trace, length)) {
14151415
Py_DECREF(executor);
14161416
return NULL;
@@ -1698,9 +1698,9 @@ make_cold_executor(uint16_t opcode)
16981698
Py_FatalError("Cannot allocate core JIT code");
16991699
}
17001700
((_PyUOpInstruction *)cold->trace)->opcode = opcode;
1701-
// This is initialized to true so we can prevent the executor
1701+
// This is initialized to false so we can prevent the executor
17021702
// from being immediately detected as cold and invalidated.
1703-
cold->vm_data.warm = true;
1703+
cold->vm_data.cold = false;
17041704
#ifdef _Py_JIT
17051705
cold->jit_code = NULL;
17061706
cold->jit_size = 0;
@@ -1895,11 +1895,11 @@ _Py_Executors_InvalidateCold(PyInterpreterState *interp)
18951895
assert(exec->vm_data.valid);
18961896
_PyExecutorObject *next = exec->vm_data.links.next;
18971897

1898-
if (!exec->vm_data.warm && PyList_Append(invalidate, (PyObject *)exec) < 0) {
1898+
if (exec->vm_data.cold && PyList_Append(invalidate, (PyObject *)exec) < 0) {
18991899
goto error;
19001900
}
19011901
else {
1902-
exec->vm_data.warm = false;
1902+
exec->vm_data.cold = true;
19031903
}
19041904

19051905
exec = next;

Python/pystate.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -820,15 +820,15 @@ interpreter_clear(PyInterpreterState *interp, PyThreadState *tstate)
820820
if (cold != NULL) {
821821
interp->cold_executor = NULL;
822822
assert(cold->vm_data.valid);
823-
assert(cold->vm_data.warm);
823+
assert(!cold->vm_data.cold);
824824
_PyExecutor_Free(cold);
825825
}
826826

827827
struct _PyExecutorObject *cold_dynamic = interp->cold_dynamic_executor;
828828
if (cold_dynamic != NULL) {
829829
interp->cold_dynamic_executor = NULL;
830830
assert(cold_dynamic->vm_data.valid);
831-
assert(cold_dynamic->vm_data.warm);
831+
assert(!cold_dynamic->vm_data.cold);
832832
_PyExecutor_Free(cold_dynamic);
833833
}
834834
/* We don't clear sysdict and builtins until the end of this function.

0 commit comments

Comments
 (0)