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: 0 additions & 2 deletions src/mono/mono/metadata/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,6 @@ set(metadata_common_sources
mono-hash.h
mono-conc-hash.c
mono-conc-hash.h
mono-mlist.c
mono-mlist.h
mono-perfcounters.c
mono-perfcounters.h
mono-perfcounters-def.h
Expand Down
7 changes: 7 additions & 0 deletions src/mono/mono/metadata/object-internals.h
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,11 @@ struct _MonoException {
MonoString *remote_stack_trace;
gint32 remote_stack_index;
/* Dynamic methods referenced by the stack trace */
#ifdef ENABLE_NETCORE
MonoArray *dynamic_methods;
Comment thread
CoffeeFlux marked this conversation as resolved.
Outdated
#else
MonoObject *dynamic_methods;
#endif
gint32 hresult;
MonoString *source;
MonoObject *serialization_manager;
Expand Down Expand Up @@ -1776,6 +1780,9 @@ mono_array_clone_checked (MonoArray *array, MonoError *error);
void
mono_array_full_copy (MonoArray *src, MonoArray *dest);

void
mono_array_full_copy_unchecked_size (MonoArray *src, MonoArray *dest, MonoClass *klass, uintptr_t size);

gboolean
mono_array_calc_byte_len (MonoClass *klass, uintptr_t len, uintptr_t *res);

Expand Down
14 changes: 5 additions & 9 deletions src/mono/mono/metadata/object.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,6 @@ mono_string_to_utf8_internal (MonoMemPool *mp, MonoImage *image, MonoString *s,
static char *
mono_string_to_utf8_mp (MonoMemPool *mp, MonoString *s, MonoError *error);

static void
array_full_copy_unchecked_size (MonoArray *src, MonoArray *dest, MonoClass *klass, uintptr_t size);

/* Class lazy loading functions */
static GENERATE_GET_CLASS_WITH_CACHE (pointer, "System.Reflection", "Pointer")
static GENERATE_GET_CLASS_WITH_CACHE (remoting_services, "System.Runtime.Remoting", "RemotingServices")
Expand Down Expand Up @@ -6338,11 +6335,11 @@ mono_array_full_copy (MonoArray *src, MonoArray *dest)
g_assert (size == mono_array_length_internal (dest));
size *= mono_array_element_size (klass);

array_full_copy_unchecked_size (src, dest, klass, size);
mono_array_full_copy_unchecked_size (src, dest, klass, size);
}

static void
array_full_copy_unchecked_size (MonoArray *src, MonoArray *dest, MonoClass *klass, uintptr_t size)
void
mono_array_full_copy_unchecked_size (MonoArray *src, MonoArray *dest, MonoClass *klass, uintptr_t size)
{
if (mono_gc_is_moving ()) {
MonoClass *element_class = m_class_get_element_class (klass);
Expand All @@ -6352,8 +6349,7 @@ array_full_copy_unchecked_size (MonoArray *src, MonoArray *dest, MonoClass *klas
else
mono_gc_memmove_atomic (&dest->vector, &src->vector, size);
} else {
mono_array_memcpy_refs_internal
(dest, 0, src, 0, mono_array_length_internal (src));
mono_array_memcpy_refs_internal (dest, 0, src, 0, mono_array_length_internal (src));
}
} else {
mono_gc_memmove_atomic (&dest->vector, &src->vector, size);
Expand Down Expand Up @@ -6405,7 +6401,7 @@ mono_array_clone_in_domain (MonoDomain *domain, MonoArrayHandle array_handle, Mo

MonoGCHandle dst_handle;
dst_handle = mono_gchandle_from_handle (MONO_HANDLE_CAST (MonoObject, o), TRUE);
array_full_copy_unchecked_size (MONO_HANDLE_RAW (array_handle), MONO_HANDLE_RAW (o), klass, size);
mono_array_full_copy_unchecked_size (MONO_HANDLE_RAW (array_handle), MONO_HANDLE_RAW (o), klass, size);
mono_gchandle_free_internal (dst_handle);

MONO_HANDLE_ASSIGN (result, o);
Expand Down
36 changes: 35 additions & 1 deletion src/mono/mono/mini/mini-exceptions.c
Original file line number Diff line number Diff line change
Expand Up @@ -2184,12 +2184,45 @@ setup_stack_trace (MonoException *mono_ex, GSList **dynamic_methods, GList *trac
mono_error_assert_ok (error);
if (*dynamic_methods) {
/* These methods could go away anytime, so save a reference to them in the exception object */
MonoDomain *domain = mono_domain_get ();
#ifdef ENABLE_NETCORE
int methods_len = g_slist_length (*dynamic_methods);
MonoArray *old_methods = mono_ex->dynamic_methods;
int old_methods_len = 0;

if (old_methods) {
old_methods_len = mono_array_length_internal (old_methods);
methods_len += old_methods_len;
}

MonoArray *all_methods = mono_array_new_checked (domain, mono_defaults.object_class, methods_len, error);
mono_error_assert_ok (error);

if (old_methods)
mono_array_full_copy_unchecked_size (old_methods, all_methods, mono_defaults.object_class, old_methods_len);
int index = old_methods_len;

for (GSList *l = *dynamic_methods; l; l = l->next) {
g_assert (domain->method_to_dyn_method);

mono_domain_lock (domain);
MonoGCHandle dis_link = (MonoGCHandle)g_hash_table_lookup (domain->method_to_dyn_method, l->data);
mono_domain_unlock (domain);

if (dis_link) {
MonoObject *o = mono_gchandle_get_target_internal (dis_link);
mono_array_set_internal (all_methods, MonoObject *, index, o);
index++;
}
}

MONO_OBJECT_SETREF_INTERNAL (mono_ex, dynamic_methods, all_methods);
#else
GSList *l;
MonoMList *list = (MonoMList*)mono_ex->dynamic_methods;

for (l = *dynamic_methods; l; l = l->next) {
MonoGCHandle dis_link;
MonoDomain *domain = mono_domain_get ();

if (domain->method_to_dyn_method) {
mono_domain_lock (domain);
Expand All @@ -2206,6 +2239,7 @@ setup_stack_trace (MonoException *mono_ex, GSList **dynamic_methods, GList *trac
}

MONO_OBJECT_SETREF_INTERNAL (mono_ex, dynamic_methods, list);
#endif

g_slist_free (*dynamic_methods);
*dynamic_methods = NULL;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@

<!-- Sources -->
<ItemGroup>
<Compile Include="$(BclSourcesRoot)\Mono\MonoListItem.cs" />
<Compile Include="$(BclSourcesRoot)\Mono\RuntimeHandles.cs" />
<Compile Include="$(BclSourcesRoot)\System\ArgIterator.cs" />
<Compile Include="$(BclSourcesRoot)\System\Array.Mono.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,9 +230,6 @@
<method signature="System.Void .ctor()" />
</type>

<!-- mono-mlist.c (managed list): used in threadpool.c and gc.c -->
<type fullname="Mono.MonoListItem" preserve="fields" />

<!-- domain.c: mono_defaults.multicastdelegate_class -->
<type fullname="System.MulticastDelegate" preserve="fields" />

Expand Down
12 changes: 0 additions & 12 deletions src/mono/netcore/System.Private.CoreLib/src/Mono/MonoListItem.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public DispatchState(MonoStackFrame[]? stackFrames)
private string? _stackTraceString;
private string? _remoteStackTraceString;
private int _unused4;
private object? _dynamicMethods; // Dynamic methods referenced by the stack trace
private object[]? _dynamicMethods; // Dynamic methods referenced by the stack trace
private int _HResult;
private string? _source;
private object? _unused6;
Expand Down