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
5 changes: 5 additions & 0 deletions src/mono/mono.proj
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@
<PackageReference Include="$(MicrosoftNETCoreRuntimeICUTransportPackage)" PrivateAssets="all" Version="$(MicrosoftNETCoreRuntimeICUTransportVersion)" GeneratePathProperty="true" />
</ItemGroup>

<!-- CI specific build options -->
<ItemGroup Condition="'$(ContinuousIntegrationBuild)' == 'true' and ('$(TargetsOSX)' == 'true')">
<_MonoCMakeArgs Include="-DENABLE_WERROR=1"/>
</ItemGroup>

<!-- Sanity checks -->
<Target Name="CheckEnv">
<Error Condition="'$(TargetstvOS)' == 'true' and '$(Platform)' != 'x64' and '$(Platform)' != 'arm64'" Text="Error: Invalid platform for $(TargetOS): $(Platform)." />
Expand Down
27 changes: 21 additions & 6 deletions src/mono/mono/eventpipe/ep-rt-mono.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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
}

Expand Down Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions src/mono/mono/eventpipe/ep-rt-types-mono.h
Original file line number Diff line number Diff line change
Expand Up @@ -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__ */
2 changes: 2 additions & 0 deletions src/mono/mono/metadata/fdhandle.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ 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",
"Pipe",
"Socket",
NULL
};
#endif

static void
fds_remove (gpointer data)
Expand Down
4 changes: 3 additions & 1 deletion src/mono/mono/metadata/icall.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions src/mono/mono/sgen/sgen-descriptor.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}

Expand All @@ -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;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/native/eventpipe/ds-server.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion src/native/eventpipe/ep-buffer-manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion src/native/eventpipe/ep-buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/native/eventpipe/ep-config.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */,
Expand Down
2 changes: 1 addition & 1 deletion src/native/eventpipe/ep-event-instance.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion src/native/eventpipe/ep-json-file.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "ep.h"
#include "ep-event-instance.h"
#include "ep-rt.h"
#include <inttypes.h>

#ifdef EP_CHECKED_BUILD

Expand Down Expand Up @@ -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);
}
Expand Down
12 changes: 10 additions & 2 deletions src/native/eventpipe/ep-rt.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/native/eventpipe/ep-sample-profiler.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.");

Expand Down
2 changes: 1 addition & 1 deletion src/native/eventpipe/ep-session.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.");
}
Expand Down
2 changes: 1 addition & 1 deletion src/native/eventpipe/ep-thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions src/native/eventpipe/ep-thread.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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 *
Expand Down