8000 gh-125207: Fix MSVC 1935 build with JIT (#125209) · python/cpython@410c2c4 · GitHub
[go: up one dir, main page]

Skip to content

Commit 410c2c4

Browse files
mdboompablogsal
authored andcommitted
gh-125207: Fix MSVC 1935 build with JIT (#125209)
* gh-125207: Use {0} array initializers * Simplify, as suggested in PR * Revert change to explicitly specify length Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
1 parent f8ba9fb commit 410c2c4

File tree

4 files changed

+12
-4
lines changed

4 files changed

+12
-4
lines changed

Python/ceval.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,11 @@
9999
} \
100100
_Py_DECREF_STAT_INC(); \
101101
if (--op->ob_refcnt == 0) { \
102+
struct _reftracer_runtime_state *tracer = &_PyRuntime.ref_tracer; \
103+
if (tracer->tracer_func != NULL) { \
104+
void* data = tracer->tracer_data; \
105+
tracer->tracer_func(op, PyRefTracer_DESTROY, data); \
106+
} \
102107
destructor d = (destructor)(dealloc); \
103108
d(op); \
104109
} \

Python/jit.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ _PyJIT_Compile(_PyExecutorObject *executor, const _PyUOpInstruction trace[], siz
469469
// Loop once to find the total compiled size:
470470
size_t code_size = 0;
471471
size_t data_size = 0;
472-
jit_state state = {};
472+
jit_state state = {0};
473473
group = &trampoline;
474474
code_size += group->code_size;
475475
data_size += group->data_size;

Tools/jit/_stencils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ def _get_trampoline_mask(self) -> str:
339339
word = bitmask & ((1 << 32) - 1)
340340
trampoline_mask.append(f"{word:#04x}")
341341
bitmask >>= 32
342-
return "{" + ", ".join(trampoline_mask) + "}"
342+
return "{" + (", ".join(trampoline_mask) or "0") + "}"
343343

344344
def as_c(self, opname: str) -> str:
345345
"""Dump this hole as a StencilGroup initializer."""

Tools/jit/_writer.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,11 @@ def _dump_footer(
3232
yield "};"
3333
yield ""
3434
yield f"static const void * const symbols_map[{max(len(symbols), 1)}] = {{"
35-
for symbol, ordinal in symbols.items():
36-
yield f" [{ordinal}] = &{symbol},"
35+
if symbols:
36+
for symbol, ordinal in symbols.items():
37+
yield f" [{ordinal}] = &{symbol},"
38+
else:
39+
yield " 0"
3740
yield "};"< 4257 /span>
3841

3942

0 commit comments

Comments
 (0)
0