Skip to content

GH-131498: Replace single-element arrays with scalars in bytecodes.c #132615

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 1 commit into from
Apr 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion Include/internal/pycore_uop_metadata.h

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

272 changes: 133 additions & 139 deletions Python/bytecodes.c

Large diffs are not rendered by default.

644 changes: 338 additions & 306 deletions Python/executor_cases.c.h

Large diffs are not rendered by default.

748 changes: 404 additions & 344 deletions Python/generated_cases.c.h

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions Python/optimizer_bytecodes.c
Original file line number Diff line number Diff line change
Expand Up @@ -534,10 +534,10 @@ dummy_func(void) {
top = bottom;
}

op(_SWAP, (bottom[1], unused[oparg-2], top[1] -- bottom[1], unused[oparg-2], top[1])) {
JitOptSymbol *temp = bottom[0];
bottom[0] = top[0];
top[0] = temp;
op(_SWAP, (bottom, unused[oparg-2], top -- bottom, unused[oparg-2], top)) {
JitOptSymbol *temp = bottom;
bottom = top;
top = temp;
assert(oparg >= 2);
}

Expand All @@ -546,7 +546,7 @@ dummy_func(void) {
(void)offset;
}

op(_LOAD_ATTR_MODULE, (dict_version/2, owner, index/1 -- attr)) {
op(_LOAD_ATTR_MODULE, (dict_version/2, index/1, owner -- attr)) {
(void)dict_version;
(void)index;
attr = NULL;
Expand Down Expand Up @@ -626,9 +626,9 @@ dummy_func(void) {
ctx->done = true;
}

op(_INIT_CALL_BOUND_METHOD_EXACT_ARGS, (callable[1], self_or_null[1], unused[oparg] -- callable[1], self_or_null[1], unused[oparg])) {
callable[0] = sym_new_not_null(ctx);
self_or_null[0] = sym_new_not_null(ctx);
op(_INIT_CALL_BOUND_METHOD_EXACT_ARGS, (callable, self_or_null, unused[oparg] -- callable, self_or_null, unused[oparg])) {
callable = sym_new_not_null(ctx);
self_or_null = sym_new_not_null(ctx);
}

op(_CHECK_FUNCTION_VERSION, (func_version/2, callable, self_or_null, unused[oparg] -- callable, self_or_null, unused[oparg])) {
Expand Down
33 changes: 17 additions & 16 deletions Python/optimizer_cases.c.h

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

22 changes: 10 additions & 12 deletions Tools/cases_generator/stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -572,23 +572,21 @@ def copy(self) -> "Storage":
self.check_liveness, self.spilled
)

def sanity_check(self) -> None:
@staticmethod
def check_names(locals: list[Local]) -> None:
names: set[str] = set()
for var in self.inputs:
if var.name in names:
raise StackError(f"Duplicate name {var.name}")
names.add(var.name)
names = set()
for var in self.outputs:
if var.name in names:
raise StackError(f"Duplicate name {var.name}")
names.add(var.name)
names = set()
for var in self.stack.variables:
for var in locals:
if var.name == "unused":
continue
if var.name in names:
raise StackError(f"Duplicate name {var.name}")
names.add(var.name)

def sanity_check(self) -> None:
self.check_names(self.inputs)
self.check_names(self.outputs)
self.check_names(self.stack.variables)

def is_flushed(self) -> bool:
for var in self.outputs:
if var.in_local and not var.memory_offset:
Expand Down
Loading