Skip to content

Commit 44dc084

Browse files
committed
fixup: revert any/all static-ification
1 parent ebd1c28 commit 44dc084

9 files changed

Lines changed: 24 additions & 22 deletions

File tree

Modules/_testinternalcapi/test_cases.c.h

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Python/bytecodes.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1884,8 +1884,9 @@ dummy_func(
18841884
}
18851885

18861886
inst(LOAD_COMMON_CONSTANT, ( -- value)) {
1887+
// Keep in sync with _common_constants in opcode.py
18871888
assert(oparg < NUM_COMMON_CONSTANTS);
1888-
value = load_common_constant(tstate->interp, oparg);
1889+
value = PyStackRef_FromPyObjectNew(tstate->interp->common_consts[oparg]);
18891890
}
18901891

18911892
inst(LOAD_BUILD_CLASS, ( -- bc)) {

Python/ceval_macros.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -628,11 +628,3 @@ gen_try_set_executing(PyGenObject *gen)
628628
(PyLongObject *)PyStackRef_AsPyObjectBorrow(left), \
629629
(PyLongObject *)PyStackRef_AsPyObjectBorrow(right)); \
630630
}
631-
632-
static inline _PyStackRef
633-
load_common_constant(PyInterpreterState *interp, unsigned int oparg)
634-
{
635-
assert(oparg < NUM_COMMON_CONSTANTS);
636-
assert(_Py_IsImmortal(interp->common_consts[oparg]));
637-
return PyStackRef_FromPyObjectBorrow(interp->common_consts[oparg]);
638-
}

Python/executor_cases.c.h

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

Python/flowgraph.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1330,7 +1330,7 @@ get_const_value(int opcode, int oparg, PyObject *co_consts)
13301330
}
13311331
if (opcode == LOAD_COMMON_CONSTANT) {
13321332
assert(oparg < NUM_COMMON_CONSTANTS);
1333-
return _PyInterpreterState_GET()->common_consts[oparg];
1333+
return Py_NewRef(_PyInterpreterState_GET()->common_consts[oparg]);
13341334
}
13351335

13361336
if (constant == NULL) {

Python/generated_cases.c.h

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Python/optimizer_bytecodes.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -877,9 +877,14 @@ dummy_func(void) {
877877
op(_LOAD_COMMON_CONSTANT, (-- value)) {
878878
assert(oparg < NUM_COMMON_CONSTANTS);
879879
PyObject *val = _PyInterpreterState_GET()->common_consts[oparg];
880-
assert(_Py_IsImmortal(val));
881-
ADD_OP(_LOAD_CONST_INLINE_BORROW, 0, (uintptr_t)val);
882-
value = PyJitRef_Borrow(sym_new_const(ctx, val));
880+
if (_Py_IsImmortal(val)) {
881+
ADD_OP(_LOAD_CONST_INLINE_BORROW, 0, (uintptr_t)val);
882+
value = PyJitRef_Borrow(sym_new_const(ctx, val));
883+
}
884+
else {
885+
ADD_OP(_LOAD_CONST_INLINE, 0, (uintptr_t)val);
886+
value = sym_new_const(ctx, val);
887+
}
883888
}
884889

885890
op(_LOAD_SMALL_INT, (-- value)) {

Python/optimizer_cases.c.h

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

Tools/cases_generator/analyzer.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -646,7 +646,6 @@ def has_error_without_pop(op: parser.CodeDef) -> bool:
646646
"_PyFunction_SetVersion",
647647
"_PyGen_GetGeneratorFromFrame",
648648
"gen_try_set_executing",
649-
"load_common_constant",
650649
"_PyInterpreterState_GET",
651650
"_PyList_AppendTakeRef",
652651
"_PyList_ITEMS",

0 commit comments

Comments
 (0)