#else
image = g_new0 (MonoDynamicImage, 1);
#endif
-
+
mono_profiler_module_event (&image->image, MONO_PROFILE_START_LOAD);
/*g_print ("created image %p\n", image);*/
}
}
+void
+mono_dynamic_image_free_image (MonoDynamicImage *image)
+{
+ /* See create_dynamic_mono_image () */
+#if HAVE_BOEHM_GC
+ /* Allocated using GC_MALLOC */
+#else
+ g_free (image);
+#endif
+}
+
#ifndef DISABLE_REFLECTION_EMIT
/*
val = load_cattr_value (image, &subc->byval_arg, p, end);
obj = mono_object_new (mono_domain_get (), subc);
g_assert (!subc->has_references);
- mono_gc_memmove ((char*)obj + sizeof (MonoObject), val, mono_class_value_size (subc, NULL));
+ mono_gc_memmove_atomic ((char*)obj + sizeof (MonoObject), val, mono_class_value_size (subc, NULL));
g_free (val);
return obj;
}
/* Put into cache so mono_class_get () will find it.
Skip nested types as those should not be available on the global scope. */
- if (!tb->nesting_type) {
+ if (!tb->nesting_type)
mono_image_add_to_name_cache (klass->image, klass->name_space, klass->name, tb->table_idx);
- } else {
- klass->image->reflection_info_unregister_classes =
- g_slist_prepend (klass->image->reflection_info_unregister_classes, klass);
- }
+
+ /*
+ We must register all types as we cannot rely on the name_cache hashtable since we find the class
+ by performing a mono_class_get which does the full resolution.
+
+ Working around this semantics would require us to write a lot of code for no clear advantage.
+ */
+ mono_image_append_class_to_reflection_info_set (klass);
} else {
g_assert (mono_class_get_ref_info (klass) == tb);
}
* This table maps metadata structures representing inflated methods/fields
* to the reflection objects representing their generic definitions.
*/
- mono_loader_lock ();
+ mono_image_lock ((MonoImage*)image);
mono_g_hash_table_insert (image->generic_def_objects, imethod, rmethod);
- mono_loader_unlock ();
+ mono_image_unlock ((MonoImage*)image);
}
if (!mono_verifier_is_method_valid_generic_instantiation (inflated))
if (method->is_generic && method->klass->image->dynamic) {
MonoDynamicImage *image = (MonoDynamicImage*)method->klass->image;
- mono_loader_lock ();
+ mono_image_lock ((MonoImage*)image);
mono_g_hash_table_insert (image->generic_def_objects, imethod, obj);
- mono_loader_unlock ();
+ mono_image_unlock ((MonoImage*)image);
}
return (MonoMethod *) imethod;
}
gparam->type.type = &pklass->byval_arg;
mono_class_set_ref_info (pklass, gparam);
- mono_image_lock (image);
- image->reflection_info_unregister_classes = g_slist_prepend (image->reflection_info_unregister_classes, pklass);
- mono_image_unlock (image);
+ mono_image_append_class_to_reflection_info_set (pklass);
}
MonoArray *