fix warnings in jit builds (GH-144817)

This commit is contained in:
Chris Eibl 2026-02-14 18:39:10 +01:00 committed by GitHub
parent 14cbd0e6af
commit caac966b00
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 23 additions and 16 deletions

View file

@ -164,7 +164,7 @@ mark_executable(unsigned char *memory, size_t size)
jit_error("unable to flush instruction cache");
return -1;
}
int old;
DWORD old;
int failed = !VirtualProtect(memory, size, PAGE_EXECUTE_READ, &old);
#else
__builtin___clear_cache((char *)memory, (char *)memory + size);

View file

@ -1044,7 +1044,7 @@ _PyJit_TryInitializeTracing(
tracer->initial_state.func = (PyFunctionObject *)Py_NewRef(func);
tracer->initial_state.executor = (_PyExecutorObject *)Py_XNewRef(current_executor);
tracer->initial_state.exit = exit;
tracer->initial_state.stack_depth = stack_pointer - _PyFrame_Stackbase(frame);
tracer->initial_state.stack_depth = (int)(stack_pointer - _PyFrame_Stackbase(frame));
tracer->initial_state.chain_depth = chain_depth;
tracer->prev_state.dependencies_still_valid = true;
tracer->prev_state.instr_code = (PyCodeObject *)Py_NewRef(_PyFrame_GetCode(frame));
@ -1486,7 +1486,7 @@ stack_allocate(_PyUOpInstruction *buffer, _PyUOpInstruction *output, int length)
write++;
depth = _PyUop_Caching[uop].entries[depth].output;
}
return write - output;
return (int)(write - output);
}
static int
@ -2130,6 +2130,7 @@ executor_to_gv(_PyExecutorObject *executor, FILE *out)
assert(inst->format == UOP_FORMAT_JUMP);
_PyUOpInstruction const *exit_inst = &executor->trace[inst->jump_target];
uint16_t base_exit_opcode = _PyUop_Uncached[exit_inst->opcode];
(void)base_exit_opcode;
assert(base_exit_opcode == _EXIT_TRACE || base_exit_opcode == _DYNAMIC_EXIT);
exit = (_PyExitData *)exit_inst->operand0;
}

View file

@ -398,7 +398,7 @@ get_test_bit_for_bools(void) {
uintptr_t true_bits = (uintptr_t)&_Py_TrueStruct;
#endif
for (int i = 4; i < 8; i++) {
if ((true_bits ^ false_bits) & (1 << i)) {
if ((true_bits ^ false_bits) & (uintptr_t)(1 << i)) {
return i;
}
}
@ -412,8 +412,8 @@ test_bit_set_in_true(int bit) {
#else
uintptr_t true_bits = (uintptr_t)&_Py_TrueStruct;
#endif
assert((true_bits ^ ((uintptr_t)&_Py_FalseStruct)) & (1 << bit));
return true_bits & (1 << bit);
assert((true_bits ^ ((uintptr_t)&_Py_FalseStruct)) & (uintptr_t)(1 << bit));
return true_bits & (uintptr_t)(1 << bit);
}
#ifdef Py_DEBUG
@ -504,7 +504,7 @@ optimize_uops(
stack_pointer = ctx->frame->stack_pointer;
}
DUMP_UOP(ctx, "abs", this_instr - trace, this_instr, stack_pointer);
DUMP_UOP(ctx, "abs", (int)(this_instr - trace), this_instr, stack_pointer);
_PyUOpInstruction *out_ptr = ctx->out_buffer.next;

View file

@ -109,11 +109,13 @@ dummy_func(void) {
}
op(_STORE_ATTR_INSTANCE_VALUE, (offset/1, value, owner -- o)) {
(void)offset;
(void)value;
o = owner;
}
op(_STORE_ATTR_WITH_HINT, (hint/1, value, owner -- o)) {
(void)hint;
(void)value;
o = owner;
}
@ -320,7 +322,8 @@ dummy_func(void) {
r = right;
}
op(_BINARY_OP_EXTEND, (left, right -- res, l, r)) {
op(_BINARY_OP_EXTEND, (descr/4, left, right -- res, l, r)) {
(void)descr;
res = sym_new_not_null(ctx);
l = left;
r = right;
@ -386,7 +389,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 && index < tuple_length) {
ADD_OP(_NOP, 0, 0);
}
@ -951,7 +954,7 @@ dummy_func(void) {
ctx->done = true;
break;
}
int returning_stacklevel = this_instr->operand1;
int returning_stacklevel = (int)this_instr->operand1;
if (ctx->curr_frame_depth >= 2) {
PyCodeObject *expected_code = ctx->frames[ctx->curr_frame_depth - 2].code;
if (expected_code == returning_code) {
@ -979,7 +982,7 @@ dummy_func(void) {
break;
}
_Py_BloomFilter_Add(dependencies, returning_code);
int returning_stacklevel = this_instr->operand1;
int returning_stacklevel = (int)this_instr->operand1;
if (frame_pop(ctx, returning_code, returning_stacklevel)) {
break;
}
@ -1001,7 +1004,7 @@ dummy_func(void) {
break;
}
_Py_BloomFilter_Add(dependencies, returning_code);
int returning_stacklevel = this_instr->operand1;
int returning_stacklevel = (int)this_instr->operand1;
if (frame_pop(ctx, returning_code, returning_stacklevel)) {
break;
}

View file

@ -896,6 +896,7 @@
right = stack_pointer[-1];
left = stack_pointer[-2];
PyObject *descr = (PyObject *)this_instr->operand0;
(void)descr;
res = sym_new_not_null(ctx);
l = left;
r = right;
@ -1046,7 +1047,7 @@
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 && index < tuple_length) {
ADD_OP(_NOP, 0, 0);
}
@ -1271,7 +1272,7 @@
ctx->done = true;
break;
}
int returning_stacklevel = this_instr->operand1;
int returning_stacklevel = (int)this_instr->operand1;
if (ctx->curr_frame_depth >= 2) {
PyCodeObject *expected_code = ctx->frames[ctx->curr_frame_depth - 2].code;
if (expected_code == returning_code) {
@ -1351,7 +1352,7 @@
break;
}
_Py_BloomFilter_Add(dependencies, returning_code);
int returning_stacklevel = this_instr->operand1;
int returning_stacklevel = (int)this_instr->operand1;
if (frame_pop(ctx, returning_code, returning_stacklevel)) {
break;
}
@ -2033,6 +2034,7 @@
owner = stack_pointer[-1];
value = stack_pointer[-2];
uint16_t offset = (uint16_t)this_instr->operand0;
(void)offset;
(void)value;
o = owner;
CHECK_STACK_BOUNDS(-1);
@ -2049,6 +2051,7 @@
owner = stack_pointer[-1];
value = stack_pointer[-2];
uint16_t hint = (uint16_t)this_instr->operand0;
(void)hint;
(void)value;
o = owner;
CHECK_STACK_BOUNDS(-1);
@ -3595,7 +3598,7 @@
break;
}
_Py_BloomFilter_Add(dependencies, returning_code);
int returning_stacklevel = this_instr->operand1;
int returning_stacklevel = (int)this_instr->operand1;
if (frame_pop(ctx, returning_code, returning_stacklevel)) {
break;
}