Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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 Python/jit.c
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ _PyJIT_Compile(_PyExecutorObject *executor, const _PyUOpInstruction trace[], siz
// Loop once to find the total compiled size:
size_t code_size = 0;
size_t data_size = 0;
jit_state state = {};
jit_state state = {0};
group = &trampoline;
code_size += group->code_size;
data_size += group->data_size;
Expand Down
5 changes: 4 additions & 1 deletion Tools/jit/_stencils.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,10 @@ def _get_trampoline_mask(self) -> str:
word = bitmask & ((1 << 32) - 1)
trampoline_mask.append(f"{word:#04x}")
bitmask >>= 32
return "{" + ", ".join(trampoline_mask) + "}"
if len(trampoline_mask):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if len(trampoline_mask):
if trampoline_mask:

Or you could "{" + (", ".join(trampoline_mask) or "0") + "}".

return "{" + ", ".join(trampoline_mask) + "}"
else:
return "{0}"

def as_c(self, opname: str) -> str:
"""Dump this hole as a StencilGroup initializer."""
Expand Down
7 changes: 5 additions & 2 deletions Tools/jit/_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,11 @@ def _dump_footer(
yield "};"
yield ""
yield f"static const void * const symbols_map[{max(len(symbols), 1)}] = {{"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at this, there shouldn't be a need for the length in here? And while I believe it's okay, it could be affected by this change.

for symbol, ordinal in symbols.items():
yield f" [{ordinal}] = &{symbol},"
if len(symbols):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto

for symbol, ordinal in symbols.items():
yield f" [{ordinal}] = &{symbol},"
else:
yield " 0"
yield "};"


Expand Down
Loading