summaryrefslogtreecommitdiffstats
path: root/Python/optimizer_cases.c.h
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2024-04-25 10:32:47 (GMT)
committerGitHub <noreply@github.com>2024-04-25 10:32:47 (GMT)
commitf180b31e7629d36265fa36f1560365358b4fd47c (patch)
tree3a887125f428f481fd85753d3f6b896843e84b3a /Python/optimizer_cases.c.h
parent10bb90ed49a81a525b126ce8e4d8564c1616d0b3 (diff)
downloadcpython-f180b31e7629d36265fa36f1560365358b4fd47c.zip
cpython-f180b31e7629d36265fa36f1560365358b4fd47c.tar.gz
cpython-f180b31e7629d36265fa36f1560365358b4fd47c.tar.bz2
GH-118095: Handle `RETURN_GENERATOR` in tier 2 (GH-118180)
Diffstat (limited to 'Python/optimizer_cases.c.h')
-rw-r--r--Python/optimizer_cases.c.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/Python/optimizer_cases.c.h b/Python/optimizer_cases.c.h
index 0a7d96d..4f0941a 100644
--- a/Python/optimizer_cases.c.h
+++ b/Python/optimizer_cases.c.h
@@ -1840,6 +1840,29 @@
break;
}
+ case _RETURN_GENERATOR: {
+ _Py_UopsSymbol *res;
+ ctx->frame->stack_pointer = stack_pointer;
+ frame_pop(ctx);
+ stack_pointer = ctx->frame->stack_pointer;
+ OUT_OF_SPACE_IF_NULL(res = sym_new_unknown(ctx));
+ /* Stack space handling */
+ assert(corresponding_check_stack == NULL);
+ assert(co != NULL);
+ int framesize = co->co_framesize;
+ assert(framesize > 0);
+ assert(framesize <= curr_space);
+ curr_space -= framesize;
+ co = get_code(this_instr);
+ if (co == NULL) {
+ // might be impossible, but bailing is still safe
+ goto done;
+ }
+ stack_pointer[0] = res;
+ stack_pointer += 1;
+ break;
+ }
+
case _BUILD_SLICE: {
_Py_UopsSymbol *slice;
slice = sym_new_not_null(ctx);