mirror of
https://github.com/python/cpython.git
synced 2025-08-30 21:48:47 +00:00
bpo-45923: Add RESUME_QUICK
(GH-31244)
This commit is contained in:
parent
1a6411f573
commit
d7a5aca982
6 changed files with 30 additions and 22 deletions
|
@ -1734,9 +1734,6 @@ handle_eval_breaker:
|
|||
}
|
||||
|
||||
TARGET(RESUME) {
|
||||
assert(tstate->cframe == &cframe);
|
||||
assert(frame == cframe.current_frame);
|
||||
|
||||
int err = _Py_IncrementCountAndMaybeQuicken(frame->f_code);
|
||||
if (err) {
|
||||
if (err < 0) {
|
||||
|
@ -1747,6 +1744,13 @@ handle_eval_breaker:
|
|||
first_instr = frame->f_code->co_firstinstr;
|
||||
next_instr = first_instr + nexti;
|
||||
}
|
||||
JUMP_TO_INSTRUCTION(RESUME_QUICK);
|
||||
}
|
||||
|
||||
TARGET(RESUME_QUICK) {
|
||||
PREDICTED(RESUME_QUICK);
|
||||
assert(tstate->cframe == &cframe);
|
||||
assert(frame == cframe.current_frame);
|
||||
frame->f_state = FRAME_EXECUTING;
|
||||
if (_Py_atomic_load_relaxed(eval_breaker) && oparg < 2) {
|
||||
goto handle_eval_breaker;
|
||||
|
@ -4004,7 +4008,6 @@ handle_eval_breaker:
|
|||
|
||||
TARGET(JUMP_ABSOLUTE) {
|
||||
PREDICTED(JUMP_ABSOLUTE);
|
||||
assert(oparg < INSTR_OFFSET());
|
||||
int err = _Py_IncrementCountAndMaybeQuicken(frame->f_code);
|
||||
if (err) {
|
||||
if (err < 0) {
|
||||
|
@ -4015,9 +4018,7 @@ handle_eval_breaker:
|
|||
first_instr = frame->f_code->co_firstinstr;
|
||||
next_instr = first_instr + nexti;
|
||||
}
|
||||
JUMPTO(oparg);
|
||||
CHECK_EVAL_BREAKER();
|
||||
DISPATCH();
|
||||
JUMP_TO_INSTRUCTION(JUMP_ABSOLUTE_QUICK);
|
||||
}
|
||||
|
||||
TARGET(JUMP_NO_INTERRUPT) {
|
||||
|
@ -4032,6 +4033,7 @@ handle_eval_breaker:
|
|||
}
|
||||
|
||||
TARGET(JUMP_ABSOLUTE_QUICK) {
|
||||
PREDICTED(JUMP_ABSOLUTE_QUICK);
|
||||
assert(oparg < INSTR_OFFSET());
|
||||
JUMPTO(oparg);
|
||||
CHECK_EVAL_BREAKER();
|
||||
|
|
12
Python/opcode_targets.h
generated
12
Python/opcode_targets.h
generated
|
@ -78,9 +78,9 @@ static void *opcode_targets[256] = {
|
|||
&&TARGET_LOAD_METHOD_CLASS,
|
||||
&&TARGET_LOAD_METHOD_MODULE,
|
||||
&&TARGET_LOAD_METHOD_NO_DICT,
|
||||
&&TARGET_RESUME_QUICK,
|
||||
&&TARGET_STORE_ATTR_ADAPTIVE,
|
||||
&&TARGET_STORE_ATTR_INSTANCE_VALUE,
|
||||
&&TARGET_STORE_ATTR_SLOT,
|
||||
&&TARGET_LIST_TO_TUPLE,
|
||||
&&TARGET_RETURN_VALUE,
|
||||
&&TARGET_IMPORT_STAR,
|
||||
|
@ -130,7 +130,7 @@ static void *opcode_targets[256] = {
|
|||
&&TARGET_POP_JUMP_IF_NOT_NONE,
|
||||
&&TARGET_POP_JUMP_IF_NONE,
|
||||
&&TARGET_RAISE_VARARGS,
|
||||
&&TARGET_STORE_ATTR_WITH_HINT,
|
||||
&&TARGET_STORE_ATTR_SLOT,
|
||||
&&TARGET_MAKE_FUNCTION,
|
||||
&&TARGET_BUILD_SLICE,
|
||||
&&TARGET_JUMP_NO_INTERRUPT,
|
||||
|
@ -139,21 +139,21 @@ static void *opcode_targets[256] = {
|
|||
&&TARGET_LOAD_DEREF,
|
||||
&&TARGET_STORE_DEREF,
|
||||
&&TARGET_DELETE_DEREF,
|
||||
&&TARGET_STORE_ATTR_WITH_HINT,
|
||||
&&TARGET_LOAD_FAST__LOAD_FAST,
|
||||
&&TARGET_STORE_FAST__LOAD_FAST,
|
||||
&&TARGET_CALL_FUNCTION_EX,
|
||||
&&TARGET_LOAD_FAST__LOAD_CONST,
|
||||
&&TARGET_STORE_FAST__LOAD_FAST,
|
||||
&&TARGET_EXTENDED_ARG,
|
||||
&&TARGET_LIST_APPEND,
|
||||
&&TARGET_SET_ADD,
|
||||
&&TARGET_MAP_ADD,
|
||||
&&TARGET_LOAD_CLASSDEREF,
|
||||
&&TARGET_COPY_FREE_VARS,
|
||||
&&TARGET_LOAD_CONST__LOAD_FAST,
|
||||
&&TARGET_LOAD_FAST__LOAD_CONST,
|
||||
&&TARGET_RESUME,
|
||||
&&TARGET_MATCH_CLASS,
|
||||
&&TARGET_LOAD_CONST__LOAD_FAST,
|
||||
&&TARGET_STORE_FAST__STORE_FAST,
|
||||
&&_unknown_opcode,
|
||||
&&TARGET_FORMAT_VALUE,
|
||||
&&TARGET_BUILD_CONST_KEY_MAP,
|
||||
&&TARGET_BUILD_STRING,
|
||||
|
|
|
@ -407,6 +407,9 @@ optimize(SpecializedCacheOrInstruction *quickened, int len)
|
|||
case JUMP_ABSOLUTE:
|
||||
instructions[i] = _Py_MAKECODEUNIT(JUMP_ABSOLUTE_QUICK, oparg);
|
||||
break;
|
||||
case RESUME:
|
||||
instructions[i] = _Py_MAKECODEUNIT(RESUME_QUICK, oparg);
|
||||
break;
|
||||
case LOAD_FAST:
|
||||
switch(previous_opcode) {
|
||||
case LOAD_FAST:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue