mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
gh-105481: add HAS_JUMP flag to opcode metadata (#105791)
This commit is contained in:
parent
5ab13c5f97
commit
d1b0297d3e
8 changed files with 189 additions and 168 deletions
|
@ -430,7 +430,7 @@ dummy_func(
|
|||
_Py_DECREF_SPECIALIZED(right, _PyUnicode_ExactDealloc);
|
||||
ERROR_IF(*target_local == NULL, error);
|
||||
// The STORE_FAST is already done.
|
||||
JUMPBY(INLINE_CACHE_ENTRIES_BINARY_OP + 1);
|
||||
SKIP_OVER(INLINE_CACHE_ENTRIES_BINARY_OP + 1);
|
||||
}
|
||||
|
||||
macro(BINARY_OP_INPLACE_ADD_UNICODE) =
|
||||
|
@ -557,7 +557,7 @@ dummy_func(
|
|||
STACK_SHRINK(2);
|
||||
new_frame->localsplus[0] = container;
|
||||
new_frame->localsplus[1] = sub;
|
||||
JUMPBY(INLINE_CACHE_ENTRIES_BINARY_SUBSCR);
|
||||
SKIP_OVER(INLINE_CACHE_ENTRIES_BINARY_SUBSCR);
|
||||
frame->return_offset = 0;
|
||||
DISPATCH_INLINED(new_frame);
|
||||
}
|
||||
|
@ -879,7 +879,7 @@ dummy_func(
|
|||
gen->gi_frame_state = FRAME_EXECUTING;
|
||||
gen->gi_exc_state.previous_item = tstate->exc_info;
|
||||
tstate->exc_info = &gen->gi_exc_state;
|
||||
JUMPBY(INLINE_CACHE_ENTRIES_SEND);
|
||||
SKIP_OVER(INLINE_CACHE_ENTRIES_SEND);
|
||||
DISPATCH_INLINED(gen_frame);
|
||||
}
|
||||
if (Py_IsNone(v) && PyIter_Check(receiver)) {
|
||||
|
@ -918,7 +918,7 @@ dummy_func(
|
|||
gen->gi_frame_state = FRAME_EXECUTING;
|
||||
gen->gi_exc_state.previous_item = tstate->exc_info;
|
||||
tstate->exc_info = &gen->gi_exc_state;
|
||||
JUMPBY(INLINE_CACHE_ENTRIES_SEND);
|
||||
SKIP_OVER(INLINE_CACHE_ENTRIES_SEND);
|
||||
DISPATCH_INLINED(gen_frame);
|
||||
}
|
||||
|
||||
|
@ -1905,7 +1905,7 @@ dummy_func(
|
|||
int shrink_stack = !(oparg & 1);
|
||||
STACK_SHRINK(shrink_stack);
|
||||
new_frame->localsplus[0] = owner;
|
||||
JUMPBY(INLINE_CACHE_ENTRIES_LOAD_ATTR);
|
||||
SKIP_OVER(INLINE_CACHE_ENTRIES_LOAD_ATTR);
|
||||
frame->return_offset = 0;
|
||||
DISPATCH_INLINED(new_frame);
|
||||
}
|
||||
|
@ -1933,7 +1933,7 @@ dummy_func(
|
|||
STACK_SHRINK(shrink_stack);
|
||||
new_frame->localsplus[0] = owner;
|
||||
new_frame->localsplus[1] = Py_NewRef(name);
|
||||
JUMPBY(INLINE_CACHE_ENTRIES_LOAD_ATTR);
|
||||
SKIP_OVER(INLINE_CACHE_ENTRIES_LOAD_ATTR);
|
||||
frame->return_offset = 0;
|
||||
DISPATCH_INLINED(new_frame);
|
||||
}
|
||||
|
@ -2356,8 +2356,9 @@ dummy_func(
|
|||
next_instr[INLINE_CACHE_ENTRIES_FOR_ITER + oparg].op.code == INSTRUMENTED_END_FOR);
|
||||
Py_DECREF(iter);
|
||||
STACK_SHRINK(1);
|
||||
SKIP_OVER(INLINE_CACHE_ENTRIES_FOR_ITER);
|
||||
/* Jump forward oparg, then skip following END_FOR instruction */
|
||||
JUMPBY(INLINE_CACHE_ENTRIES_FOR_ITER + oparg + 1);
|
||||
JUMPBY(oparg + 1);
|
||||
DISPATCH();
|
||||
}
|
||||
// Common case: no jump, leave it to the code generator
|
||||
|
@ -2406,8 +2407,9 @@ dummy_func(
|
|||
}
|
||||
Py_DECREF(iter);
|
||||
STACK_SHRINK(1);
|
||||
SKIP_OVER(INLINE_CACHE_ENTRIES_FOR_ITER);
|
||||
/* Jump forward oparg, then skip following END_FOR instruction */
|
||||
JUMPBY(INLINE_CACHE_ENTRIES_FOR_ITER + oparg + 1);
|
||||
JUMPBY(oparg + 1);
|
||||
DISPATCH();
|
||||
end_for_iter_list:
|
||||
// Common case: no jump, leave it to the code generator
|
||||
|
@ -2428,8 +2430,9 @@ dummy_func(
|
|||
}
|
||||
Py_DECREF(iter);
|
||||
STACK_SHRINK(1);
|
||||
SKIP_OVER(INLINE_CACHE_ENTRIES_FOR_ITER);
|
||||
/* Jump forward oparg, then skip following END_FOR instruction */
|
||||
JUMPBY(INLINE_CACHE_ENTRIES_FOR_ITER + oparg + 1);
|
||||
JUMPBY(oparg + 1);
|
||||
DISPATCH();
|
||||
end_for_iter_tuple:
|
||||
// Common case: no jump, leave it to the code generator
|
||||
|
@ -2442,8 +2445,9 @@ dummy_func(
|
|||
if (r->len <= 0) {
|
||||
STACK_SHRINK(1);
|
||||
Py_DECREF(r);
|
||||
SKIP_OVER(INLINE_CACHE_ENTRIES_FOR_ITER);
|
||||
// Jump over END_FOR instruction.
|
||||
JUMPBY(INLINE_CACHE_ENTRIES_FOR_ITER + oparg + 1);
|
||||
JUMPBY(oparg + 1);
|
||||
DISPATCH();
|
||||
}
|
||||
long value = r->start;
|
||||
|
@ -2467,7 +2471,7 @@ dummy_func(
|
|||
gen->gi_frame_state = FRAME_EXECUTING;
|
||||
gen->gi_exc_state.previous_item = tstate->exc_info;
|
||||
tstate->exc_info = &gen->gi_exc_state;
|
||||
JUMPBY(INLINE_CACHE_ENTRIES_FOR_ITER);
|
||||
SKIP_OVER(INLINE_CACHE_ENTRIES_FOR_ITER);
|
||||
assert(next_instr[oparg].op.code == END_FOR ||
|
||||
next_instr[oparg].op.code == INSTRUMENTED_END_FOR);
|
||||
DISPATCH_INLINED(gen_frame);
|
||||
|
@ -2738,7 +2742,7 @@ dummy_func(
|
|||
if (new_frame == NULL) {
|
||||
goto error;
|
||||
}
|
||||
JUMPBY(INLINE_CACHE_ENTRIES_CALL);
|
||||
SKIP_OVER(INLINE_CACHE_ENTRIES_CALL);
|
||||
frame->return_offset = 0;
|
||||
DISPATCH_INLINED(new_frame);
|
||||
}
|
||||
|
@ -2812,7 +2816,7 @@ dummy_func(
|
|||
}
|
||||
// Manipulate stack directly since we leave using DISPATCH_INLINED().
|
||||
STACK_SHRINK(oparg + 2);
|
||||
JUMPBY(INLINE_CACHE_ENTRIES_CALL);
|
||||
SKIP_OVER(INLINE_CACHE_ENTRIES_CALL);
|
||||
frame->return_offset = 0;
|
||||
DISPATCH_INLINED(new_frame);
|
||||
}
|
||||
|
@ -2850,7 +2854,7 @@ dummy_func(
|
|||
}
|
||||
// Manipulate stack and cache directly since we leave using DISPATCH_INLINED().
|
||||
STACK_SHRINK(oparg + 2);
|
||||
JUMPBY(INLINE_CACHE_ENTRIES_CALL);
|
||||
SKIP_OVER(INLINE_CACHE_ENTRIES_CALL);
|
||||
frame->return_offset = 0;
|
||||
DISPATCH_INLINED(new_frame);
|
||||
}
|
||||
|
@ -3093,7 +3097,7 @@ dummy_func(
|
|||
Py_DECREF(method);
|
||||
STACK_SHRINK(3);
|
||||
// CALL + POP_TOP
|
||||
JUMPBY(INLINE_CACHE_ENTRIES_CALL + 1);
|
||||
SKIP_OVER(INLINE_CACHE_ENTRIES_CALL + 1);
|
||||
assert(next_instr[-1].op.code == POP_TOP);
|
||||
DISPATCH();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue