diff --git a/src/mono/mono.proj b/src/mono/mono.proj
index afde59eeda04a4..bc0e097b82376e 100644
--- a/src/mono/mono.proj
+++ b/src/mono/mono.proj
@@ -50,6 +50,11 @@
+
+
+ <_MonoCMakeArgs Include="-DENABLE_WERROR=1"/>
+
+
diff --git a/src/mono/mono/eventpipe/ep-rt-mono.h b/src/mono/mono/eventpipe/ep-rt-mono.h
index a70bb119940748..6cc6636a5a1848 100644
--- a/src/mono/mono/eventpipe/ep-rt-mono.h
+++ b/src/mono/mono/eventpipe/ep-rt-mono.h
@@ -313,7 +313,6 @@ prefix_name ## _rt_ ## type_name ## _ ## func_name
typedef MonoThreadStart ep_rt_thread_start_func;
typedef mono_thread_start_return_t ep_rt_thread_start_func_return_t;
-typedef MonoNativeThreadId ep_rt_thread_id_t;
typedef EventPipeThreadHolder * (*ep_rt_thread_holder_alloc_func)(void);
typedef void (*ep_rt_thread_holder_free_func)(EventPipeThreadHolder *thread_holder);
@@ -1376,13 +1375,13 @@ ep_rt_processors_get_count (void)
static
inline
-size_t
+ep_rt_thread_id_t
ep_rt_current_thread_get_id (void)
{
#ifdef EP_RT_MONO_USE_STATIC_RUNTIME
- return MONO_NATIVE_THREAD_ID_TO_UINT (mono_native_thread_id_get ());
+ return mono_native_thread_id_get ();
#else
- return MONO_NATIVE_THREAD_ID_TO_UINT (ep_rt_mono_func_table_get ()->ep_rt_mono_native_thread_id_get ());
+ return ep_rt_mono_func_table_get ()->ep_rt_mono_native_thread_id_get ();
#endif
}
@@ -1848,10 +1847,26 @@ ep_rt_thread_get_handle (void)
static
inline
-size_t
+ep_rt_thread_id_t
ep_rt_thread_get_id (ep_rt_thread_handle_t thread_handle)
{
- return MONO_NATIVE_THREAD_ID_TO_UINT (mono_thread_info_get_tid (thread_handle));
+ return mono_thread_info_get_tid (thread_handle);
+}
+
+static
+inline
+uint64_t
+ep_rt_thread_id_t_to_uint64_t (ep_rt_thread_id_t thread_id)
+{
+ return (uint64_t)MONO_NATIVE_THREAD_ID_TO_UINT (thread_id);
+}
+
+static
+inline
+ep_rt_thread_id_t
+ep_rt_uint64_t_to_thread_id_t (uint64_t thread_id)
+{
+ return MONO_UINT_TO_NATIVE_THREAD_ID (thread_id);
}
static
diff --git a/src/mono/mono/eventpipe/ep-rt-types-mono.h b/src/mono/mono/eventpipe/ep-rt-types-mono.h
index 916c7378de2926..8fde364ef3fa4d 100644
--- a/src/mono/mono/eventpipe/ep-rt-types-mono.h
+++ b/src/mono/mono/eventpipe/ep-rt-types-mono.h
@@ -134,5 +134,7 @@ typedef struct _rt_mono_event_internal_t ep_rt_wait_event_handle_t;
typedef struct _rt_mono_lock_internal_t ep_rt_lock_handle_t;
typedef ep_rt_lock_handle_t ep_rt_spin_lock_handle_t;
+typedef MonoNativeThreadId ep_rt_thread_id_t;
+
#endif /* ENABLE_PERFTRACING */
#endif /* __EVENTPIPE_RT_TYPES_MONO_H__ */
diff --git a/src/mono/mono/metadata/fdhandle.c b/src/mono/mono/metadata/fdhandle.c
index 39e531b514c5ba..fd41505b8b666e 100644
--- a/src/mono/mono/metadata/fdhandle.c
+++ b/src/mono/mono/metadata/fdhandle.c
@@ -8,6 +8,7 @@ static MonoCoopMutex fds_mutex;
static MonoFDHandleCallback fds_callback[MONO_FDTYPE_COUNT];
static mono_lazy_init_t fds_init = MONO_LAZY_INIT_STATUS_NOT_INITIALIZED;
+#ifndef DISABLE_ASSERT_MESSAGES
static const gchar *types_str[] = {
"File",
"Console",
@@ -15,6 +16,7 @@ static const gchar *types_str[] = {
"Socket",
NULL
};
+#endif
static void
fds_remove (gpointer data)
diff --git a/src/mono/mono/metadata/icall.c b/src/mono/mono/metadata/icall.c
index 727889bd45675f..77f8c05ee0ea35 100644
--- a/src/mono/mono/metadata/icall.c
+++ b/src/mono/mono/metadata/icall.c
@@ -6061,7 +6061,6 @@ ves_icall_RuntimeType_get_core_clr_security_level (MonoReflectionTypeHandle rfie
return_val_if_nok (error, -1);
return mono_security_core_clr_class_level (klass);
}
-#endif
int
ves_icall_RuntimeFieldInfo_get_core_clr_security_level (MonoReflectionFieldHandle rfield, MonoError *error)
@@ -6076,6 +6075,7 @@ ves_icall_RuntimeMethodInfo_get_core_clr_security_level (MonoReflectionMethodHan
MonoMethod *method = MONO_HANDLE_GETVAL (rfield, method);
return mono_security_core_clr_method_level (method, TRUE);
}
+#endif
MonoStringHandle
ves_icall_System_Reflection_RuntimeAssembly_get_fullname (MonoReflectionAssemblyHandle assembly, MonoError *error)
@@ -6818,11 +6818,13 @@ mono_icall_module_get_hinstance (MonoImage *image)
}
#endif /* HOST_WIN32 */
+#ifndef ENABLE_NETCORE
gpointer
ves_icall_System_Reflection_RuntimeModule_GetHINSTANCE (MonoImage *image, MonoError *error)
{
return mono_icall_module_get_hinstance (image);
}
+#endif
void
ves_icall_System_Reflection_RuntimeModule_GetPEKind (MonoImage *image, gint32 *pe_kind, gint32 *machine, MonoError *error)
diff --git a/src/mono/mono/sgen/sgen-descriptor.c b/src/mono/mono/sgen/sgen-descriptor.c
index a959d2ecbe02ed..df72b4e692ed2c 100644
--- a/src/mono/mono/sgen/sgen-descriptor.c
+++ b/src/mono/mono/sgen/sgen-descriptor.c
@@ -129,7 +129,7 @@ mono_gc_make_descr_for_object (gsize *bitmap, int numbits, size_t obj_size)
}
if (first_set < 0) {
- SGEN_LOG (6, "Ptrfree descriptor %p, size: %ld", (void*)desc, (long)stored_size);
+ SGEN_LOG (6, "Ptrfree descriptor %" PRIu64 ", size: %zu", (uint64_t)desc, stored_size);
if (stored_size <= MAX_RUNLEN_OBJECT_SIZE && stored_size <= SGEN_MAX_SMALL_OBJ_SIZE)
return DESC_TYPE_SMALL_PTRFREE | stored_size;
return DESC_TYPE_COMPLEX_PTRFREE;
@@ -142,7 +142,7 @@ mono_gc_make_descr_for_object (gsize *bitmap, int numbits, size_t obj_size)
/* we know the 2-word header is ptr-free */
if (last_set < BITMAP_NUM_BITS + OBJECT_HEADER_WORDS && stored_size <= SGEN_MAX_SMALL_OBJ_SIZE) {
desc = DESC_TYPE_BITMAP | ((*bitmap >> OBJECT_HEADER_WORDS) << LOW_TYPE_BITS);
- SGEN_LOG (6, "Largebitmap descriptor %p, size: %ld, last set: %d", (void*)desc, (long)stored_size, last_set);
+ SGEN_LOG (6, "Largebitmap descriptor %" PRIu64 ", size: %zu, last set: %d", (uint64_t)desc, stored_size, last_set);
return desc;
}
@@ -153,7 +153,7 @@ mono_gc_make_descr_for_object (gsize *bitmap, int numbits, size_t obj_size)
*/
if (first_set < 256 && num_set < 256 && (first_set + num_set == last_set + 1)) {
desc = DESC_TYPE_RUN_LENGTH | stored_size | (first_set << 16) | (num_set << 24);
- SGEN_LOG (6, "Runlen descriptor %p, size: %ld, first set: %d, num set: %d", (void*)desc, (long)stored_size, first_set, num_set);
+ SGEN_LOG (6, "Runlen descriptor %" PRIu64 ", size: %zu, first set: %d, num set: %d", (uint64_t)desc, stored_size, first_set, num_set);
return desc;
}
}
diff --git a/src/native/eventpipe/ds-server.c b/src/native/eventpipe/ds-server.c
index ffc35bbba24e5a..ac1900caf1a736 100644
--- a/src/native/eventpipe/ds-server.c
+++ b/src/native/eventpipe/ds-server.c
@@ -209,7 +209,7 @@ ds_server_init (void)
ds_rt_auto_trace_init ();
ds_rt_auto_trace_launch ();
- ep_rt_thread_id_t thread_id = 0;
+ ep_rt_thread_id_t thread_id = ep_rt_uint64_t_to_thread_id_t (0);
if (!ep_rt_thread_create ((void *)server_thread, NULL, EP_THREAD_TYPE_SERVER, (void *)&thread_id)) {
// Failed to create IPC thread.
diff --git a/src/native/eventpipe/ep-buffer-manager.c b/src/native/eventpipe/ep-buffer-manager.c
index b767f9b668daa7..9c6e9c289c0a75 100644
--- a/src/native/eventpipe/ep-buffer-manager.c
+++ b/src/native/eventpipe/ep-buffer-manager.c
@@ -1161,7 +1161,7 @@ ep_buffer_manager_write_all_buffers_to_file_v4 (
if (buffer_manager->current_event == NULL)
break;
- size_t capture_thread_id = ep_thread_get_os_thread_id (ep_buffer_get_writer_thread (buffer_manager->current_buffer));
+ uint64_t capture_thread_id = ep_thread_get_os_thread_id (ep_buffer_get_writer_thread (buffer_manager->current_buffer));
EventPipeBufferList *buffer_list = buffer_manager->current_buffer_list;
diff --git a/src/native/eventpipe/ep-buffer.c b/src/native/eventpipe/ep-buffer.c
index 1bf06c81aa4f54..186eef25d8fdec 100644
--- a/src/native/eventpipe/ep-buffer.c
+++ b/src/native/eventpipe/ep-buffer.c
@@ -110,7 +110,7 @@ ep_buffer_write_event (
(EventPipeEventInstance *)buffer->current,
ep_event,
proc_number,
- (thread == NULL) ? ep_rt_current_thread_get_id () : ep_rt_thread_get_id (thread),
+ ep_rt_thread_id_t_to_uint64_t((thread == NULL) ? ep_rt_current_thread_get_id () : ep_rt_thread_get_id (thread)),
data_dest,
ep_event_payload_get_size (payload),
(thread == NULL) ? NULL : activity_id,
diff --git a/src/native/eventpipe/ep-config.c b/src/native/eventpipe/ep-config.c
index d840959ffcaae2..30335b0d490d67 100644
--- a/src/native/eventpipe/ep-config.c
+++ b/src/native/eventpipe/ep-config.c
@@ -383,7 +383,7 @@ ep_config_build_event_metadata_event (
instance = ep_event_metdata_event_alloc (
config->metadata_event,
ep_rt_current_processor_get_number (),
- ep_rt_current_thread_get_id (),
+ ep_rt_thread_id_t_to_uint64_t (ep_rt_current_thread_get_id ()),
instance_payload,
instance_payload_size,
NULL /* pActivityId */,
diff --git a/src/native/eventpipe/ep-event-instance.c b/src/native/eventpipe/ep-event-instance.c
index d609e7ef0458c6..d640438dbcfc1e 100644
--- a/src/native/eventpipe/ep-event-instance.c
+++ b/src/native/eventpipe/ep-event-instance.c
@@ -208,7 +208,7 @@ ep_event_instance_serialize_to_json_file (
ep_event_get_event_version (ep_event_instance->ep_event));
if (characters_written > 0 && characters_written < EP_ARRAY_SIZE (buffer))
- ep_json_file_write_event_data (json_file, ep_event_instance->timestamp, (ep_rt_thread_id_t)(ep_event_instance->thread_id), buffer, &ep_event_instance->stack_contents);
+ ep_json_file_write_event_data (json_file, ep_event_instance->timestamp, ep_rt_uint64_t_to_thread_id_t (ep_event_instance->thread_id), buffer, &ep_event_instance->stack_contents);
}
#else
void
diff --git a/src/native/eventpipe/ep-json-file.c b/src/native/eventpipe/ep-json-file.c
index fe7b9296a18517..d2674af0a5d169 100644
--- a/src/native/eventpipe/ep-json-file.c
+++ b/src/native/eventpipe/ep-json-file.c
@@ -9,6 +9,7 @@
#include "ep.h"
#include "ep-event-instance.h"
#include "ep-rt.h"
+#include
#ifdef EP_CHECKED_BUILD
@@ -134,7 +135,7 @@ ep_json_file_write_event_data (
json_file_write_string (json_file, buffer);
}
- characters_written = ep_rt_utf8_string_snprintf (buffer, EP_ARRAY_SIZE (buffer), "\"Thread (%ld)\"]},", (uint64_t)thread_id);
+ characters_written = ep_rt_utf8_string_snprintf (buffer, EP_ARRAY_SIZE (buffer), "\"Thread (%" PRIu64 ")\"]},", ep_rt_thread_id_t_to_uint64_t (thread_id));
if (characters_written > 0 && characters_written < EP_ARRAY_SIZE (buffer))
json_file_write_string (json_file, buffer);
}
diff --git a/src/native/eventpipe/ep-rt.h b/src/native/eventpipe/ep-rt.h
index cbe82dc95944a1..52d65e61a31c2d 100644
--- a/src/native/eventpipe/ep-rt.h
+++ b/src/native/eventpipe/ep-rt.h
@@ -468,7 +468,7 @@ uint32_t
ep_rt_processors_get_count (void);
static
-size_t
+ep_rt_thread_id_t
ep_rt_current_thread_get_id (void);
static
@@ -690,9 +690,17 @@ ep_rt_thread_handle_t
ep_rt_thread_get_handle (void);
static
-size_t
+ep_rt_thread_id_t
ep_rt_thread_get_id (ep_rt_thread_handle_t thread_handle);
+static
+uint64_t
+ep_rt_thread_id_t_to_uint64_t (ep_rt_thread_id_t thread_id);
+
+static
+ep_rt_thread_id_t
+ep_rt_uint64_t_to_thread_id_t (uint64_t thread_id);
+
static
bool
ep_rt_thread_has_started (ep_rt_thread_handle_t thread_handle);
diff --git a/src/native/eventpipe/ep-sample-profiler.c b/src/native/eventpipe/ep-sample-profiler.c
index 0bbea13ea87849..615ceeac9727da 100644
--- a/src/native/eventpipe/ep-sample-profiler.c
+++ b/src/native/eventpipe/ep-sample-profiler.c
@@ -210,7 +210,7 @@ sample_profiler_enable (void)
if (!ep_rt_wait_event_is_valid (&_thread_shutdown_event))
EP_ASSERT (!"Unable to create sample profiler event.");
- ep_rt_thread_id_t thread_id = 0;
+ ep_rt_thread_id_t thread_id = ep_rt_uint64_t_to_thread_id_t (0);
if (!ep_rt_thread_create (sampling_thread, NULL, EP_THREAD_TYPE_SAMPLING, &thread_id))
EP_ASSERT (!"Unable to create sample profiler thread.");
diff --git a/src/native/eventpipe/ep-session.c b/src/native/eventpipe/ep-session.c
index 72214042929416..02a3bce5976883 100644
--- a/src/native/eventpipe/ep-session.c
+++ b/src/native/eventpipe/ep-session.c
@@ -94,7 +94,7 @@ session_create_ipc_streaming_thread (EventPipeSession *session)
if (!ep_rt_wait_event_is_valid (&session->rt_thread_shutdown_event))
EP_ASSERT (!"Unable to create IPC stream flushing thread shutdown event.");
- ep_rt_thread_id_t thread_id = 0;
+ ep_rt_thread_id_t thread_id = ep_rt_uint64_t_to_thread_id_t (0);
if (!ep_rt_thread_create ((void *)streaming_thread, (void *)session, EP_THREAD_TYPE_SESSION, &thread_id))
EP_ASSERT (!"Unable to create IPC stream flushing thread.");
}
diff --git a/src/native/eventpipe/ep-thread.c b/src/native/eventpipe/ep-thread.c
index 33e246ffcdc1d7..9632ce775d966c 100644
--- a/src/native/eventpipe/ep-thread.c
+++ b/src/native/eventpipe/ep-thread.c
@@ -35,7 +35,7 @@ ep_thread_alloc (void)
ep_rt_spin_lock_alloc (&instance->rt_lock);
ep_raise_error_if_nok (ep_rt_spin_lock_is_valid (&instance->rt_lock));
- instance->os_thread_id = ep_rt_current_thread_get_id ();
+ instance->os_thread_id = ep_rt_thread_id_t_to_uint64_t (ep_rt_current_thread_get_id ());
memset (instance->session_state, 0, sizeof (instance->session_state));
EP_SPIN_LOCK_ENTER (&_ep_threads_lock, section1)
diff --git a/src/native/eventpipe/ep-thread.h b/src/native/eventpipe/ep-thread.h
index d982e33d73ca11..1f62102a24a0ca 100644
--- a/src/native/eventpipe/ep-thread.h
+++ b/src/native/eventpipe/ep-thread.h
@@ -37,7 +37,7 @@ struct _EventPipeThread_Internal {
ep_rt_spin_lock_handle_t rt_lock;
// This is initialized when the Thread object is first constructed and remains
// immutable afterwards.
- size_t os_thread_id;
+ uint64_t os_thread_id;
// The EventPipeThreadHolder maintains one count while the thread is alive
// and each session's EventPipeBufferList maintains one count while it
// exists.
@@ -69,7 +69,7 @@ ep_thread_get_activity_id_cref (ep_rt_thread_activity_id_handle_t activity_id_ha
EP_DEFINE_GETTER(EventPipeThread *, thread, EventPipeSession *, rundown_session);
EP_DEFINE_SETTER(EventPipeThread *, thread, EventPipeSession *, rundown_session);
EP_DEFINE_GETTER_REF(EventPipeThread *, thread, ep_rt_spin_lock_handle_t *, rt_lock);
-EP_DEFINE_GETTER(EventPipeThread *, thread, size_t, os_thread_id);
+EP_DEFINE_GETTER(EventPipeThread *, thread, uint64_t, os_thread_id);
EP_DEFINE_GETTER_REF(EventPipeThread *, thread, int32_t *, ref_count);
EventPipeThread *