mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
gh-115999: Disable the specializing adaptive interpreter in free-threaded builds (#116013)
For now, disable all specialization when the GIL might be disabled.
This commit is contained in:
parent
2e94a6687c
commit
339c8e1c13
9 changed files with 96 additions and 3 deletions
55
Python/generated_cases.c.h
generated
55
Python/generated_cases.c.h
generated
|
@ -104,6 +104,7 @@
|
|||
INSTRUCTION_STATS(BINARY_OP);
|
||||
PREDICTED(BINARY_OP);
|
||||
_Py_CODEUNIT *this_instr = next_instr - 2;
|
||||
(void)this_instr;
|
||||
PyObject *rhs;
|
||||
PyObject *lhs;
|
||||
PyObject *res;
|
||||
|
@ -112,6 +113,7 @@
|
|||
lhs = stack_pointer[-2];
|
||||
{
|
||||
uint16_t counter = read_u16(&this_instr[1].cache);
|
||||
(void)counter;
|
||||
#if ENABLE_SPECIALIZATION
|
||||
if (ADAPTIVE_COUNTER_IS_ZERO(counter)) {
|
||||
next_instr = this_instr;
|
||||
|
@ -419,6 +421,7 @@
|
|||
INSTRUCTION_STATS(BINARY_SUBSCR);
|
||||
PREDICTED(BINARY_SUBSCR);
|
||||
_Py_CODEUNIT *this_instr = next_instr - 2;
|
||||
(void)this_instr;
|
||||
PyObject *sub;
|
||||
PyObject *container;
|
||||
PyObject *res;
|
||||
|
@ -427,6 +430,7 @@
|
|||
container = stack_pointer[-2];
|
||||
{
|
||||
uint16_t counter = read_u16(&this_instr[1].cache);
|
||||
(void)counter;
|
||||
#if ENABLE_SPECIALIZATION
|
||||
if (ADAPTIVE_COUNTER_IS_ZERO(counter)) {
|
||||
next_instr = this_instr;
|
||||
|
@ -747,6 +751,7 @@
|
|||
INSTRUCTION_STATS(CALL);
|
||||
PREDICTED(CALL);
|
||||
_Py_CODEUNIT *this_instr = next_instr - 4;
|
||||
(void)this_instr;
|
||||
PyObject **args;
|
||||
PyObject *self_or_null;
|
||||
PyObject *callable;
|
||||
|
@ -757,6 +762,7 @@
|
|||
callable = stack_pointer[-2 - oparg];
|
||||
{
|
||||
uint16_t counter = read_u16(&this_instr[1].cache);
|
||||
(void)counter;
|
||||
#if ENABLE_SPECIALIZATION
|
||||
if (ADAPTIVE_COUNTER_IS_ZERO(counter)) {
|
||||
next_instr = this_instr;
|
||||
|
@ -1176,6 +1182,7 @@
|
|||
INSTRUCTION_STATS(CALL_FUNCTION_EX);
|
||||
PREDICTED(CALL_FUNCTION_EX);
|
||||
_Py_CODEUNIT *this_instr = next_instr - 1;
|
||||
(void)this_instr;
|
||||
PyObject *kwargs = NULL;
|
||||
PyObject *callargs;
|
||||
PyObject *func;
|
||||
|
@ -1336,6 +1343,7 @@
|
|||
INSTRUCTION_STATS(CALL_KW);
|
||||
PREDICTED(CALL_KW);
|
||||
_Py_CODEUNIT *this_instr = next_instr - 1;
|
||||
(void)this_instr;
|
||||
PyObject *kwnames;
|
||||
PyObject **args;
|
||||
PyObject *self_or_null;
|
||||
|
@ -1937,6 +1945,7 @@
|
|||
|
||||
TARGET(CLEANUP_THROW) {
|
||||
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
|
||||
(void)this_instr;
|
||||
next_instr += 1;
|
||||
INSTRUCTION_STATS(CLEANUP_THROW);
|
||||
PyObject *exc_value;
|
||||
|
@ -1973,6 +1982,7 @@
|
|||
INSTRUCTION_STATS(COMPARE_OP);
|
||||
PREDICTED(COMPARE_OP);
|
||||
_Py_CODEUNIT *this_instr = next_instr - 2;
|
||||
(void)this_instr;
|
||||
PyObject *right;
|
||||
PyObject *left;
|
||||
PyObject *res;
|
||||
|
@ -1981,6 +1991,7 @@
|
|||
left = stack_pointer[-2];
|
||||
{
|
||||
uint16_t counter = read_u16(&this_instr[1].cache);
|
||||
(void)counter;
|
||||
#if ENABLE_SPECIALIZATION
|
||||
if (ADAPTIVE_COUNTER_IS_ZERO(counter)) {
|
||||
next_instr = this_instr;
|
||||
|
@ -2324,6 +2335,7 @@
|
|||
|
||||
TARGET(END_ASYNC_FOR) {
|
||||
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
|
||||
(void)this_instr;
|
||||
next_instr += 1;
|
||||
INSTRUCTION_STATS(END_ASYNC_FOR);
|
||||
PyObject *exc;
|
||||
|
@ -2460,12 +2472,14 @@
|
|||
INSTRUCTION_STATS(FOR_ITER);
|
||||
PREDICTED(FOR_ITER);
|
||||
_Py_CODEUNIT *this_instr = next_instr - 2;
|
||||
(void)this_instr;
|
||||
PyObject *iter;
|
||||
PyObject *next;
|
||||
// _SPECIALIZE_FOR_ITER
|
||||
iter = stack_pointer[-1];
|
||||
{
|
||||
uint16_t counter = read_u16(&this_instr[1].cache);
|
||||
(void)counter;
|
||||
#if ENABLE_SPECIALIZATION
|
||||
if (ADAPTIVE_COUNTER_IS_ZERO(counter)) {
|
||||
next_instr = this_instr;
|
||||
|
@ -2884,6 +2898,7 @@
|
|||
|
||||
TARGET(INSTRUMENTED_CALL) {
|
||||
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
|
||||
(void)this_instr;
|
||||
next_instr += 4;
|
||||
INSTRUCTION_STATS(INSTRUMENTED_CALL);
|
||||
/* Skip 3 cache entries */
|
||||
|
@ -2909,6 +2924,7 @@
|
|||
|
||||
TARGET(INSTRUMENTED_CALL_KW) {
|
||||
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
|
||||
(void)this_instr;
|
||||
next_instr += 1;
|
||||
INSTRUCTION_STATS(INSTRUMENTED_CALL_KW);
|
||||
int is_meth = PEEK(oparg + 2) != NULL;
|
||||
|
@ -2925,6 +2941,7 @@
|
|||
|
||||
TARGET(INSTRUMENTED_END_FOR) {
|
||||
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
|
||||
(void)this_instr;
|
||||
next_instr += 1;
|
||||
INSTRUCTION_STATS(INSTRUMENTED_END_FOR);
|
||||
PyObject *value;
|
||||
|
@ -2947,6 +2964,7 @@
|
|||
|
||||
TARGET(INSTRUMENTED_END_SEND) {
|
||||
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
|
||||
(void)this_instr;
|
||||
next_instr += 1;
|
||||
INSTRUCTION_STATS(INSTRUMENTED_END_SEND);
|
||||
PyObject *value;
|
||||
|
@ -2968,6 +2986,7 @@
|
|||
|
||||
TARGET(INSTRUMENTED_FOR_ITER) {
|
||||
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
|
||||
(void)this_instr;
|
||||
next_instr += 2;
|
||||
INSTRUCTION_STATS(INSTRUMENTED_FOR_ITER);
|
||||
/* Skip 1 cache entry */
|
||||
|
@ -3000,6 +3019,7 @@
|
|||
|
||||
TARGET(INSTRUMENTED_INSTRUCTION) {
|
||||
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
|
||||
(void)this_instr;
|
||||
next_instr += 1;
|
||||
INSTRUCTION_STATS(INSTRUMENTED_INSTRUCTION);
|
||||
int next_opcode = _Py_call_instrumentation_instruction(
|
||||
|
@ -3016,6 +3036,7 @@
|
|||
|
||||
TARGET(INSTRUMENTED_JUMP_BACKWARD) {
|
||||
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
|
||||
(void)this_instr;
|
||||
next_instr += 2;
|
||||
INSTRUCTION_STATS(INSTRUMENTED_JUMP_BACKWARD);
|
||||
/* Skip 1 cache entry */
|
||||
|
@ -3026,6 +3047,7 @@
|
|||
|
||||
TARGET(INSTRUMENTED_JUMP_FORWARD) {
|
||||
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
|
||||
(void)this_instr;
|
||||
next_instr += 1;
|
||||
INSTRUCTION_STATS(INSTRUMENTED_JUMP_FORWARD);
|
||||
INSTRUMENTED_JUMP(this_instr, next_instr + oparg, PY_MONITORING_EVENT_JUMP);
|
||||
|
@ -3034,6 +3056,7 @@
|
|||
|
||||
TARGET(INSTRUMENTED_LOAD_SUPER_ATTR) {
|
||||
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
|
||||
(void)this_instr;
|
||||
next_instr += 2;
|
||||
INSTRUCTION_STATS(INSTRUMENTED_LOAD_SUPER_ATTR);
|
||||
/* Skip 1 cache entry */
|
||||
|
@ -3045,6 +3068,7 @@
|
|||
|
||||
TARGET(INSTRUMENTED_POP_JUMP_IF_FALSE) {
|
||||
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
|
||||
(void)this_instr;
|
||||
next_instr += 2;
|
||||
INSTRUCTION_STATS(INSTRUMENTED_POP_JUMP_IF_FALSE);
|
||||
/* Skip 1 cache entry */
|
||||
|
@ -3061,6 +3085,7 @@
|
|||
|
||||
TARGET(INSTRUMENTED_POP_JUMP_IF_NONE) {
|
||||
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
|
||||
(void)this_instr;
|
||||
next_instr += 2;
|
||||
INSTRUCTION_STATS(INSTRUMENTED_POP_JUMP_IF_NONE);
|
||||
/* Skip 1 cache entry */
|
||||
|
@ -3083,6 +3108,7 @@
|
|||
|
||||
TARGET(INSTRUMENTED_POP_JUMP_IF_NOT_NONE) {
|
||||
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
|
||||
(void)this_instr;
|
||||
next_instr += 2;
|
||||
INSTRUCTION_STATS(INSTRUMENTED_POP_JUMP_IF_NOT_NONE);
|
||||
/* Skip 1 cache entry */
|
||||
|
@ -3105,6 +3131,7 @@
|
|||
|
||||
TARGET(INSTRUMENTED_POP_JUMP_IF_TRUE) {
|
||||
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
|
||||
(void)this_instr;
|
||||
next_instr += 2;
|
||||
INSTRUCTION_STATS(INSTRUMENTED_POP_JUMP_IF_TRUE);
|
||||
/* Skip 1 cache entry */
|
||||
|
@ -3121,6 +3148,7 @@
|
|||
|
||||
TARGET(INSTRUMENTED_RESUME) {
|
||||
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
|
||||
(void)this_instr;
|
||||
next_instr += 1;
|
||||
INSTRUCTION_STATS(INSTRUMENTED_RESUME);
|
||||
uintptr_t global_version = _Py_atomic_load_uintptr_relaxed(&tstate->eval_breaker) & ~_PY_EVAL_EVENTS_MASK;
|
||||
|
@ -3151,6 +3179,7 @@
|
|||
|
||||
TARGET(INSTRUMENTED_RETURN_CONST) {
|
||||
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
|
||||
(void)this_instr;
|
||||
next_instr += 1;
|
||||
INSTRUCTION_STATS(INSTRUMENTED_RETURN_CONST);
|
||||
PyObject *retval = GETITEM(FRAME_CO_CONSTS, oparg);
|
||||
|
@ -3174,6 +3203,7 @@
|
|||
|
||||
TARGET(INSTRUMENTED_RETURN_VALUE) {
|
||||
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
|
||||
(void)this_instr;
|
||||
next_instr += 1;
|
||||
INSTRUCTION_STATS(INSTRUMENTED_RETURN_VALUE);
|
||||
PyObject *retval;
|
||||
|
@ -3198,6 +3228,7 @@
|
|||
|
||||
TARGET(INSTRUMENTED_YIELD_VALUE) {
|
||||
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
|
||||
(void)this_instr;
|
||||
next_instr += 1;
|
||||
INSTRUCTION_STATS(INSTRUMENTED_YIELD_VALUE);
|
||||
PyObject *retval;
|
||||
|
@ -3261,6 +3292,7 @@
|
|||
|
||||
TARGET(JUMP_BACKWARD) {
|
||||
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
|
||||
(void)this_instr;
|
||||
next_instr += 2;
|
||||
INSTRUCTION_STATS(JUMP_BACKWARD);
|
||||
/* Skip 1 cache entry */
|
||||
|
@ -3387,6 +3419,7 @@
|
|||
INSTRUCTION_STATS(LOAD_ATTR);
|
||||
PREDICTED(LOAD_ATTR);
|
||||
_Py_CODEUNIT *this_instr = next_instr - 10;
|
||||
(void)this_instr;
|
||||
PyObject *owner;
|
||||
PyObject *attr;
|
||||
PyObject *self_or_null = NULL;
|
||||
|
@ -3394,6 +3427,7 @@
|
|||
owner = stack_pointer[-1];
|
||||
{
|
||||
uint16_t counter = read_u16(&this_instr[1].cache);
|
||||
(void)counter;
|
||||
#if ENABLE_SPECIALIZATION
|
||||
if (ADAPTIVE_COUNTER_IS_ZERO(counter)) {
|
||||
PyObject *name = GETITEM(FRAME_CO_NAMES, oparg>>1);
|
||||
|
@ -4083,11 +4117,13 @@
|
|||
INSTRUCTION_STATS(LOAD_GLOBAL);
|
||||
PREDICTED(LOAD_GLOBAL);
|
||||
_Py_CODEUNIT *this_instr = next_instr - 5;
|
||||
(void)this_instr;
|
||||
PyObject *res;
|
||||
PyObject *null = NULL;
|
||||
// _SPECIALIZE_LOAD_GLOBAL
|
||||
{
|
||||
uint16_t counter = read_u16(&this_instr[1].cache);
|
||||
(void)counter;
|
||||
#if ENABLE_SPECIALIZATION
|
||||
if (ADAPTIVE_COUNTER_IS_ZERO(counter)) {
|
||||
PyObject *name = GETITEM(FRAME_CO_NAMES, oparg>>1);
|
||||
|
@ -4279,6 +4315,7 @@
|
|||
INSTRUCTION_STATS(LOAD_SUPER_ATTR);
|
||||
PREDICTED(LOAD_SUPER_ATTR);
|
||||
_Py_CODEUNIT *this_instr = next_instr - 2;
|
||||
(void)this_instr;
|
||||
PyObject *class;
|
||||
PyObject *global_super;
|
||||
PyObject *self;
|
||||
|
@ -4289,6 +4326,7 @@
|
|||
global_super = stack_pointer[-3];
|
||||
{
|
||||
uint16_t counter = read_u16(&this_instr[1].cache);
|
||||
(void)counter;
|
||||
#if ENABLE_SPECIALIZATION
|
||||
int load_method = oparg & 1;
|
||||
if (ADAPTIVE_COUNTER_IS_ZERO(counter)) {
|
||||
|
@ -4565,6 +4603,7 @@
|
|||
|
||||
TARGET(POP_JUMP_IF_FALSE) {
|
||||
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
|
||||
(void)this_instr;
|
||||
next_instr += 2;
|
||||
INSTRUCTION_STATS(POP_JUMP_IF_FALSE);
|
||||
PyObject *cond;
|
||||
|
@ -4582,6 +4621,7 @@
|
|||
|
||||
TARGET(POP_JUMP_IF_NONE) {
|
||||
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
|
||||
(void)this_instr;
|
||||
next_instr += 2;
|
||||
INSTRUCTION_STATS(POP_JUMP_IF_NONE);
|
||||
PyObject *value;
|
||||
|
@ -4615,6 +4655,7 @@
|
|||
|
||||
TARGET(POP_JUMP_IF_NOT_NONE) {
|
||||
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
|
||||
(void)this_instr;
|
||||
next_instr += 2;
|
||||
INSTRUCTION_STATS(POP_JUMP_IF_NOT_NONE);
|
||||
PyObject *value;
|
||||
|
@ -4648,6 +4689,7 @@
|
|||
|
||||
TARGET(POP_JUMP_IF_TRUE) {
|
||||
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
|
||||
(void)this_instr;
|
||||
next_instr += 2;
|
||||
INSTRUCTION_STATS(POP_JUMP_IF_TRUE);
|
||||
PyObject *cond;
|
||||
|
@ -4709,6 +4751,7 @@
|
|||
|
||||
TARGET(RAISE_VARARGS) {
|
||||
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
|
||||
(void)this_instr;
|
||||
next_instr += 1;
|
||||
INSTRUCTION_STATS(RAISE_VARARGS);
|
||||
PyObject **args;
|
||||
|
@ -4738,6 +4781,7 @@
|
|||
|
||||
TARGET(RERAISE) {
|
||||
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
|
||||
(void)this_instr;
|
||||
next_instr += 1;
|
||||
INSTRUCTION_STATS(RERAISE);
|
||||
PyObject *exc;
|
||||
|
@ -4779,6 +4823,7 @@
|
|||
INSTRUCTION_STATS(RESUME);
|
||||
PREDICTED(RESUME);
|
||||
_Py_CODEUNIT *this_instr = next_instr - 1;
|
||||
(void)this_instr;
|
||||
assert(frame == tstate->current_frame);
|
||||
if (tstate->tracing == 0) {
|
||||
uintptr_t global_version =
|
||||
|
@ -4916,6 +4961,7 @@
|
|||
INSTRUCTION_STATS(SEND);
|
||||
PREDICTED(SEND);
|
||||
_Py_CODEUNIT *this_instr = next_instr - 2;
|
||||
(void)this_instr;
|
||||
PyObject *receiver;
|
||||
PyObject *v;
|
||||
PyObject *retval;
|
||||
|
@ -4923,6 +4969,7 @@
|
|||
receiver = stack_pointer[-2];
|
||||
{
|
||||
uint16_t counter = read_u16(&this_instr[1].cache);
|
||||
(void)counter;
|
||||
#if ENABLE_SPECIALIZATION
|
||||
if (ADAPTIVE_COUNTER_IS_ZERO(counter)) {
|
||||
next_instr = this_instr;
|
||||
|
@ -5103,12 +5150,14 @@
|
|||
INSTRUCTION_STATS(STORE_ATTR);
|
||||
PREDICTED(STORE_ATTR);
|
||||
_Py_CODEUNIT *this_instr = next_instr - 5;
|
||||
(void)this_instr;
|
||||
PyObject *owner;
|
||||
PyObject *v;
|
||||
// _SPECIALIZE_STORE_ATTR
|
||||
owner = stack_pointer[-1];
|
||||
{
|
||||
uint16_t counter = read_u16(&this_instr[1].cache);
|
||||
(void)counter;
|
||||
#if ENABLE_SPECIALIZATION
|
||||
if (ADAPTIVE_COUNTER_IS_ZERO(counter)) {
|
||||
PyObject *name = GETITEM(FRAME_CO_NAMES, oparg);
|
||||
|
@ -5392,6 +5441,7 @@
|
|||
INSTRUCTION_STATS(STORE_SUBSCR);
|
||||
PREDICTED(STORE_SUBSCR);
|
||||
_Py_CODEUNIT *this_instr = next_instr - 2;
|
||||
(void)this_instr;
|
||||
PyObject *sub;
|
||||
PyObject *container;
|
||||
PyObject *v;
|
||||
|
@ -5400,6 +5450,7 @@
|
|||
container = stack_pointer[-2];
|
||||
{
|
||||
uint16_t counter = read_u16(&this_instr[1].cache);
|
||||
(void)counter;
|
||||
#if ENABLE_SPECIALIZATION
|
||||
if (ADAPTIVE_COUNTER_IS_ZERO(counter)) {
|
||||
next_instr = this_instr;
|
||||
|
@ -5495,12 +5546,14 @@
|
|||
INSTRUCTION_STATS(TO_BOOL);
|
||||
PREDICTED(TO_BOOL);
|
||||
_Py_CODEUNIT *this_instr = next_instr - 4;
|
||||
(void)this_instr;
|
||||
PyObject *value;
|
||||
PyObject *res;
|
||||
// _SPECIALIZE_TO_BOOL
|
||||
value = stack_pointer[-1];
|
||||
{
|
||||
uint16_t counter = read_u16(&this_instr[1].cache);
|
||||
(void)counter;
|
||||
#if ENABLE_SPECIALIZATION
|
||||
if (ADAPTIVE_COUNTER_IS_ZERO(counter)) {
|
||||
next_instr = this_instr;
|
||||
|
@ -5704,11 +5757,13 @@
|
|||
INSTRUCTION_STATS(UNPACK_SEQUENCE);
|
||||
PREDICTED(UNPACK_SEQUENCE);
|
||||
_Py_CODEUNIT *this_instr = next_instr - 2;
|
||||
(void)this_instr;
|
||||
PyObject *seq;
|
||||
// _SPECIALIZE_UNPACK_SEQUENCE
|
||||
seq = stack_pointer[-1];
|
||||
{
|
||||
uint16_t counter = read_u16(&this_instr[1].cache);
|
||||
(void)counter;
|
||||
#if ENABLE_SPECIALIZATION
|
||||
if (ADAPTIVE_COUNTER_IS_ZERO(counter)) {
|
||||
next_instr = this_instr;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue