FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

GH-131498: Replace single-element arrays with scalars in `bytecodes.c` by brandtbucher · Pull Request #132615 · python/cpython · GitHub

Repository navigation

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .c  (2) .h  (4) .py  (1) All 3 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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

Back | FazBrowse Home | New Git URL