Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
3 changes: 0 additions & 3 deletions src/mono/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ if (MSVC)
if(EXISTS ${CLR_SOURCELINK_FILE_PATH})
add_link_options("/sourcelink:${CLR_SOURCELINK_FILE_PATH}")
endif()

# FIXME: Remove the line below when https://github.com/dotnet/runtime/issues/91249 is fixed.
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4244>) # conversion from 'type1' to 'type2', possible loss of data
endif(MSVC)

set(CROSS_ROOTFS $ENV{ROOTFS_DIR})
Expand Down
6 changes: 3 additions & 3 deletions src/mono/mono/component/debugger-agent.c
Original file line number Diff line number Diff line change
Expand Up @@ -8855,7 +8855,7 @@ type_commands_internal (int command, MonoClass *klass, MonoDomain *domain, guint
buffer_add_objid (buf, obj);
if (CHECK_ICORDBG (TRUE))
{
buffer_add_byte(buf, m_class_is_valuetype (klass));
buffer_add_byte(buf, GINT_TO_UINT8(m_class_is_valuetype (klass)));
if (m_class_is_valuetype (klass))
{
int nfields = 0;
Expand Down Expand Up @@ -8950,7 +8950,7 @@ type_commands_internal (int command, MonoClass *klass, MonoDomain *domain, guint
case MDBGPROT_CMD_TYPE_ELEMENT_TYPE:
{
buffer_add_int (buf, m_class_get_byval_arg (klass)->type);
buffer_add_byte (buf, MONO_TYPE_ISSTRUCT (m_class_get_byval_arg (klass)));
buffer_add_byte (buf, GINT_TO_UINT8 (MONO_TYPE_ISSTRUCT (m_class_get_byval_arg (klass))));
break;
}
case MDBGPROT_CMD_TYPE_RANK:
Expand Down Expand Up @@ -10141,7 +10141,7 @@ array_commands (int command, guint8 *p, guint8 *end, Buffer *buf)
{
buffer_add_typeid (buf, arr->obj.vtable->domain, m_class_get_element_class (arr->obj.vtable->klass));
if (CHECK_ICORDBG (TRUE))
buffer_add_byte (buf, MONO_TYPE_ISSTRUCT (m_class_get_byval_arg (m_class_get_element_class (arr->obj.vtable->klass))));
buffer_add_byte (buf, GINT_TO_UINT8 (MONO_TYPE_ISSTRUCT (m_class_get_byval_arg (m_class_get_element_class (arr->obj.vtable->klass)))));
}
}
break;
Expand Down
4 changes: 1 addition & 3 deletions src/mono/mono/eglib/giconv.c
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,6 @@ g_unichar_to_utf8 (gunichar c, gchar *outbuf)
static FORCE_INLINE (int)
g_unichar_to_utf16_endian (gunichar c, gunichar2 *outbuf, unsigned endian)
{
gunichar c2;

if (c < 0xd800) {
if (outbuf)
*outbuf = (gunichar2) (endian == G_BIG_ENDIAN ? GUINT16_TO_BE(c) : GUINT16_TO_LE(c));
Expand All @@ -253,7 +251,7 @@ g_unichar_to_utf16_endian (gunichar c, gunichar2 *outbuf, unsigned endian)
return 1;
} else if (c < 0x110000) {
if (outbuf) {
c2 = c - 0x10000;
gunichar2 c2 = (gunichar2)(c - 0x10000);

gunichar2 part1 = (c2 >> 10) + 0xd800;
gunichar2 part2 = (c2 & 0x3ff) + 0xdc00;
Expand Down
4 changes: 2 additions & 2 deletions src/mono/mono/eventpipe/ep-rt-mono-runtime-provider.c
Original file line number Diff line number Diff line change
Expand Up @@ -3729,7 +3729,7 @@ buffer_gc_event_object_reference_callback (
sizeof (object_size) +
sizeof (object_type) +
sizeof (edge_count) +
(edge_count * sizeof (uintptr_t));
GUINT64_TO_UINT32 (edge_count * sizeof (uintptr_t));

EP_ASSERT (context->buffer);
EP_ASSERT (context->buffer->context);
Expand Down Expand Up @@ -3775,7 +3775,7 @@ flush_gc_event_bulk_root_static_vars (GCHeapDumpContext *context)
context->bulk_root_static_vars.count,
(uint64_t)mono_get_root_domain (),
clr_instance_get_id (),
context->bulk_root_static_vars.data_current - context->bulk_root_static_vars.data_start,
GPTRDIFF_TO_INT (context->bulk_root_static_vars.data_current - context->bulk_root_static_vars.data_start),
context->bulk_root_static_vars.data_start,
NULL,
NULL);
Expand Down
2 changes: 1 addition & 1 deletion src/mono/mono/metadata/icall.c
Original file line number Diff line number Diff line change
Expand Up @@ -2827,7 +2827,7 @@ ves_icall_RuntimeType_GetCallingConventionFromFunctionPointerInternal (MonoQCall
MonoType *type = type_handle.type;
g_assert (type->type == MONO_TYPE_FNPTR);
// FIXME: Once we address: https://github.com/dotnet/runtime/issues/90308 this should not be needed anymore
return type->data.method->suppress_gc_transition ? MONO_CALL_UNMANAGED_MD : type->data.method->call_convention;
return GUINT_TO_INT8 (type->data.method->suppress_gc_transition ? MONO_CALL_UNMANAGED_MD : type->data.method->call_convention);
}

MonoBoolean
Expand Down
2 changes: 1 addition & 1 deletion src/mono/mono/metadata/sgen-client-mono.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ enum {
};

static inline mword
sgen_mono_array_size (GCVTable vtable, MonoArray *array, mword *bounds_size, mword descr)
sgen_mono_array_size (GCVTable vtable, MonoArray *array, mword *bounds_size, SgenDescriptor descr)
{
mword size, size_without_bounds;
int element_size;
Expand Down
12 changes: 6 additions & 6 deletions src/mono/mono/metadata/sgen-mono.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ ptr_on_stack (void *ptr)
} while (0)

static void
scan_object_for_binary_protocol_copy_wbarrier (gpointer dest, char *start, mword desc)
scan_object_for_binary_protocol_copy_wbarrier (gpointer dest, char *start, SgenDescriptor desc)
{
#define SCAN_OBJECT_NOVTABLE
#include "sgen/sgen-scan-object.h"
Expand Down Expand Up @@ -127,7 +127,7 @@ mono_gc_wbarrier_value_copy_internal (gpointer dest, gconstpointer src, int coun
for (i = 0; i < count; ++i) {
scan_object_for_binary_protocol_copy_wbarrier ((char*)dest + i * element_size,
(char*)src + i * element_size - MONO_ABI_SIZEOF (MonoObject),
(mword) m_class_get_gc_descr (klass));
m_class_get_gc_descr (klass));
}
}
#endif
Expand Down Expand Up @@ -157,7 +157,7 @@ mono_gc_wbarrier_object_copy_internal (MonoObject* obj, MonoObject *src)

#ifdef SGEN_HEAVY_BINARY_PROTOCOL
if (sgen_binary_protocol_is_heavy_enabled ())
scan_object_for_binary_protocol_copy_wbarrier (obj, (char*)src, (mword) src->vtable->gc_descr);
scan_object_for_binary_protocol_copy_wbarrier (obj, (char*)src, src->vtable->gc_descr);
#endif

sgen_get_remset ()->wbarrier_object_copy (obj, src);
Expand Down Expand Up @@ -982,7 +982,7 @@ sgen_client_cardtable_scan_object (GCObject *obj, guint8 *cards, ScanCopyContext
size_t card_count;
size_t extra_idx = 0;

mword desc = (mword)m_class_get_gc_descr (m_class_get_element_class (klass));
SgenDescriptor desc = m_class_get_gc_descr (m_class_get_element_class (klass));
int elem_size = mono_array_element_size (klass);

#ifdef SGEN_OBJECT_LAYOUT_STATISTICS
Expand Down Expand Up @@ -1297,7 +1297,7 @@ two_args_report_root (void *address, MonoObject *obj, void *gc_data)
}

static void
precisely_report_roots_from (GCRootReport *report, void** start_root, void** end_root, mword desc)
precisely_report_roots_from (GCRootReport *report, void** start_root, void** end_root, SgenDescriptor desc)
{
switch (desc & ROOT_DESC_TYPE_MASK) {
case ROOT_DESC_BITMAP:
Expand Down Expand Up @@ -1850,7 +1850,7 @@ static void
collect_references (HeapWalkInfo *hwi, GCObject *obj, size_t size)
{
char *start = (char*)obj;
mword desc = sgen_obj_get_descriptor (obj);
SgenDescriptor desc = sgen_obj_get_descriptor (obj);

#include "sgen/sgen-scan-object.h"
}
Expand Down
2 changes: 1 addition & 1 deletion src/mono/mono/metadata/sgen-new-bridge.c
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ dfs1 (HashEntry *obj_entry)

if (!obj_entry->v.dfs1.is_visited) {
int num_links = 0;
mword desc = sgen_obj_get_descriptor_safe (obj);
SgenDescriptor desc = sgen_obj_get_descriptor_safe (obj);

obj_entry->v.dfs1.is_visited = 1;

Expand Down
4 changes: 2 additions & 2 deletions src/mono/mono/metadata/sgen-tarjan-bridge.c
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,7 @@ push_all (ScanData *data)
{
GCObject *obj = data->obj;
char *start = (char*)obj;
mword desc = sgen_obj_get_descriptor_safe (obj);
SgenDescriptor desc = sgen_obj_get_descriptor_safe (obj);

#if DUMP_GRAPH
printf ("+scanning %s (%p) index %d color %p\n", safe_name_bridge (data->obj), data->obj, data->index, data->color);
Expand Down Expand Up @@ -741,7 +741,7 @@ compute_low (ScanData *data)
{
GCObject *obj = data->obj;
char *start = (char*)obj;
mword desc = sgen_obj_get_descriptor_safe (obj);
SgenDescriptor desc = sgen_obj_get_descriptor_safe (obj);

#include "sgen/sgen-scan-object.h"
}
Expand Down
2 changes: 1 addition & 1 deletion src/mono/mono/metadata/weak-hash.c
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ rehash (MonoWeakHashTable *hash)
* Rehash to a size that can fit the current elements. Rehash relative to in_use
* to allow also for compaction.
*/
data.new_size = g_spaced_primes_closest (hash->in_use / HASH_TABLE_MAX_LOAD_FACTOR * HASH_TABLE_RESIZE_RATIO);
data.new_size = g_spaced_primes_closest (GFLOAT_TO_UINT (hash->in_use / HASH_TABLE_MAX_LOAD_FACTOR * HASH_TABLE_RESIZE_RATIO));

MonoArray *holder = (MonoArray*)mono_gchandle_get_target_internal (hash->key_value_handle);
g_assert (holder);
Expand Down
5 changes: 2 additions & 3 deletions src/mono/mono/mini/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -364,9 +364,8 @@ elseif(NOT HOST_BROWSER AND NOT HOST_WASI)
set(mini_sources "${mini_sources};${VERSION_FILE_PATH}") # this is generated by GenerateNativeVersionFile in Arcade
endif()

if(HOST_WIN32)
set_source_files_properties(${ZLIB_SOURCES} PROPERTIES COMPILE_OPTIONS "/wd4005;/wd4127;/wd4131;/wd4244")
endif()
set_source_files_properties(${ZLIB_SOURCES} PROPERTIES COMPILE_DEFINITIONS "${ZLIB_COMPILE_DEFINITIONS}")
set_source_files_properties(${ZLIB_SOURCES} PROPERTIES COMPILE_OPTIONS "${ZLIB_COMPILE_OPTIONS}")

set(monosgen-sources "${mini_sources};${ZLIB_SOURCES}")

Expand Down
8 changes: 4 additions & 4 deletions src/mono/mono/mini/aot-compiler.c
Original file line number Diff line number Diff line change
Expand Up @@ -11400,7 +11400,7 @@ encode_uint_len (guint32 val, int len, guint8 *buf, guint8 **endbuf)
{
if (len == 2) {
g_assert (val < 65536);
encode_int16 (val, buf, endbuf);
encode_int16 (GUINT32_TO_UINT16 (val), buf, endbuf);
} else {
encode_int ((gint32)val, buf, endbuf);
}
Expand Down Expand Up @@ -11454,7 +11454,7 @@ emit_extra_methods (MonoAotCompile *acfg)
* Construct a chained hash table for mapping indexes in extra_method_info to
* method indexes.
*/
guint table_size = g_spaced_primes_closest ((guint)(nmethods * 1.5));
guint table_size = g_spaced_primes_closest (GFLOAT_TO_UINT (nmethods * 1.5));
table = g_ptr_array_sized_new (table_size);
for (guint i = 0; i < table_size; ++i)
g_ptr_array_add (table, NULL);
Expand Down Expand Up @@ -11732,7 +11732,7 @@ emit_class_name_table (MonoAotCompile *acfg)
* Construct a chained hash table for mapping class names to typedef tokens.
*/
guint32 rows = table_info_get_rows (&acfg->image->tables [MONO_TABLE_TYPEDEF]);
guint table_size = g_spaced_primes_closest (rows * 1.5);
guint table_size = g_spaced_primes_closest (GFLOAT_TO_UINT (rows * 1.5));
table = g_ptr_array_sized_new (table_size);
for (guint i = 0; i < table_size; ++i)
g_ptr_array_add (table, NULL);
Expand Down Expand Up @@ -12091,7 +12091,7 @@ emit_globals (MonoAotCompile *acfg)
* Construct a chained hash table for mapping global names to their index in
* the globals table.
*/
guint table_size = g_spaced_primes_closest (acfg->globals->len * 1.5);
guint table_size = g_spaced_primes_closest (GFLOAT_TO_UINT (acfg->globals->len * 1.5));
table = g_ptr_array_sized_new (table_size);
for (guint i = 0; i < table_size; ++i)
g_ptr_array_add (table, NULL);
Expand Down
14 changes: 6 additions & 8 deletions src/mono/mono/mini/aot-runtime.c
Original file line number Diff line number Diff line change
Expand Up @@ -2269,17 +2269,15 @@ load_aot_module (MonoAssemblyLoadContext *alc, MonoAssembly *assembly, gpointer

if (make_unreadable) {
#ifndef TARGET_WIN32
guint8 *addr;
guint8 *page_start, *page_end;
int err, len;
int err;

addr = amodule->mem_begin;
g_assert (addr);
len = amodule->mem_end - amodule->mem_begin;
g_assert (amodule->mem_begin);
g_assert (amodule->mem_end);

/* Round down in both directions to avoid modifying data which is not ours */
page_start = (guint8 *) (((gssize) (addr)) & ~ (mono_pagesize () - 1)) + mono_pagesize ();
page_end = (guint8 *) (((gssize) (addr + len)) & ~ (mono_pagesize () - 1));
page_start = (guint8 *) (((gssize) (amodule->mem_begin)) & ~ (mono_pagesize () - 1)) + mono_pagesize ();
page_end = (guint8 *) (((gssize) (amodule->mem_end)) & ~ (mono_pagesize () - 1));
if (page_end > page_start) {
err = mono_mprotect (page_start, (page_end - page_start), MONO_MMAP_NONE);
g_assert (err == 0);
Expand Down Expand Up @@ -3736,7 +3734,7 @@ mono_aot_find_jit_info (MonoImage *image, gpointer addr)
/* Unused */
int len = mono_jit_info_size (0, 0, 0);
jinfo = (MonoJitInfo *)alloc0_jit_info_data (mem_manager, len, async);
mono_jit_info_init (jinfo, method, code, code_len, 0, 0, 0);
mono_jit_info_init (jinfo, method, code, GPTRDIFF_TO_INT (code_len), 0, 0, 0);
} else {
jinfo = decode_exception_debug_info (amodule, method, ex_info, code, GPTRDIFF_TO_UINT32 (code_len));
}
Expand Down
2 changes: 1 addition & 1 deletion src/mono/mono/mini/graph.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,6 @@ mono_draw_graph (MonoCompile *cfg, MonoGraphOptions draw_options)
#endif
const char *fn;
FILE *fp;
int _i G_GNUC_UNUSED;

fn = "/tmp/minidtree.graph";
fp = fopen (fn, "w+");
Expand All @@ -228,6 +227,7 @@ mono_draw_graph (MonoCompile *cfg, MonoGraphOptions draw_options)
#ifdef HAVE_SYSTEM
//com = g_strdup_printf ("dot %s -Tpng -o %s.png; eog %s.png", fn, fn, fn);
com = g_strdup_printf ("dot %s -Tps -o %s.ps;gv %s.ps", fn, fn, fn);
int _i G_GNUC_UNUSED;
_i = system (com);
g_free (com);
#else
Expand Down
2 changes: 1 addition & 1 deletion src/mono/mono/mini/helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ mono_disassemble_code (MonoCompile *cfg, guint8 *code, int size, char *id)
#endif
char *as_file;
char *o_file;
int unused G_GNUC_UNUSED;

#ifdef HOST_WIN32
as_file = g_strdup_printf ("%s/test.s", tmp);
Expand Down Expand Up @@ -255,6 +254,7 @@ MONO_RESTORE_WARNING
#endif

#ifdef HAVE_SYSTEM
int unused G_GNUC_UNUSED;
char *cmd = g_strdup_printf (ARCH_PREFIX AS_CMD " %s -o %s", as_file, o_file);
unused = system (cmd);
g_free (cmd);
Expand Down
Loading