Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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 @@ -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;
Copy link
Member Author

Choose a reason for hiding this comment

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

incompatible pointer types passing 'int *' to parameter of type 'PDWORD' (aka 'unsigned long *') [-Wincompatible-pointer-types]

int failed = !VirtualProtect(memory, size, PAGE_EXECUTE_READ, &old);
#else
__builtin___clear_cache((char *)memory, (char *)memory + size);
Expand Down
5 changes: 3 additions & 2 deletions Python/optimizer.c
Original file line number Diff line number Diff line change
Expand Up @@ -1045,7 +1045,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));
Expand Down Expand Up @@ -1487,7 +1487,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
Expand Down Expand Up @@ -2131,6 +2131,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;
}
Expand Down
8 changes: 4 additions & 4 deletions Python/optimizer_analysis.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Copy link
Member Author

Choose a reason for hiding this comment

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

Here and below

warning C4334: '<<': result of 32-bit shift implicitly converted to 64 bits

return i;
}
}
Expand All @@ -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
Expand Down Expand Up @@ -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;

Expand Down
13 changes: 8 additions & 5 deletions Python/optimizer_bytecodes.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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)) {
Copy link
Member Author

Choose a reason for hiding this comment

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

descr/4 was missing here. The code generator "takes" it from bytecodes.c, hence the

PyObject *descr = (PyObject *)this_instr->operand0;

line was already in optimizer_cases.h without it.

The (void)descr; below then silences the unused warning.

(void)descr;
res = sym_new_not_null(ctx);
l = left;
r = right;
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -951,7 +954,7 @@ dummy_func(void) {
ctx->done = true;
break;
}
int returning_stacklevel = this_instr->operand1;
int returning_stacklevel = (int)this_instr->operand1;
Copy link
Member Author

Choose a reason for hiding this comment

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

Here and below

warning C4244: 'initializing': conversion from 'uint64_t' to 'int', possible loss of data

if (ctx->curr_frame_depth >= 2) {
PyCodeObject *expected_code = ctx->frames[ctx->curr_frame_depth - 2].code;
if (expected_code == returning_code) {
Expand Down Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand Down
11 changes: 7 additions & 4 deletions Python/optimizer_cases.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading