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/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ null_gc_sources = \

common_sources = \
$(platform_sources) \
appdomain.c \
domain.c \
appdomain-icalls.h \
assembly.c \
assembly-internals.h \
Expand Down Expand Up @@ -278,8 +280,6 @@ common_sources = \

# These source files have compile time dependencies on GC code
gc_dependent_sources = \
appdomain.c \
domain.c \
gc-stats.c \
gc.c \
monitor.c \
Expand Down
2 changes: 0 additions & 2 deletions mono/metadata/appdomain.c
Original file line number Diff line number Diff line change
Expand Up @@ -2587,7 +2587,6 @@ unload_thread_main (void *arg)

mono_loader_lock (); //FIXME why do we need the loader lock here?
mono_domain_lock (domain);
#ifdef HAVE_SGEN_GC
Copy link
Contributor

Choose a reason for hiding this comment

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

No moving_gc check here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That code runs fine with boehm as well.

/*
* We need to make sure that we don't have any remsets
* pointing into static data of the to-be-freed domain because
Expand All @@ -2600,7 +2599,6 @@ unload_thread_main (void *arg)
for (i = 0; i < domain->class_vtable_array->len; ++i)
zero_static_data ((MonoVTable *)g_ptr_array_index (domain->class_vtable_array, i));
mono_gc_collect (0);
#endif
for (i = 0; i < domain->class_vtable_array->len; ++i)
clear_cached_vtable ((MonoVTable *)g_ptr_array_index (domain->class_vtable_array, i));
deregister_reflection_info_roots (domain);
Expand Down
19 changes: 8 additions & 11 deletions mono/metadata/domain.c
Original file line number Diff line number Diff line change
Expand Up @@ -386,12 +386,12 @@ mono_domain_create (void)
}
mono_appdomains_unlock ();

#ifdef HAVE_BOEHM_GC
domain = (MonoDomain *)mono_gc_alloc_fixed (sizeof (MonoDomain), MONO_GC_DESCRIPTOR_NULL, MONO_ROOT_SOURCE_DOMAIN, "domain object");
#else
domain = (MonoDomain *)mono_gc_alloc_fixed (sizeof (MonoDomain), domain_gc_desc, MONO_ROOT_SOURCE_DOMAIN, "domain object");
mono_gc_register_root ((char*)&(domain->MONO_DOMAIN_FIRST_GC_TRACKED), G_STRUCT_OFFSET (MonoDomain, MONO_DOMAIN_LAST_GC_TRACKED) - G_STRUCT_OFFSET (MonoDomain, MONO_DOMAIN_FIRST_GC_TRACKED), MONO_GC_DESCRIPTOR_NULL, MONO_ROOT_SOURCE_DOMAIN, "misc domain fields");
#endif
if (!mono_gc_is_moving ()) {
domain = (MonoDomain *)mono_gc_alloc_fixed (sizeof (MonoDomain), MONO_GC_DESCRIPTOR_NULL, MONO_ROOT_SOURCE_DOMAIN, "domain object");
} else {
domain = (MonoDomain *)mono_gc_alloc_fixed (sizeof (MonoDomain), domain_gc_desc, MONO_ROOT_SOURCE_DOMAIN, "domain object");
mono_gc_register_root ((char*)&(domain->MONO_DOMAIN_FIRST_GC_TRACKED), G_STRUCT_OFFSET (MonoDomain, MONO_DOMAIN_LAST_GC_TRACKED) - G_STRUCT_OFFSET (MonoDomain, MONO_DOMAIN_FIRST_GC_TRACKED), MONO_GC_DESCRIPTOR_NULL, MONO_ROOT_SOURCE_DOMAIN, "misc domain fields");
}
domain->shadow_serial = shadow_serial;
domain->domain = NULL;
domain->setup = NULL;
Expand Down Expand Up @@ -1208,16 +1208,13 @@ mono_domain_free (MonoDomain *domain, gboolean force)

domain->setup = NULL;

#ifndef HAVE_BOEHM_GC
mono_gc_deregister_root ((char*)&(domain->MONO_DOMAIN_FIRST_GC_TRACKED));
#endif
if (mono_gc_is_moving ())
mono_gc_deregister_root ((char*)&(domain->MONO_DOMAIN_FIRST_GC_TRACKED));

mono_appdomains_lock ();
appdomains_list [domain->domain_id] = NULL;
mono_appdomains_unlock ();

/* FIXME: anything else required ? */

mono_gc_free_fixed (domain);

#ifndef DISABLE_PERFCOUNTERS
Expand Down