]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-137136: Suppress build warnings when build on Windows with --experimental-jit...
authorAN Long <aisk@users.noreply.github.com>
Wed, 3 Sep 2025 14:42:26 +0000 (23:42 +0900)
committerGitHub <noreply@github.com>
Wed, 3 Sep 2025 14:42:26 +0000 (15:42 +0100)
Include/internal/pycore_optimizer.h
Misc/NEWS.d/next/Windows/2025-07-27-14-25-11.gh-issue-137136.xNthFT.rst [new file with mode: 0644]
Python/bytecodes.c
Python/executor_cases.c.h
Python/generated_cases.c.h
Python/optimizer_analysis.c
Python/optimizer_bytecodes.c
Python/optimizer_cases.c.h
Python/optimizer_symbols.c

index 9f930f2107ed5efd0bd816a3c67783c4c06cd7f4..3a5ae0a054ed3c4e295204af555e887105dbdf54 100644 (file)
@@ -332,8 +332,8 @@ extern bool _Py_uop_sym_is_bottom(JitOptRef sym);
 extern int _Py_uop_sym_truthiness(JitOptContext *ctx, JitOptRef sym);
 extern PyTypeObject *_Py_uop_sym_get_type(JitOptRef sym);
 extern JitOptRef _Py_uop_sym_new_tuple(JitOptContext *ctx, int size, JitOptRef *args);
-extern JitOptRef _Py_uop_sym_tuple_getitem(JitOptContext *ctx, JitOptRef sym, int item);
-extern int _Py_uop_sym_tuple_length(JitOptRef sym);
+extern JitOptRef _Py_uop_sym_tuple_getitem(JitOptContext *ctx, JitOptRef sym, Py_ssize_t item);
+extern Py_ssize_t _Py_uop_sym_tuple_length(JitOptRef sym);
 extern JitOptRef _Py_uop_sym_new_truthiness(JitOptContext *ctx, JitOptRef value, bool truthy);
 extern bool _Py_uop_sym_is_compact_int(JitOptRef sym);
 extern JitOptRef _Py_uop_sym_new_compact_int(JitOptContext *ctx);
diff --git a/Misc/NEWS.d/next/Windows/2025-07-27-14-25-11.gh-issue-137136.xNthFT.rst b/Misc/NEWS.d/next/Windows/2025-07-27-14-25-11.gh-issue-137136.xNthFT.rst
new file mode 100644 (file)
index 0000000..5c83af0
--- /dev/null
@@ -0,0 +1,2 @@
+Suppress build warnings when build on Windows with
+``--experimental-jit-interpreter``.
index 7f89c312b9a81567a5bf21202d570f250587424f..6c3609d293890f5aeba4f8659f04517818880fcc 100644 (file)
@@ -811,7 +811,7 @@ dummy_func(
             assert(next_instr->op.code == STORE_FAST);
             next_oparg = next_instr->op.arg;
         #else
-            next_oparg = CURRENT_OPERAND0();
+            next_oparg = (int)CURRENT_OPERAND0();
         #endif
             _PyStackRef *target_local = &GETLOCAL(next_oparg);
             assert(PyUnicode_CheckExact(left_o));
@@ -5250,7 +5250,7 @@ dummy_func(
             if (frame->lltrace >= 2) {
                 printf("SIDE EXIT: [UOp ");
                 _PyUOpPrint(&next_uop[-1]);
-                printf(", exit %lu, temp %d, target %d -> %s]\n",
+                printf(", exit %tu, temp %d, target %d -> %s]\n",
                     exit - current_executor->exits, exit->temperature.value_and_backoff,
                     (int)(target - _PyFrame_GetBytecode(frame)),
                     _PyOpcode_OpName[target->op.code]);
index 635ca659394c32eb7ffe39ff7ef6fecb97a5f995..1309c1317a6615875c5d3372069a0cd6211af2e9 100644 (file)
             assert(next_instr->op.code == STORE_FAST);
             next_oparg = next_instr->op.arg;
             #else
-            next_oparg = CURRENT_OPERAND0();
+            next_oparg = (int)CURRENT_OPERAND0();
             #endif
             _PyStackRef *target_local = &GETLOCAL(next_oparg);
             assert(PyUnicode_CheckExact(left_o));
                 _PyFrame_SetStackPointer(frame, stack_pointer);
                 printf("SIDE EXIT: [UOp ");
                 _PyUOpPrint(&next_uop[-1]);
-                printf(", exit %lu, temp %d, target %d -> %s]\n",
+                printf(", exit %tu, temp %d, target %d -> %s]\n",
                        exit - current_executor->exits, exit->temperature.value_and_backoff,
                        (int)(target - _PyFrame_GetBytecode(frame)),
                        _PyOpcode_OpName[target->op.code]);
index c3e37f080fa6e4340f5dbe3d150fbbd598d34d47..c1f6f5c85cdd883f6d68d7844f374365b8545011 100644 (file)
                 assert(next_instr->op.code == STORE_FAST);
                 next_oparg = next_instr->op.arg;
                 #else
-                next_oparg = CURRENT_OPERAND0();
+                next_oparg = (int)CURRENT_OPERAND0();
                 #endif
                 _PyStackRef *target_local = &GETLOCAL(next_oparg);
                 assert(PyUnicode_CheckExact(left_o));
index 533d70580e4cc01a0873ba17cc2bcc2ebdae0e40..fd395d3c6c254f7409ac224e020392faab226674 100644 (file)
@@ -642,7 +642,7 @@ remove_unneeded_uops(_PyUOpInstruction *buffer, int buffer_size)
                         opcode = buffer[pc].opcode = op_without_pop[opcode];
                         if (op_without_pop[last->opcode]) {
                             opcode = last->opcode;
-                            pc = last - buffer;
+                            pc = (int)(last - buffer);
                         }
                     }
                     else if (last->opcode == _PUSH_NULL) {
index 77759f67532f80acb5a03cd36eaed2ed26f004fb..781296dc7f48fcd0459ce0dcf4697d4e3eb14eb2 100644 (file)
@@ -316,7 +316,7 @@ dummy_func(void) {
             assert(PyLong_CheckExact(sym_get_const(ctx, sub_st)));
             long index = PyLong_AsLong(sym_get_const(ctx, sub_st));
             assert(index >= 0);
-            int tuple_length = sym_tuple_length(tuple_st);
+            Py_ssize_t tuple_length = sym_tuple_length(tuple_st);
             if (tuple_length == -1) {
                 // Unknown length
                 res = sym_new_not_null(ctx);
@@ -1166,9 +1166,9 @@ dummy_func(void) {
 
     op(_CALL_LEN, (callable, null, arg -- res)) {
         res = sym_new_type(ctx, &PyLong_Type);
-        int tuple_length = sym_tuple_length(arg);
+        Py_ssize_t tuple_length = sym_tuple_length(arg);
         if (tuple_length >= 0) {
-            PyObject *temp = PyLong_FromLong(tuple_length);
+            PyObject *temp = PyLong_FromSsize_t(tuple_length);
             if (temp == NULL) {
                 goto error;
             }
@@ -1182,13 +1182,13 @@ dummy_func(void) {
     }
 
     op(_GET_LEN, (obj -- obj, len)) {
-        int tuple_length = sym_tuple_length(obj);
+        Py_ssize_t tuple_length = sym_tuple_length(obj);
         if (tuple_length == -1) {
             len = sym_new_type(ctx, &PyLong_Type);
         }
         else {
             assert(tuple_length >= 0);
-            PyObject *temp = PyLong_FromLong(tuple_length);
+            PyObject *temp = PyLong_FromSsize_t(tuple_length);
             if (temp == NULL) {
                 goto error;
             }
index 2477ede3e680178dd3ad4c941715cea5991301f9..14e985b42ea0ce60eb9db467129c2883acd82465 100644 (file)
                 assert(PyLong_CheckExact(sym_get_const(ctx, sub_st)));
                 long index = PyLong_AsLong(sym_get_const(ctx, sub_st));
                 assert(index >= 0);
-                int tuple_length = sym_tuple_length(tuple_st);
+                Py_ssize_t tuple_length = sym_tuple_length(tuple_st);
                 if (tuple_length == -1) {
                     res = sym_new_not_null(ctx);
                 }
             JitOptRef obj;
             JitOptRef len;
             obj = stack_pointer[-1];
-            int tuple_length = sym_tuple_length(obj);
+            Py_ssize_t tuple_length = sym_tuple_length(obj);
             if (tuple_length == -1) {
                 len = sym_new_type(ctx, &PyLong_Type);
             }
             else {
                 assert(tuple_length >= 0);
-                PyObject *temp = PyLong_FromLong(tuple_length);
+                PyObject *temp = PyLong_FromSsize_t(tuple_length);
                 if (temp == NULL) {
                     goto error;
                 }
             JitOptRef res;
             arg = stack_pointer[-1];
             res = sym_new_type(ctx, &PyLong_Type);
-            int tuple_length = sym_tuple_length(arg);
+            Py_ssize_t tuple_length = sym_tuple_length(arg);
             if (tuple_length >= 0) {
-                PyObject *temp = PyLong_FromLong(tuple_length);
+                PyObject *temp = PyLong_FromSsize_t(tuple_length);
                 if (temp == NULL) {
                     goto error;
                 }
index 8169ce9df5aae64ed5afffc4f46b8c6d3ba1a134..c0a876ddc2c716a8234032bb3ed2f6737343bc2f 100644 (file)
@@ -667,7 +667,7 @@ _Py_uop_sym_new_tuple(JitOptContext *ctx, int size, JitOptRef *args)
 }
 
 JitOptRef
-_Py_uop_sym_tuple_getitem(JitOptContext *ctx, JitOptRef ref, int item)
+_Py_uop_sym_tuple_getitem(JitOptContext *ctx, JitOptRef ref, Py_ssize_t item)
 {
     JitOptSymbol *sym = PyJitRef_Unwrap(ref);
     assert(item >= 0);
@@ -683,7 +683,7 @@ _Py_uop_sym_tuple_getitem(JitOptContext *ctx, JitOptRef ref, int item)
     return _Py_uop_sym_new_not_null(ctx);
 }
 
-int
+Py_ssize_t
 _Py_uop_sym_tuple_length(JitOptRef ref)
 {
     JitOptSymbol *sym = PyJitRef_Unwrap(ref);