Skip to content

Commit c23e591

Browse files
restore optimizer code
1 parent 8ebb6cb commit c23e591

File tree

3 files changed

+20
-5
lines changed

3 files changed

+20
-5
lines changed

Include/internal/pycore_optimizer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ _PyJit_translate_single_bytecode_to_trace(
372372
int jump_taken);
373373

374374
void
375-
_PyJit_InitializeTracing(PyThreadState *tstate, _PyInterpreterFrame *frame, _Py_CODEUNIT *insert_exec_instr
375+
_PyJit_InitializeTracing(PyThreadState *tstate, _PyInterpreterFrame *frame, _Py_CODEUNIT *insert_exec_instr,
376376
_Py_CODEUNIT *close_loop_instr, int curr_stackdepth, int chain_depth, _PyExitData *exit);
377377

378378
void _PyJit_FinalizeTracing(PyThreadState *tstate);

Python/optimizer_bytecodes.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -794,10 +794,18 @@ dummy_func(void) {
794794

795795
op(_RETURN_GENERATOR, ( -- res)) {
796796
SYNC_SP();
797+
PyCodeObject *co = get_current_code_object(ctx);
798+
ctx->frame->stack_pointer = stack_pointer;
799+
frame_pop(ctx);
797800
stack_pointer = ctx->frame->stack_pointer;
798801
res = sym_new_unknown(ctx);
799-
ctx->done = true;
800-
ctx->out_of_space = true;
802+
/* Stack space handling */
803+
assert(corresponding_check_stack == NULL);
804+
assert(co != NULL);
805+
int framesize = co->co_framesize;
806+
assert(framesize > 0);
807+
assert(framesize <= curr_space);
808+
curr_space -= framesize;
801809
}
802810

803811
op(_YIELD_VALUE, (unused -- value)) {

Python/optimizer_cases.c.h

Lines changed: 9 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)