Skip to content

Commit 1ff2cbb

Browse files
authored
gh-137136: Suppress build warnings when build on Windows with --experimental-jit-interpreter (GH-137137)
1 parent 34ed038 commit 1ff2cbb

File tree

9 files changed

+22
-20
lines changed

9 files changed

+22
-20
lines changed

Include/internal/pycore_optimizer.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -332,8 +332,8 @@ extern bool _Py_uop_sym_is_bottom(JitOptRef sym);
332332
extern int _Py_uop_sym_truthiness(JitOptContext *ctx, JitOptRef sym);
333333
extern PyTypeObject *_Py_uop_sym_get_type(JitOptRef sym);
334334
extern JitOptRef _Py_uop_sym_new_tuple(JitOptContext *ctx, int size, JitOptRef *args);
335-
extern JitOptRef _Py_uop_sym_tuple_getitem(JitOptContext *ctx, JitOptRef sym, int item);
336-
extern int _Py_uop_sym_tuple_length(JitOptRef sym);
335+
extern JitOptRef _Py_uop_sym_tuple_getitem(JitOptContext *ctx, JitOptRef sym, Py_ssize_t item);
336+
extern Py_ssize_t _Py_uop_sym_tuple_length(JitOptRef sym);
337337
extern JitOptRef _Py_uop_sym_new_truthiness(JitOptContext *ctx, JitOptRef value, bool truthy);
338338
extern bool _Py_uop_sym_is_compact_int(JitOptRef sym);
339339
extern JitOptRef _Py_uop_sym_new_compact_int(JitOptContext *ctx);
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Suppress build warnings when build on Windows with
2+
``--experimental-jit-interpreter``.

Python/bytecodes.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -811,7 +811,7 @@ dummy_func(
811811
assert(next_instr->op.code == STORE_FAST);
812812
next_oparg = next_instr->op.arg;
813813
#else
814-
next_oparg = CURRENT_OPERAND0();
814+
next_oparg = (int)CURRENT_OPERAND0();
815815
#endif
816816
_PyStackRef *target_local = &GETLOCAL(next_oparg);
817817
assert(PyUnicode_CheckExact(left_o));
@@ -5250,7 +5250,7 @@ dummy_func(
52505250
if (frame->lltrace >= 2) {
52515251
printf("SIDE EXIT: [UOp ");
52525252
_PyUOpPrint(&next_uop[-1]);
5253-
printf(", exit %lu, temp %d, target %d -> %s]\n",
5253+
printf(", exit %tu, temp %d, target %d -> %s]\n",
52545254
exit - current_executor->exits, exit->temperature.value_and_backoff,
52555255
(int)(target - _PyFrame_GetBytecode(frame)),
52565256
_PyOpcode_OpName[target->op.code]);

Python/executor_cases.c.h

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Python/generated_cases.c.h

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Python/optimizer_analysis.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,7 @@ remove_unneeded_uops(_PyUOpInstruction *buffer, int buffer_size)
642642
opcode = buffer[pc].opcode = op_without_pop[opcode];
643643
if (op_without_pop[last->opcode]) {
644644
opcode = last->opcode;
645-
pc = last - buffer;
645+
pc = (int)(last - buffer);
646646
}
647647
}
648648
else if (last->opcode == _PUSH_NULL) {

Python/optimizer_bytecodes.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ dummy_func(void) {
316316
assert(PyLong_CheckExact(sym_get_const(ctx, sub_st)));
317317
long index = PyLong_AsLong(sym_get_const(ctx, sub_st));
318318
assert(index >= 0);
319-
int tuple_length = sym_tuple_length(tuple_st);
319+
Py_ssize_t tuple_length = sym_tuple_length(tuple_st);
320320
if (tuple_length == -1) {
321321
// Unknown length
322322
res = sym_new_not_null(ctx);
@@ -1166,9 +1166,9 @@ dummy_func(void) {
11661166

11671167
op(_CALL_LEN, (callable, null, arg -- res)) {
11681168
res = sym_new_type(ctx, &PyLong_Type);
1169-
int tuple_length = sym_tuple_length(arg);
1169+
Py_ssize_t tuple_length = sym_tuple_length(arg);
11701170
if (tuple_length >= 0) {
1171-
PyObject *temp = PyLong_FromLong(tuple_length);
1171+
PyObject *temp = PyLong_FromSsize_t(tuple_length);
11721172
if (temp == NULL) {
11731173
goto error;
11741174
}
@@ -1182,13 +1182,13 @@ dummy_func(void) {
11821182
}
11831183

11841184
op(_GET_LEN, (obj -- obj, len)) {
1185-
int tuple_length = sym_tuple_length(obj);
1185+
Py_ssize_t tuple_length = sym_tuple_length(obj);
11861186
if (tuple_length == -1) {
11871187
len = sym_new_type(ctx, &PyLong_Type);
11881188
}
11891189
else {
11901190
assert(tuple_length >= 0);
1191-
PyObject *temp = PyLong_FromLong(tuple_length);
1191+
PyObject *temp = PyLong_FromSsize_t(tuple_length);
11921192
if (temp == NULL) {
11931193
goto error;
11941194
}

Python/optimizer_cases.c.h

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Python/optimizer_symbols.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -667,7 +667,7 @@ _Py_uop_sym_new_tuple(JitOptContext *ctx, int size, JitOptRef *args)
667667
}
668668

669669
JitOptRef
670-
_Py_uop_sym_tuple_getitem(JitOptContext *ctx, JitOptRef ref, int item)
670+
_Py_uop_sym_tuple_getitem(JitOptContext *ctx, JitOptRef ref, Py_ssize_t item)
671671
{
672672
JitOptSymbol *sym = PyJitRef_Unwrap(ref);
673673
assert(item >= 0);
@@ -683,7 +683,7 @@ _Py_uop_sym_tuple_getitem(JitOptContext *ctx, JitOptRef ref, int item)
683683
return _Py_uop_sym_new_not_null(ctx);
684684
}
685685

686-
int
686+
Py_ssize_t
687687
_Py_uop_sym_tuple_length(JitOptRef ref)
688688
{
689689
JitOptSymbol *sym = PyJitRef_Unwrap(ref);

0 commit comments

Comments
 (0)