mirror of https://github.com/python/cpython
GH-117442: Check eval-breaker at start (rather than end) of tier 2 loops (GH-118482)
This commit is contained in:
parent
f8e088df2a
commit
67bba9dd0f
|
@ -142,7 +142,7 @@ void _Py_BloomFilter_Init(_PyBloomFilter *);
|
||||||
void _Py_BloomFilter_Add(_PyBloomFilter *bloom, void *obj);
|
void _Py_BloomFilter_Add(_PyBloomFilter *bloom, void *obj);
|
||||||
PyAPI_FUNC(void) _Py_Executor_DependsOn(_PyExecutorObject *executor, void *obj);
|
PyAPI_FUNC(void) _Py_Executor_DependsOn(_PyExecutorObject *executor, void *obj);
|
||||||
PyAPI_FUNC(void) _Py_Executors_InvalidateDependency(PyInterpreterState *interp, void *obj, int is_invalidation);
|
PyAPI_FUNC(void) _Py_Executors_InvalidateDependency(PyInterpreterState *interp, void *obj, int is_invalidation);
|
||||||
extern void _Py_Executors_InvalidateAll(PyInterpreterState *interp, int is_invalidation);
|
PyAPI_FUNC(void) _Py_Executors_InvalidateAll(PyInterpreterState *interp, int is_invalidation);
|
||||||
|
|
||||||
/* For testing */
|
/* For testing */
|
||||||
PyAPI_FUNC(PyObject *)PyUnstable_Optimizer_NewCounter(void);
|
PyAPI_FUNC(PyObject *)PyUnstable_Optimizer_NewCounter(void);
|
||||||
|
|
|
@ -1029,7 +1029,7 @@ const struct opcode_metadata _PyOpcode_opcode_metadata[268] = {
|
||||||
[END_ASYNC_FOR] = { true, INSTR_FMT_IX, HAS_ERROR_FLAG | HAS_ERROR_NO_POP_FLAG | HAS_ESCAPES_FLAG },
|
[END_ASYNC_FOR] = { true, INSTR_FMT_IX, HAS_ERROR_FLAG | HAS_ERROR_NO_POP_FLAG | HAS_ESCAPES_FLAG },
|
||||||
[END_FOR] = { true, INSTR_FMT_IX, HAS_PURE_FLAG },
|
[END_FOR] = { true, INSTR_FMT_IX, HAS_PURE_FLAG },
|
||||||
[END_SEND] = { true, INSTR_FMT_IX, HAS_PURE_FLAG },
|
[END_SEND] = { true, INSTR_FMT_IX, HAS_PURE_FLAG },
|
||||||
[ENTER_EXECUTOR] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_EVAL_BREAK_FLAG },
|
[ENTER_EXECUTOR] = { true, INSTR_FMT_IB, HAS_ARG_FLAG },
|
||||||
[EXIT_INIT_CHECK] = { true, INSTR_FMT_IX, HAS_ERROR_FLAG | HAS_ERROR_NO_POP_FLAG | HAS_ESCAPES_FLAG },
|
[EXIT_INIT_CHECK] = { true, INSTR_FMT_IX, HAS_ERROR_FLAG | HAS_ERROR_NO_POP_FLAG | HAS_ESCAPES_FLAG },
|
||||||
[EXTENDED_ARG] = { true, INSTR_FMT_IB, HAS_ARG_FLAG },
|
[EXTENDED_ARG] = { true, INSTR_FMT_IB, HAS_ARG_FLAG },
|
||||||
[FORMAT_SIMPLE] = { true, INSTR_FMT_IX, HAS_ERROR_FLAG | HAS_ESCAPES_FLAG },
|
[FORMAT_SIMPLE] = { true, INSTR_FMT_IX, HAS_ERROR_FLAG | HAS_ESCAPES_FLAG },
|
||||||
|
|
|
@ -94,47 +94,46 @@ extern "C" {
|
||||||
#define _DYNAMIC_EXIT 343
|
#define _DYNAMIC_EXIT 343
|
||||||
#define _END_SEND END_SEND
|
#define _END_SEND END_SEND
|
||||||
#define _ERROR_POP_N 344
|
#define _ERROR_POP_N 344
|
||||||
#define _EVAL_BREAKER_EXIT 345
|
|
||||||
#define _EXIT_INIT_CHECK EXIT_INIT_CHECK
|
#define _EXIT_INIT_CHECK EXIT_INIT_CHECK
|
||||||
#define _FATAL_ERROR 346
|
#define _FATAL_ERROR 345
|
||||||
#define _FORMAT_SIMPLE FORMAT_SIMPLE
|
#define _FORMAT_SIMPLE FORMAT_SIMPLE
|
||||||
#define _FORMAT_WITH_SPEC FORMAT_WITH_SPEC
|
#define _FORMAT_WITH_SPEC FORMAT_WITH_SPEC
|
||||||
#define _FOR_ITER 347
|
#define _FOR_ITER 346
|
||||||
#define _FOR_ITER_GEN_FRAME 348
|
#define _FOR_ITER_GEN_FRAME 347
|
||||||
#define _FOR_ITER_TIER_TWO 349
|
#define _FOR_ITER_TIER_TWO 348
|
||||||
#define _GET_AITER GET_AITER
|
#define _GET_AITER GET_AITER
|
||||||
#define _GET_ANEXT GET_ANEXT
|
#define _GET_ANEXT GET_ANEXT
|
||||||
#define _GET_AWAITABLE GET_AWAITABLE
|
#define _GET_AWAITABLE GET_AWAITABLE
|
||||||
#define _GET_ITER GET_ITER
|
#define _GET_ITER GET_ITER
|
||||||
#define _GET_LEN GET_LEN
|
#define _GET_LEN GET_LEN
|
||||||
#define _GET_YIELD_FROM_ITER GET_YIELD_FROM_ITER
|
#define _GET_YIELD_FROM_ITER GET_YIELD_FROM_ITER
|
||||||
#define _GUARD_BOTH_FLOAT 350
|
#define _GUARD_BOTH_FLOAT 349
|
||||||
#define _GUARD_BOTH_INT 351
|
#define _GUARD_BOTH_INT 350
|
||||||
#define _GUARD_BOTH_UNICODE 352
|
#define _GUARD_BOTH_UNICODE 351
|
||||||
#define _GUARD_BUILTINS_VERSION 353
|
#define _GUARD_BUILTINS_VERSION 352
|
||||||
#define _GUARD_DORV_NO_DICT 354
|
#define _GUARD_DORV_NO_DICT 353
|
||||||
#define _GUARD_DORV_VALUES_INST_ATTR_FROM_DICT 355
|
#define _GUARD_DORV_VALUES_INST_ATTR_FROM_DICT 354
|
||||||
#define _GUARD_GLOBALS_VERSION 356
|
#define _GUARD_GLOBALS_VERSION 355
|
||||||
#define _GUARD_IS_FALSE_POP 357
|
#define _GUARD_IS_FALSE_POP 356
|
||||||
#define _GUARD_IS_NONE_POP 358
|
#define _GUARD_IS_NONE_POP 357
|
||||||
#define _GUARD_IS_NOT_NONE_POP 359
|
#define _GUARD_IS_NOT_NONE_POP 358
|
||||||
#define _GUARD_IS_TRUE_POP 360
|
#define _GUARD_IS_TRUE_POP 359
|
||||||
#define _GUARD_KEYS_VERSION 361
|
#define _GUARD_KEYS_VERSION 360
|
||||||
#define _GUARD_NOS_FLOAT 362
|
#define _GUARD_NOS_FLOAT 361
|
||||||
#define _GUARD_NOS_INT 363
|
#define _GUARD_NOS_INT 362
|
||||||
#define _GUARD_NOT_EXHAUSTED_LIST 364
|
#define _GUARD_NOT_EXHAUSTED_LIST 363
|
||||||
#define _GUARD_NOT_EXHAUSTED_RANGE 365
|
#define _GUARD_NOT_EXHAUSTED_RANGE 364
|
||||||
#define _GUARD_NOT_EXHAUSTED_TUPLE 366
|
#define _GUARD_NOT_EXHAUSTED_TUPLE 365
|
||||||
#define _GUARD_TOS_FLOAT 367
|
#define _GUARD_TOS_FLOAT 366
|
||||||
#define _GUARD_TOS_INT 368
|
#define _GUARD_TOS_INT 367
|
||||||
#define _GUARD_TYPE_VERSION 369
|
#define _GUARD_TYPE_VERSION 368
|
||||||
#define _INIT_CALL_BOUND_METHOD_EXACT_ARGS 370
|
#define _INIT_CALL_BOUND_METHOD_EXACT_ARGS 369
|
||||||
#define _INIT_CALL_PY_EXACT_ARGS 371
|
#define _INIT_CALL_PY_EXACT_ARGS 370
|
||||||
#define _INIT_CALL_PY_EXACT_ARGS_0 372
|
#define _INIT_CALL_PY_EXACT_ARGS_0 371
|
||||||
#define _INIT_CALL_PY_EXACT_ARGS_1 373
|
#define _INIT_CALL_PY_EXACT_ARGS_1 372
|
||||||
#define _INIT_CALL_PY_EXACT_ARGS_2 374
|
#define _INIT_CALL_PY_EXACT_ARGS_2 373
|
||||||
#define _INIT_CALL_PY_EXACT_ARGS_3 375
|
#define _INIT_CALL_PY_EXACT_ARGS_3 374
|
||||||
#define _INIT_CALL_PY_EXACT_ARGS_4 376
|
#define _INIT_CALL_PY_EXACT_ARGS_4 375
|
||||||
#define _INSTRUMENTED_CALL INSTRUMENTED_CALL
|
#define _INSTRUMENTED_CALL INSTRUMENTED_CALL
|
||||||
#define _INSTRUMENTED_CALL_FUNCTION_EX INSTRUMENTED_CALL_FUNCTION_EX
|
#define _INSTRUMENTED_CALL_FUNCTION_EX INSTRUMENTED_CALL_FUNCTION_EX
|
||||||
#define _INSTRUMENTED_CALL_KW INSTRUMENTED_CALL_KW
|
#define _INSTRUMENTED_CALL_KW INSTRUMENTED_CALL_KW
|
||||||
|
@ -151,65 +150,65 @@ extern "C" {
|
||||||
#define _INSTRUMENTED_RETURN_CONST INSTRUMENTED_RETURN_CONST
|
#define _INSTRUMENTED_RETURN_CONST INSTRUMENTED_RETURN_CONST
|
||||||
#define _INSTRUMENTED_RETURN_VALUE INSTRUMENTED_RETURN_VALUE
|
#define _INSTRUMENTED_RETURN_VALUE INSTRUMENTED_RETURN_VALUE
|
||||||
#define _INSTRUMENTED_YIELD_VALUE INSTRUMENTED_YIELD_VALUE
|
#define _INSTRUMENTED_YIELD_VALUE INSTRUMENTED_YIELD_VALUE
|
||||||
#define _INTERNAL_INCREMENT_OPT_COUNTER 377
|
#define _INTERNAL_INCREMENT_OPT_COUNTER 376
|
||||||
#define _IS_NONE 378
|
#define _IS_NONE 377
|
||||||
#define _IS_OP IS_OP
|
#define _IS_OP IS_OP
|
||||||
#define _ITER_CHECK_LIST 379
|
#define _ITER_CHECK_LIST 378
|
||||||
#define _ITER_CHECK_RANGE 380
|
#define _ITER_CHECK_RANGE 379
|
||||||
#define _ITER_CHECK_TUPLE 381
|
#define _ITER_CHECK_TUPLE 380
|
||||||
#define _ITER_JUMP_LIST 382
|
#define _ITER_JUMP_LIST 381
|
||||||
#define _ITER_JUMP_RANGE 383
|
#define _ITER_JUMP_RANGE 382
|
||||||
#define _ITER_JUMP_TUPLE 384
|
#define _ITER_JUMP_TUPLE 383
|
||||||
#define _ITER_NEXT_LIST 385
|
#define _ITER_NEXT_LIST 384
|
||||||
#define _ITER_NEXT_RANGE 386
|
#define _ITER_NEXT_RANGE 385
|
||||||
#define _ITER_NEXT_TUPLE 387
|
#define _ITER_NEXT_TUPLE 386
|
||||||
#define _JUMP_TO_TOP 388
|
#define _JUMP_TO_TOP 387
|
||||||
#define _LIST_APPEND LIST_APPEND
|
#define _LIST_APPEND LIST_APPEND
|
||||||
#define _LIST_EXTEND LIST_EXTEND
|
#define _LIST_EXTEND LIST_EXTEND
|
||||||
#define _LOAD_ASSERTION_ERROR LOAD_ASSERTION_ERROR
|
#define _LOAD_ASSERTION_ERROR LOAD_ASSERTION_ERROR
|
||||||
#define _LOAD_ATTR 389
|
#define _LOAD_ATTR 388
|
||||||
#define _LOAD_ATTR_CLASS 390
|
#define _LOAD_ATTR_CLASS 389
|
||||||
#define _LOAD_ATTR_CLASS_0 391
|
#define _LOAD_ATTR_CLASS_0 390
|
||||||
#define _LOAD_ATTR_CLASS_1 392
|
#define _LOAD_ATTR_CLASS_1 391
|
||||||
#define _LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN
|
#define _LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN
|
||||||
#define _LOAD_ATTR_INSTANCE_VALUE 393
|
#define _LOAD_ATTR_INSTANCE_VALUE 392
|
||||||
#define _LOAD_ATTR_INSTANCE_VALUE_0 394
|
#define _LOAD_ATTR_INSTANCE_VALUE_0 393
|
||||||
#define _LOAD_ATTR_INSTANCE_VALUE_1 395
|
#define _LOAD_ATTR_INSTANCE_VALUE_1 394
|
||||||
#define _LOAD_ATTR_METHOD_LAZY_DICT 396
|
#define _LOAD_ATTR_METHOD_LAZY_DICT 395
|
||||||
#define _LOAD_ATTR_METHOD_NO_DICT 397
|
#define _LOAD_ATTR_METHOD_NO_DICT 396
|
||||||
#define _LOAD_ATTR_METHOD_WITH_VALUES 398
|
#define _LOAD_ATTR_METHOD_WITH_VALUES 397
|
||||||
#define _LOAD_ATTR_MODULE 399
|
#define _LOAD_ATTR_MODULE 398
|
||||||
#define _LOAD_ATTR_NONDESCRIPTOR_NO_DICT 400
|
#define _LOAD_ATTR_NONDESCRIPTOR_NO_DICT 399
|
||||||
#define _LOAD_ATTR_NONDESCRIPTOR_WITH_VALUES 401
|
#define _LOAD_ATTR_NONDESCRIPTOR_WITH_VALUES 400
|
||||||
#define _LOAD_ATTR_PROPERTY LOAD_ATTR_PROPERTY
|
#define _LOAD_ATTR_PROPERTY LOAD_ATTR_PROPERTY
|
||||||
#define _LOAD_ATTR_SLOT 402
|
#define _LOAD_ATTR_SLOT 401
|
||||||
#define _LOAD_ATTR_SLOT_0 403
|
#define _LOAD_ATTR_SLOT_0 402
|
||||||
#define _LOAD_ATTR_SLOT_1 404
|
#define _LOAD_ATTR_SLOT_1 403
|
||||||
#define _LOAD_ATTR_WITH_HINT 405
|
#define _LOAD_ATTR_WITH_HINT 404
|
||||||
#define _LOAD_BUILD_CLASS LOAD_BUILD_CLASS
|
#define _LOAD_BUILD_CLASS LOAD_BUILD_CLASS
|
||||||
#define _LOAD_CONST LOAD_CONST
|
#define _LOAD_CONST LOAD_CONST
|
||||||
#define _LOAD_CONST_INLINE 406
|
#define _LOAD_CONST_INLINE 405
|
||||||
#define _LOAD_CONST_INLINE_BORROW 407
|
#define _LOAD_CONST_INLINE_BORROW 406
|
||||||
#define _LOAD_CONST_INLINE_BORROW_WITH_NULL 408
|
#define _LOAD_CONST_INLINE_BORROW_WITH_NULL 407
|
||||||
#define _LOAD_CONST_INLINE_WITH_NULL 409
|
#define _LOAD_CONST_INLINE_WITH_NULL 408
|
||||||
#define _LOAD_DEREF LOAD_DEREF
|
#define _LOAD_DEREF LOAD_DEREF
|
||||||
#define _LOAD_FAST 410
|
#define _LOAD_FAST 409
|
||||||
#define _LOAD_FAST_0 411
|
#define _LOAD_FAST_0 410
|
||||||
#define _LOAD_FAST_1 412
|
#define _LOAD_FAST_1 411
|
||||||
#define _LOAD_FAST_2 413
|
#define _LOAD_FAST_2 412
|
||||||
#define _LOAD_FAST_3 414
|
#define _LOAD_FAST_3 413
|
||||||
#define _LOAD_FAST_4 415
|
#define _LOAD_FAST_4 414
|
||||||
#define _LOAD_FAST_5 416
|
#define _LOAD_FAST_5 415
|
||||||
#define _LOAD_FAST_6 417
|
#define _LOAD_FAST_6 416
|
||||||
#define _LOAD_FAST_7 418
|
#define _LOAD_FAST_7 417
|
||||||
#define _LOAD_FAST_AND_CLEAR LOAD_FAST_AND_CLEAR
|
#define _LOAD_FAST_AND_CLEAR LOAD_FAST_AND_CLEAR
|
||||||
#define _LOAD_FAST_CHECK LOAD_FAST_CHECK
|
#define _LOAD_FAST_CHECK LOAD_FAST_CHECK
|
||||||
#define _LOAD_FAST_LOAD_FAST LOAD_FAST_LOAD_FAST
|
#define _LOAD_FAST_LOAD_FAST LOAD_FAST_LOAD_FAST
|
||||||
#define _LOAD_FROM_DICT_OR_DEREF LOAD_FROM_DICT_OR_DEREF
|
#define _LOAD_FROM_DICT_OR_DEREF LOAD_FROM_DICT_OR_DEREF
|
||||||
#define _LOAD_FROM_DICT_OR_GLOBALS LOAD_FROM_DICT_OR_GLOBALS
|
#define _LOAD_FROM_DICT_OR_GLOBALS LOAD_FROM_DICT_OR_GLOBALS
|
||||||
#define _LOAD_GLOBAL 419
|
#define _LOAD_GLOBAL 418
|
||||||
#define _LOAD_GLOBAL_BUILTINS 420
|
#define _LOAD_GLOBAL_BUILTINS 419
|
||||||
#define _LOAD_GLOBAL_MODULE 421
|
#define _LOAD_GLOBAL_MODULE 420
|
||||||
#define _LOAD_LOCALS LOAD_LOCALS
|
#define _LOAD_LOCALS LOAD_LOCALS
|
||||||
#define _LOAD_NAME LOAD_NAME
|
#define _LOAD_NAME LOAD_NAME
|
||||||
#define _LOAD_SUPER_ATTR_ATTR LOAD_SUPER_ATTR_ATTR
|
#define _LOAD_SUPER_ATTR_ATTR LOAD_SUPER_ATTR_ATTR
|
||||||
|
@ -223,51 +222,51 @@ extern "C" {
|
||||||
#define _MATCH_SEQUENCE MATCH_SEQUENCE
|
#define _MATCH_SEQUENCE MATCH_SEQUENCE
|
||||||
#define _NOP NOP
|
#define _NOP NOP
|
||||||
#define _POP_EXCEPT POP_EXCEPT
|
#define _POP_EXCEPT POP_EXCEPT
|
||||||
#define _POP_FRAME 422
|
#define _POP_FRAME 421
|
||||||
#define _POP_JUMP_IF_FALSE 423
|
#define _POP_JUMP_IF_FALSE 422
|
||||||
#define _POP_JUMP_IF_TRUE 424
|
#define _POP_JUMP_IF_TRUE 423
|
||||||
#define _POP_TOP POP_TOP
|
#define _POP_TOP POP_TOP
|
||||||
#define _POP_TOP_LOAD_CONST_INLINE_BORROW 425
|
#define _POP_TOP_LOAD_CONST_INLINE_BORROW 424
|
||||||
#define _PUSH_EXC_INFO PUSH_EXC_INFO
|
#define _PUSH_EXC_INFO PUSH_EXC_INFO
|
||||||
#define _PUSH_FRAME 426
|
#define _PUSH_FRAME 425
|
||||||
#define _PUSH_NULL PUSH_NULL
|
#define _PUSH_NULL PUSH_NULL
|
||||||
#define _REPLACE_WITH_TRUE 427
|
#define _REPLACE_WITH_TRUE 426
|
||||||
#define _RESUME_CHECK RESUME_CHECK
|
#define _RESUME_CHECK RESUME_CHECK
|
||||||
#define _RETURN_GENERATOR RETURN_GENERATOR
|
#define _RETURN_GENERATOR RETURN_GENERATOR
|
||||||
#define _SAVE_RETURN_OFFSET 428
|
#define _SAVE_RETURN_OFFSET 427
|
||||||
#define _SEND 429
|
#define _SEND 428
|
||||||
#define _SEND_GEN SEND_GEN
|
#define _SEND_GEN SEND_GEN
|
||||||
#define _SETUP_ANNOTATIONS SETUP_ANNOTATIONS
|
#define _SETUP_ANNOTATIONS SETUP_ANNOTATIONS
|
||||||
#define _SET_ADD SET_ADD
|
#define _SET_ADD SET_ADD
|
||||||
#define _SET_FUNCTION_ATTRIBUTE SET_FUNCTION_ATTRIBUTE
|
#define _SET_FUNCTION_ATTRIBUTE SET_FUNCTION_ATTRIBUTE
|
||||||
#define _SET_UPDATE SET_UPDATE
|
#define _SET_UPDATE SET_UPDATE
|
||||||
#define _SIDE_EXIT 430
|
#define _SIDE_EXIT 429
|
||||||
#define _START_EXECUTOR 431
|
#define _START_EXECUTOR 430
|
||||||
#define _STORE_ATTR 432
|
#define _STORE_ATTR 431
|
||||||
#define _STORE_ATTR_INSTANCE_VALUE 433
|
#define _STORE_ATTR_INSTANCE_VALUE 432
|
||||||
#define _STORE_ATTR_SLOT 434
|
#define _STORE_ATTR_SLOT 433
|
||||||
#define _STORE_ATTR_WITH_HINT STORE_ATTR_WITH_HINT
|
#define _STORE_ATTR_WITH_HINT STORE_ATTR_WITH_HINT
|
||||||
#define _STORE_DEREF STORE_DEREF
|
#define _STORE_DEREF STORE_DEREF
|
||||||
#define _STORE_FAST 435
|
#define _STORE_FAST 434
|
||||||
#define _STORE_FAST_0 436
|
#define _STORE_FAST_0 435
|
||||||
#define _STORE_FAST_1 437
|
#define _STORE_FAST_1 436
|
||||||
#define _STORE_FAST_2 438
|
#define _STORE_FAST_2 437
|
||||||
#define _STORE_FAST_3 439
|
#define _STORE_FAST_3 438
|
||||||
#define _STORE_FAST_4 440
|
#define _STORE_FAST_4 439
|
||||||
#define _STORE_FAST_5 441
|
#define _STORE_FAST_5 440
|
||||||
#define _STORE_FAST_6 442
|
#define _STORE_FAST_6 441
|
||||||
#define _STORE_FAST_7 443
|
#define _STORE_FAST_7 442
|
||||||
#define _STORE_FAST_LOAD_FAST STORE_FAST_LOAD_FAST
|
#define _STORE_FAST_LOAD_FAST STORE_FAST_LOAD_FAST
|
||||||
#define _STORE_FAST_STORE_FAST STORE_FAST_STORE_FAST
|
#define _STORE_FAST_STORE_FAST STORE_FAST_STORE_FAST
|
||||||
#define _STORE_GLOBAL STORE_GLOBAL
|
#define _STORE_GLOBAL STORE_GLOBAL
|
||||||
#define _STORE_NAME STORE_NAME
|
#define _STORE_NAME STORE_NAME
|
||||||
#define _STORE_SLICE STORE_SLICE
|
#define _STORE_SLICE STORE_SLICE
|
||||||
#define _STORE_SUBSCR 444
|
#define _STORE_SUBSCR 443
|
||||||
#define _STORE_SUBSCR_DICT STORE_SUBSCR_DICT
|
#define _STORE_SUBSCR_DICT STORE_SUBSCR_DICT
|
||||||
#define _STORE_SUBSCR_LIST_INT STORE_SUBSCR_LIST_INT
|
#define _STORE_SUBSCR_LIST_INT STORE_SUBSCR_LIST_INT
|
||||||
#define _SWAP SWAP
|
#define _SWAP SWAP
|
||||||
#define _TIER2_RESUME_CHECK 445
|
#define _TIER2_RESUME_CHECK 444
|
||||||
#define _TO_BOOL 446
|
#define _TO_BOOL 445
|
||||||
#define _TO_BOOL_BOOL TO_BOOL_BOOL
|
#define _TO_BOOL_BOOL TO_BOOL_BOOL
|
||||||
#define _TO_BOOL_INT TO_BOOL_INT
|
#define _TO_BOOL_INT TO_BOOL_INT
|
||||||
#define _TO_BOOL_LIST TO_BOOL_LIST
|
#define _TO_BOOL_LIST TO_BOOL_LIST
|
||||||
|
@ -277,13 +276,13 @@ extern "C" {
|
||||||
#define _UNARY_NEGATIVE UNARY_NEGATIVE
|
#define _UNARY_NEGATIVE UNARY_NEGATIVE
|
||||||
#define _UNARY_NOT UNARY_NOT
|
#define _UNARY_NOT UNARY_NOT
|
||||||
#define _UNPACK_EX UNPACK_EX
|
#define _UNPACK_EX UNPACK_EX
|
||||||
#define _UNPACK_SEQUENCE 447
|
#define _UNPACK_SEQUENCE 446
|
||||||
#define _UNPACK_SEQUENCE_LIST UNPACK_SEQUENCE_LIST
|
#define _UNPACK_SEQUENCE_LIST UNPACK_SEQUENCE_LIST
|
||||||
#define _UNPACK_SEQUENCE_TUPLE UNPACK_SEQUENCE_TUPLE
|
#define _UNPACK_SEQUENCE_TUPLE UNPACK_SEQUENCE_TUPLE
|
||||||
#define _UNPACK_SEQUENCE_TWO_TUPLE UNPACK_SEQUENCE_TWO_TUPLE
|
#define _UNPACK_SEQUENCE_TWO_TUPLE UNPACK_SEQUENCE_TWO_TUPLE
|
||||||
#define _WITH_EXCEPT_START WITH_EXCEPT_START
|
#define _WITH_EXCEPT_START WITH_EXCEPT_START
|
||||||
#define _YIELD_VALUE YIELD_VALUE
|
#define _YIELD_VALUE YIELD_VALUE
|
||||||
#define MAX_UOP_ID 447
|
#define MAX_UOP_ID 446
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -233,7 +233,7 @@ const uint16_t _PyUop_Flags[MAX_UOP_ID+1] = {
|
||||||
[_GUARD_IS_FALSE_POP] = HAS_EXIT_FLAG,
|
[_GUARD_IS_FALSE_POP] = HAS_EXIT_FLAG,
|
||||||
[_GUARD_IS_NONE_POP] = HAS_EXIT_FLAG,
|
[_GUARD_IS_NONE_POP] = HAS_EXIT_FLAG,
|
||||||
[_GUARD_IS_NOT_NONE_POP] = HAS_EXIT_FLAG,
|
[_GUARD_IS_NOT_NONE_POP] = HAS_EXIT_FLAG,
|
||||||
[_JUMP_TO_TOP] = HAS_EVAL_BREAK_FLAG,
|
[_JUMP_TO_TOP] = 0,
|
||||||
[_SET_IP] = 0,
|
[_SET_IP] = 0,
|
||||||
[_CHECK_STACK_SPACE_OPERAND] = HAS_DEOPT_FLAG,
|
[_CHECK_STACK_SPACE_OPERAND] = HAS_DEOPT_FLAG,
|
||||||
[_SAVE_RETURN_OFFSET] = HAS_ARG_FLAG,
|
[_SAVE_RETURN_OFFSET] = HAS_ARG_FLAG,
|
||||||
|
@ -254,8 +254,7 @@ const uint16_t _PyUop_Flags[MAX_UOP_ID+1] = {
|
||||||
[_DEOPT] = 0,
|
[_DEOPT] = 0,
|
||||||
[_SIDE_EXIT] = 0,
|
[_SIDE_EXIT] = 0,
|
||||||
[_ERROR_POP_N] = HAS_ARG_FLAG,
|
[_ERROR_POP_N] = HAS_ARG_FLAG,
|
||||||
[_TIER2_RESUME_CHECK] = HAS_EXIT_FLAG,
|
[_TIER2_RESUME_CHECK] = HAS_DEOPT_FLAG,
|
||||||
[_EVAL_BREAKER_EXIT] = HAS_ESCAPES_FLAG,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const uint8_t _PyUop_Replication[MAX_UOP_ID+1] = {
|
const uint8_t _PyUop_Replication[MAX_UOP_ID+1] = {
|
||||||
|
@ -339,7 +338,6 @@ const char *const _PyOpcode_uop_name[MAX_UOP_ID+1] = {
|
||||||
[_DYNAMIC_EXIT] = "_DYNAMIC_EXIT",
|
[_DYNAMIC_EXIT] = "_DYNAMIC_EXIT",
|
||||||
[_END_SEND] = "_END_SEND",
|
[_END_SEND] = "_END_SEND",
|
||||||
[_ERROR_POP_N] = "_ERROR_POP_N",
|
[_ERROR_POP_N] = "_ERROR_POP_N",
|
||||||
[_EVAL_BREAKER_EXIT] = "_EVAL_BREAKER_EXIT",
|
|
||||||
[_EXIT_INIT_CHECK] = "_EXIT_INIT_CHECK",
|
[_EXIT_INIT_CHECK] = "_EXIT_INIT_CHECK",
|
||||||
[_EXIT_TRACE] = "_EXIT_TRACE",
|
[_EXIT_TRACE] = "_EXIT_TRACE",
|
||||||
[_FATAL_ERROR] = "_FATAL_ERROR",
|
[_FATAL_ERROR] = "_FATAL_ERROR",
|
||||||
|
@ -978,8 +976,6 @@ int _PyUop_num_popped(int opcode, int oparg)
|
||||||
return oparg;
|
return oparg;
|
||||||
case _TIER2_RESUME_CHECK:
|
case _TIER2_RESUME_CHECK:
|
||||||
return 0;
|
return 0;
|
||||||
case _EVAL_BREAKER_EXIT:
|
|
||||||
return 0;
|
|
||||||
default:
|
default:
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2410,20 +2410,21 @@ dummy_func(
|
||||||
|
|
||||||
tier1 inst(ENTER_EXECUTOR, (--)) {
|
tier1 inst(ENTER_EXECUTOR, (--)) {
|
||||||
#ifdef _Py_TIER2
|
#ifdef _Py_TIER2
|
||||||
int prevoparg = oparg;
|
|
||||||
CHECK_EVAL_BREAKER();
|
|
||||||
if (this_instr->op.code != ENTER_EXECUTOR ||
|
|
||||||
this_instr->op.arg != prevoparg) {
|
|
||||||
next_instr = this_instr;
|
|
||||||
DISPATCH();
|
|
||||||
}
|
|
||||||
|
|
||||||
PyCodeObject *code = _PyFrame_GetCode(frame);
|
PyCodeObject *code = _PyFrame_GetCode(frame);
|
||||||
_PyExecutorObject *executor = code->co_executors->executors[oparg & 255];
|
_PyExecutorObject *executor = code->co_executors->executors[oparg & 255];
|
||||||
assert(executor->vm_data.index == INSTR_OFFSET() - 1);
|
assert(executor->vm_data.index == INSTR_OFFSET() - 1);
|
||||||
assert(executor->vm_data.code == code);
|
assert(executor->vm_data.code == code);
|
||||||
assert(executor->vm_data.valid);
|
assert(executor->vm_data.valid);
|
||||||
assert(tstate->previous_executor == NULL);
|
assert(tstate->previous_executor == NULL);
|
||||||
|
/* If the eval breaker is set then stay in tier 1.
|
||||||
|
* This avoids any potentially infinite loops
|
||||||
|
* involving _RESUME_CHECK */
|
||||||
|
if (_Py_atomic_load_uintptr_relaxed(&tstate->eval_breaker) & _PY_EVAL_EVENTS_MASK) {
|
||||||
|
opcode = executor->vm_data.opcode;
|
||||||
|
oparg = (oparg & ~255) | executor->vm_data.oparg;
|
||||||
|
next_instr = this_instr;
|
||||||
|
DISPATCH_GOTO();
|
||||||
|
}
|
||||||
tstate->previous_executor = Py_None;
|
tstate->previous_executor = Py_None;
|
||||||
Py_INCREF(executor);
|
Py_INCREF(executor);
|
||||||
GOTO_TIER_TWO(executor);
|
GOTO_TIER_TWO(executor);
|
||||||
|
@ -4111,7 +4112,6 @@ dummy_func(
|
||||||
#ifndef _Py_JIT
|
#ifndef _Py_JIT
|
||||||
next_uop = ¤t_executor->trace[1];
|
next_uop = ¤t_executor->trace[1];
|
||||||
#endif
|
#endif
|
||||||
CHECK_EVAL_BREAKER();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tier2 op(_SET_IP, (instr_ptr/4 --)) {
|
tier2 op(_SET_IP, (instr_ptr/4 --)) {
|
||||||
|
@ -4277,30 +4277,18 @@ dummy_func(
|
||||||
GOTO_UNWIND();
|
GOTO_UNWIND();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Progress is guaranteed if we DEOPT on the eval breaker, because
|
||||||
/* Special version of RESUME_CHECK that (when paired with _EVAL_BREAKER_EXIT)
|
* ENTER_EXECUTOR will not re-enter tier 2 with the eval breaker set. */
|
||||||
* is safe for tier 2. Progress is guaranteed because _EVAL_BREAKER_EXIT calls
|
|
||||||
* _Py_HandlePending which clears the eval_breaker so that _TIER2_RESUME_CHECK
|
|
||||||
* will not exit if it is immediately executed again. */
|
|
||||||
tier2 op(_TIER2_RESUME_CHECK, (--)) {
|
tier2 op(_TIER2_RESUME_CHECK, (--)) {
|
||||||
#if defined(__EMSCRIPTEN__)
|
#if defined(__EMSCRIPTEN__)
|
||||||
EXIT_IF(_Py_emscripten_signal_clock == 0);
|
DEOPT_IF(_Py_emscripten_signal_clock == 0);
|
||||||
_Py_emscripten_signal_clock -= Py_EMSCRIPTEN_SIGNAL_HANDLING;
|
_Py_emscripten_signal_clock -= Py_EMSCRIPTEN_SIGNAL_HANDLING;
|
||||||
#endif
|
#endif
|
||||||
uintptr_t eval_breaker = _Py_atomic_load_uintptr_relaxed(&tstate->eval_breaker);
|
uintptr_t eval_breaker = _Py_atomic_load_uintptr_relaxed(&tstate->eval_breaker);
|
||||||
EXIT_IF(eval_breaker & _PY_EVAL_EVENTS_MASK);
|
DEOPT_IF(eval_breaker & _PY_EVAL_EVENTS_MASK);
|
||||||
assert(eval_breaker == FT_ATOMIC_LOAD_UINTPTR_ACQUIRE(_PyFrame_GetCode(frame)->_co_instrumentation_version));
|
assert(eval_breaker == FT_ATOMIC_LOAD_UINTPTR_ACQUIRE(_PyFrame_GetCode(frame)->_co_instrumentation_version));
|
||||||
}
|
}
|
||||||
|
|
||||||
tier2 op(_EVAL_BREAKER_EXIT, (--)) {
|
|
||||||
_Py_CHECK_EMSCRIPTEN_SIGNALS_PERIODICALLY();
|
|
||||||
QSBR_QUIESCENT_STATE(tstate);
|
|
||||||
if (_Py_HandlePending(tstate) != 0) {
|
|
||||||
GOTO_UNWIND();
|
|
||||||
}
|
|
||||||
EXIT_TO_TRACE();
|
|
||||||
}
|
|
||||||
|
|
||||||
// END BYTECODES //
|
// END BYTECODES //
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4094,7 +4094,6 @@
|
||||||
#ifndef _Py_JIT
|
#ifndef _Py_JIT
|
||||||
next_uop = ¤t_executor->trace[1];
|
next_uop = ¤t_executor->trace[1];
|
||||||
#endif
|
#endif
|
||||||
CHECK_EVAL_BREAKER();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4353,14 +4352,4 @@
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case _EVAL_BREAKER_EXIT: {
|
|
||||||
_Py_CHECK_EMSCRIPTEN_SIGNALS_PERIODICALLY();
|
|
||||||
QSBR_QUIESCENT_STATE(tstate);
|
|
||||||
if (_Py_HandlePending(tstate) != 0) {
|
|
||||||
GOTO_UNWIND();
|
|
||||||
}
|
|
||||||
EXIT_TO_TRACE();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
#undef TIER_TWO
|
#undef TIER_TWO
|
||||||
|
|
|
@ -2493,19 +2493,21 @@
|
||||||
next_instr += 1;
|
next_instr += 1;
|
||||||
INSTRUCTION_STATS(ENTER_EXECUTOR);
|
INSTRUCTION_STATS(ENTER_EXECUTOR);
|
||||||
#ifdef _Py_TIER2
|
#ifdef _Py_TIER2
|
||||||
int prevoparg = oparg;
|
|
||||||
CHECK_EVAL_BREAKER();
|
|
||||||
if (this_instr->op.code != ENTER_EXECUTOR ||
|
|
||||||
this_instr->op.arg != prevoparg) {
|
|
||||||
next_instr = this_instr;
|
|
||||||
DISPATCH();
|
|
||||||
}
|
|
||||||
PyCodeObject *code = _PyFrame_GetCode(frame);
|
PyCodeObject *code = _PyFrame_GetCode(frame);
|
||||||
_PyExecutorObject *executor = code->co_executors->executors[oparg & 255];
|
_PyExecutorObject *executor = code->co_executors->executors[oparg & 255];
|
||||||
assert(executor->vm_data.index == INSTR_OFFSET() - 1);
|
assert(executor->vm_data.index == INSTR_OFFSET() - 1);
|
||||||
assert(executor->vm_data.code == code);
|
assert(executor->vm_data.code == code);
|
||||||
assert(executor->vm_data.valid);
|
assert(executor->vm_data.valid);
|
||||||
assert(tstate->previous_executor == NULL);
|
assert(tstate->previous_executor == NULL);
|
||||||
|
/* If the eval breaker is set then stay in tier 1.
|
||||||
|
* This avoids any potentially infinite loops
|
||||||
|
* involving _RESUME_CHECK */
|
||||||
|
if (_Py_atomic_load_uintptr_relaxed(&tstate->eval_breaker) & _PY_EVAL_EVENTS_MASK) {
|
||||||
|
opcode = executor->vm_data.opcode;
|
||||||
|
oparg = (oparg & ~255) | executor->vm_data.oparg;
|
||||||
|
next_instr = this_instr;
|
||||||
|
DISPATCH_GOTO();
|
||||||
|
}
|
||||||
tstate->previous_executor = Py_None;
|
tstate->previous_executor = Py_None;
|
||||||
Py_INCREF(executor);
|
Py_INCREF(executor);
|
||||||
GOTO_TIER_TWO(executor);
|
GOTO_TIER_TWO(executor);
|
||||||
|
|
|
@ -627,6 +627,9 @@ top: // Jump here after _PUSH_FRAME or likely branches
|
||||||
if (opcode == JUMP_BACKWARD || opcode == JUMP_BACKWARD_NO_INTERRUPT) {
|
if (opcode == JUMP_BACKWARD || opcode == JUMP_BACKWARD_NO_INTERRUPT) {
|
||||||
instr += 1 + _PyOpcode_Caches[opcode] - (int32_t)oparg;
|
instr += 1 + _PyOpcode_Caches[opcode] - (int32_t)oparg;
|
||||||
initial_instr = instr;
|
initial_instr = instr;
|
||||||
|
if (opcode == JUMP_BACKWARD) {
|
||||||
|
ADD_TO_TRACE(_TIER2_RESUME_CHECK, 0, 0, target);
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -976,6 +979,7 @@ prepare_for_execution(_PyUOpInstruction *buffer, int length)
|
||||||
int32_t current_error = -1;
|
int32_t current_error = -1;
|
||||||
int32_t current_error_target = -1;
|
int32_t current_error_target = -1;
|
||||||
int32_t current_popped = -1;
|
int32_t current_popped = -1;
|
||||||
|
int32_t current_exit_op = -1;
|
||||||
/* Leaving in NOPs slows down the interpreter and messes up the stats */
|
/* Leaving in NOPs slows down the interpreter and messes up the stats */
|
||||||
_PyUOpInstruction *copy_to = &buffer[0];
|
_PyUOpInstruction *copy_to = &buffer[0];
|
||||||
for (int i = 0; i < length; i++) {
|
for (int i = 0; i < length; i++) {
|
||||||
|
@ -994,20 +998,11 @@ prepare_for_execution(_PyUOpInstruction *buffer, int length)
|
||||||
int opcode = inst->opcode;
|
int opcode = inst->opcode;
|
||||||
int32_t target = (int32_t)uop_get_target(inst);
|
int32_t target = (int32_t)uop_get_target(inst);
|
||||||
if (_PyUop_Flags[opcode] & (HAS_EXIT_FLAG | HAS_DEOPT_FLAG)) {
|
if (_PyUop_Flags[opcode] & (HAS_EXIT_FLAG | HAS_DEOPT_FLAG)) {
|
||||||
if (target != current_jump_target) {
|
uint16_t exit_op = (_PyUop_Flags[opcode] & HAS_EXIT_FLAG) ?
|
||||||
uint16_t exit_op;
|
_SIDE_EXIT : _DEOPT;
|
||||||
if (_PyUop_Flags[opcode] & HAS_EXIT_FLAG) {
|
if (target != current_jump_target || current_exit_op != exit_op) {
|
||||||
if (opcode == _TIER2_RESUME_CHECK) {
|
|
||||||
exit_op = _EVAL_BREAKER_EXIT;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
exit_op = _SIDE_EXIT;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
exit_op = _DEOPT;
|
|
||||||
}
|
|
||||||
make_exit(&buffer[next_spare], exit_op, target);
|
make_exit(&buffer[next_spare], exit_op, target);
|
||||||
|
current_exit_op = exit_op;
|
||||||
current_jump_target = target;
|
current_jump_target = target;
|
||||||
current_jump = next_spare;
|
current_jump = next_spare;
|
||||||
next_spare++;
|
next_spare++;
|
||||||
|
@ -1114,7 +1109,6 @@ sanity_check(_PyExecutorObject *executor)
|
||||||
CHECK(
|
CHECK(
|
||||||
opcode == _DEOPT ||
|
opcode == _DEOPT ||
|
||||||
opcode == _SIDE_EXIT ||
|
opcode == _SIDE_EXIT ||
|
||||||
opcode == _EVAL_BREAKER_EXIT ||
|
|
||||||
opcode == _ERROR_POP_N);
|
opcode == _ERROR_POP_N);
|
||||||
if (opcode == _SIDE_EXIT) {
|
if (opcode == _SIDE_EXIT) {
|
||||||
CHECK(inst->format == UOP_FORMAT_EXIT);
|
CHECK(inst->format == UOP_FORMAT_EXIT);
|
||||||
|
|
|
@ -2153,7 +2153,3 @@
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case _EVAL_BREAKER_EXIT: {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -106,7 +106,6 @@ _JIT_ENTRY(_PyInterpreterFrame *frame, PyObject **stack_pointer, PyThreadState *
|
||||||
|
|
||||||
// The actual instruction definitions (only one will be used):
|
// The actual instruction definitions (only one will be used):
|
||||||
if (uopcode == _JUMP_TO_TOP) {
|
if (uopcode == _JUMP_TO_TOP) {
|
||||||
CHECK_EVAL_BREAKER();
|
|
||||||
PATCH_JUMP(_JIT_TOP);
|
PATCH_JUMP(_JIT_TOP);
|
||||||
}
|
}
|
||||||
switch (uopcode) {
|
switch (uopcode) {
|
||||||
|
|
Loading…
Reference in New Issue