Skip to content

Commit

Permalink
fix compilation from upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
Fidget-Spinner committed Dec 23, 2024
1 parent ca98f9e commit 2110e09
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 14 deletions.
8 changes: 8 additions & 0 deletions Include/internal/pycore_uop_metadata.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 2 additions & 7 deletions Python/ceval.c
Original file line number Diff line number Diff line change
Expand Up @@ -717,13 +717,8 @@ extern void _PyUOpPrint(const _PyUOpInstruction *uop);
static int
base_opcode(PyCodeObject *code, int offset)
{
int opcode = _Py_GetBaseOpcode(code, offset);
if (opcode == ENTER_EXECUTOR) {
int oparg = _PyCode_CODE(code)[offset].op.arg;
_PyExecutorObject *ex = code->co_executors->executors[oparg];
return ex->vm_data.opcode;
}
return opcode;
_Py_CODEUNIT inst = _Py_GetBaseCodeUnit(code, offset);
return inst.op.code;
}
#endif

Expand Down
3 changes: 2 additions & 1 deletion Python/optimizer.c
Original file line number Diff line number Diff line change
Expand Up @@ -804,7 +804,7 @@ translate_bytecode_to_trace(
DPRINTF(2, "Trace stack underflow\n");
OPT_STAT_INC(trace_stack_underflow);
ADD_TO_TRACE(uop, oparg, 0, target);
if (uop == _RETURN_GENERATOR) {
if (uop == _RETURN_GENERATOR || uop == _RETURN_VALUE) {
ADD_TO_TRACE(_RETURN_OFFSET, 0, 0, 0);
}
else {
Expand Down Expand Up @@ -949,6 +949,7 @@ translate_bytecode_to_trace(
// SKip trunk traces where they are too short, and don't end in a _JUMP_TO_TOP.
if (first || (progress_needed &&
trace[trace_length-1].opcode != _JUMP_TO_TOP &&
trace[trace_length-1].opcode != _DYNAMIC_EXIT &&
(trace_length <= UOP_MIN_TRACE_LENGTH ||
(is_resume_trace && trace_length <= UOP_MIN_TRACE_LENGTH_RESUME)) )) {
OPT_STAT_INC(trace_too_short);
Expand Down
17 changes: 13 additions & 4 deletions Python/optimizer_bytecodes.c
Original file line number Diff line number Diff line change
Expand Up @@ -702,8 +702,10 @@ dummy_func(void) {
op(_RETURN_VALUE, (retval -- res)) {
SAVE_STACK();
ctx->frame->stack_pointer = stack_pointer;
if (frame_pop(ctx)) {
goto done;
int err = frame_pop(ctx);
if (err) {
ctx->done = true;
break;
}
stack_pointer = ctx->frame->stack_pointer;

Expand All @@ -727,8 +729,10 @@ dummy_func(void) {
op(_RETURN_GENERATOR, ( -- res)) {
SYNC_SP();
ctx->frame->stack_pointer = stack_pointer;
if (frame_pop(ctx)) {
goto done;
int err = frame_pop(ctx);
if (err) {
ctx->done = true;
break;
}
stack_pointer = ctx->frame->stack_pointer;
res = sym_new_unknown(ctx);
Expand Down Expand Up @@ -892,6 +896,11 @@ dummy_func(void) {
ctx->done = true;
}

op(_DYNAMIC_EXIT, (exit_p/4 --)) {
(void)exit_p;
ctx->done = true;
}

op(_GUARD_GLOBALS_VERSION_PUSH_KEYS, (version/1 -- globals_keys)) {
globals_keys = sym_new_unknown(ctx);
(void)version;
Expand Down
23 changes: 21 additions & 2 deletions Python/optimizer_cases.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 2110e09

Please sign in to comment.