8000 gh-120619: Optimize through `_Py_FRAME_GENERAL` by Fidget-Spinner · Pull Request #124518 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-120619: Optimize through _Py_FRAME_GENERAL #124518

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Optimize through _Py_FRAME_GENERAL
  • Loading branch information
Fidget-Spinner committed Sep 25, 2024
commit 0638d7a83bbf6add72003ff3f31027482e18b534
30 changes: 24 additions & 6 deletions Python/optimizer_bytecodes.c
Original file line number Diff line number Diff line change
Expand Up @@ -619,12 +619,30 @@ dummy_func(void) {
}

op(_PY_FRAME_GENERAL, (callable, self_or_null, args[oparg] -- new_frame: _Py_UOpsAbstractFrame *)) {
/* The _Py_UOpsAbstractFrame design assumes that we can copy arguments across directly */
(void)callable;
(void)self_or_null;
(void)args;
new_frame = NULL;
ctx->done = true;
(void)(self_or_null);
(void)(callable);
PyCodeObject *co = NULL;
assert((this_instr + 2)->opcode == _PUSH_FRAME);
uint64_t push_operand = (this_instr + 2)->operand;
if (push_operand & 1) {
co = (PyCodeObject *)(push_operand & ~1);
DPRINTF(3, "code=%p ", co);
assert(PyCode_Check(co));
}
else {
PyFunctionObject *func = (PyFunctionObject *)push_operand;
DPRINTF(3, "func=%p ", func);
if (func == NULL) {
DPRINTF(3, "\n");
DPRINTF(1, "Missing function\n");
ctx->done = true;
break;
}
co = (PyCodeObject *)func->func_code;
DPRINTF(3, "code=%p ", co);
}

new_frame = frame_new(ctx, co, 0, NULL, 0);
}

op(_PY_FRAME_KW, (callable, self_or_null, args[oparg], kwnames -- new_frame: _Py_UOpsAbstractFrame *)) {
Expand Down
30 changes: 23 additions & 7 deletions Python/optimizer_cases.c.h

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

Loading
0