Thanks to visit codestin.com
Credit goes to github.com

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
4 changes: 2 additions & 2 deletions mono/metadata/icall.c
Original file line number Diff line number Diff line change
Expand Up @@ -4577,11 +4577,11 @@ ves_icall_System_Reflection_Assembly_InternalGetType (MonoReflectionAssemblyHand
if (!type) {
if (throwOnError) {
ERROR_DECL_VALUE (inner_error);
char *typename = mono_string_handle_to_utf8 (name, &inner_error);
char *type_name = mono_string_handle_to_utf8 (name, &inner_error);
mono_error_assert_ok (&inner_error);
MonoAssembly *assembly = MONO_HANDLE_GETVAL (assembly_h, assembly);
char *assmname = mono_stringify_assembly_name (&assembly->aname);
mono_error_set_type_load_name (error, typename, assmname, "%s", "");
mono_error_set_type_load_name (error, type_name, assmname, "%s", "");
goto fail;
}

Expand Down
8 changes: 4 additions & 4 deletions mono/metadata/sgen-client-mono.h
Original file line number Diff line number Diff line change
Expand Up @@ -379,18 +379,18 @@ static void
mono_binary_protocol_alloc_generic (gpointer obj, gpointer vtable, size_t size, gboolean pinned)
{
#ifdef ENABLE_DTRACE
const char *namespace = sgen_client_vtable_get_namespace (vtable);
const char *name_space = sgen_client_vtable_get_namespace (vtable);
const char *name = sgen_client_vtable_get_name (vtable);

if (sgen_ptr_in_nursery (obj)) {
if (G_UNLIKELY (MONO_GC_NURSERY_OBJ_ALLOC_ENABLED ()))
MONO_GC_NURSERY_OBJ_ALLOC ((mword)obj, size, namespace, name);
MONO_GC_NURSERY_OBJ_ALLOC ((mword)obj, size, name_space, name);
} else {
if (size > SGEN_MAX_SMALL_OBJ_SIZE) {
if (G_UNLIKELY (MONO_GC_MAJOR_OBJ_ALLOC_LARGE_ENABLED ()))
MONO_GC_MAJOR_OBJ_ALLOC_LARGE ((mword)obj, size, namespace, name);
MONO_GC_MAJOR_OBJ_ALLOC_LARGE ((mword)obj, size, name_space, name);
} else if (pinned) {
MONO_GC_MAJOR_OBJ_ALLOC_PINNED ((mword)obj, size, namespace, name);
MONO_GC_MAJOR_OBJ_ALLOC_PINNED ((mword)obj, size, name_space, name);
}
}
#endif
Expand Down
28 changes: 14 additions & 14 deletions mono/metadata/threadpool-worker-default.c
Original file line number Diff line number Diff line change
Expand Up @@ -307,20 +307,20 @@ mono_threadpool_worker_cleanup (void)
static void
work_item_push (void)
{
gint32 old, new;
gint32 old, new_;

do {
old = mono_atomic_load_i32 (&worker.work_items_count);
g_assert (old >= 0);

new = old + 1;
} while (mono_atomic_cas_i32 (&worker.work_items_count, new, old) != old);
new_ = old + 1;
} while (mono_atomic_cas_i32 (&worker.work_items_count, new_, old) != old);
}

static gboolean
work_item_try_pop (void)
{
gint32 old, new;
gint32 old, new_;

do {
old = mono_atomic_load_i32 (&worker.work_items_count);
Expand All @@ -329,8 +329,8 @@ work_item_try_pop (void)
if (old == 0)
return FALSE;

new = old - 1;
} while (mono_atomic_cas_i32 (&worker.work_items_count, new, old) != old);
new_ = old - 1;
} while (mono_atomic_cas_i32 (&worker.work_items_count, new_, old) != old);

return TRUE;
}
Expand Down Expand Up @@ -362,7 +362,7 @@ worker_park (void)
{
gboolean timeout = FALSE;
gboolean interrupted = FALSE;
gint32 old, new;
gint32 old, new_;

mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_THREADPOOL, "[%p] worker parking",
GUINT_TO_POINTER (MONO_NATIVE_THREAD_ID_TO_UINT (mono_native_thread_id_get ())));
Expand All @@ -385,8 +385,8 @@ worker_park (void)
old = mono_atomic_load_i32 (&worker.parked_threads_count);
g_assert (old >= G_MININT32);

new = old + 1;
} while (mono_atomic_cas_i32 (&worker.parked_threads_count, new, old) != old);
new_ = old + 1;
} while (mono_atomic_cas_i32 (&worker.parked_threads_count, new_, old) != old);

switch (mono_coop_sem_timedwait (&worker.parked_threads_sem, rand_next (&rand_handle, 5 * 1000, 60 * 1000), MONO_SEM_FLAGS_ALERTABLE)) {
case MONO_SEM_TIMEDWAIT_RET_SUCCESS:
Expand All @@ -407,8 +407,8 @@ worker_park (void)
old = mono_atomic_load_i32 (&worker.parked_threads_count);
g_assert (old > G_MININT32);

new = old - 1;
} while (mono_atomic_cas_i32 (&worker.parked_threads_count, new, old) != old);
new_ = old - 1;
} while (mono_atomic_cas_i32 (&worker.parked_threads_count, new_, old) != old);
}

COUNTER_ATOMIC (counter, {
Expand All @@ -427,7 +427,7 @@ static gboolean
worker_try_unpark (void)
{
gboolean res = TRUE;
gint32 old, new;
gint32 old, new_;

mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_THREADPOOL, "[%p] try unpark worker",
GUINT_TO_POINTER (MONO_NATIVE_THREAD_ID_TO_UINT (mono_native_thread_id_get ())));
Expand All @@ -441,8 +441,8 @@ worker_try_unpark (void)
break;
}

new = old - 1;
} while (mono_atomic_cas_i32 (&worker.parked_threads_count, new, old) != old);
new_ = old - 1;
} while (mono_atomic_cas_i32 (&worker.parked_threads_count, new_, old) != old);

if (res)
mono_coop_sem_post (&worker.parked_threads_sem);
Expand Down
22 changes: 11 additions & 11 deletions mono/metadata/w32handle.c
Original file line number Diff line number Diff line change
Expand Up @@ -399,18 +399,18 @@ mono_w32handle_foreach (gboolean (*on_each)(MonoW32Handle *handle_data, gpointer
static gboolean
mono_w32handle_ref_core (MonoW32Handle *handle_data)
{
guint old, new;
guint old, new_;

do {
old = handle_data->ref;
if (old == 0)
return FALSE;

new = old + 1;
} while (mono_atomic_cas_i32 ((gint32*) &handle_data->ref, (gint32)new, (gint32)old) != (gint32)old);
new_ = old + 1;
} while (mono_atomic_cas_i32 ((gint32*) &handle_data->ref, (gint32)new_, (gint32)old) != (gint32)old);

mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER_HANDLE, "%s: ref %s handle %p, ref: %d -> %d",
__func__, mono_w32handle_ops_typename (handle_data->type), handle_data, old, new);
__func__, mono_w32handle_ops_typename (handle_data->type), handle_data, old, new_);

return TRUE;
}
Expand All @@ -419,7 +419,7 @@ static gboolean
mono_w32handle_unref_core (MonoW32Handle *handle_data)
{
MonoW32Type type;
guint old, new;
guint old, new_;

type = handle_data->type;

Expand All @@ -428,16 +428,16 @@ mono_w32handle_unref_core (MonoW32Handle *handle_data)
if (!(old >= 1))
g_error ("%s: handle %p has ref %d, it should be >= 1", __func__, handle_data, old);

new = old - 1;
} while (mono_atomic_cas_i32 ((gint32*) &handle_data->ref, (gint32)new, (gint32)old) != (gint32)old);
new_ = old - 1;
} while (mono_atomic_cas_i32 ((gint32*) &handle_data->ref, (gint32)new_, (gint32)old) != (gint32)old);

/* handle_data might contain invalid data from now on, if
* another thread is unref'ing this handle at the same time */

mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER_HANDLE, "%s: unref %s handle %p, ref: %d -> %d destroy: %s",
__func__, mono_w32handle_ops_typename (type), handle_data, old, new, new == 0 ? "true" : "false");
__func__, mono_w32handle_ops_typename (type), handle_data, old, new_, new_ == 0 ? "true" : "false");

return new == 0;
return new_ == 0;
}

static void
Expand Down Expand Up @@ -529,8 +529,8 @@ static const gchar*
mono_w32handle_ops_typename (MonoW32Type type)
{
g_assert (handle_ops [type]);
g_assert (handle_ops [type]->typename);
return handle_ops [type]->typename ();
g_assert (handle_ops [type]->type_name);
return handle_ops [type]->type_name ();
}

static gsize
Expand Down
2 changes: 1 addition & 1 deletion mono/metadata/w32handle.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ typedef struct
void (*details)(MonoW32Handle *handle_data);

/* Called to get the name of the handle type */
const gchar* (*typename) (void);
const char* (*type_name) (void);

/* Called to get the size of the handle type */
gsize (*typesize) (void);
Expand Down
4 changes: 4 additions & 0 deletions mono/utils/mono-threads-mach-helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,11 @@ mono_dead_letter_dealloc (id self, SEL _cmd)
{
struct objc_super super;
super.receiver = self;
#if !defined(__cplusplus) && !__OBJC2__
super.class = nsobject;
#else
super.super_class = nsobject;
#endif
Copy link
Contributor

Choose a reason for hiding this comment

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

objc_msgSendSuper (&super, dealloc);

mono_thread_info_detach ();
Expand Down