loaded_images_hash = g_hash_table_new (g_str_hash, g_str_equal);
loaded_images_refonly_hash = g_hash_table_new (g_str_hash, g_str_equal);
- debug_assembly_unload = getenv ("MONO_DEBUG_ASSEMBLY_UNLOAD") != NULL;
+ debug_assembly_unload = g_getenv ("MONO_DEBUG_ASSEMBLY_UNLOAD") != NULL;
}
/**
return TRUE;
}
+void
+mono_image_load_names (MonoImage *image)
+{
+ /* modules don't have an assembly table row */
+ if (image->tables [MONO_TABLE_ASSEMBLY].rows) {
+ image->assembly_name = mono_metadata_string_heap (image,
+ mono_metadata_decode_row_col (&image->tables [MONO_TABLE_ASSEMBLY],
+ 0, MONO_ASSEMBLY_NAME));
+ }
+
+ image->module_name = mono_metadata_string_heap (image,
+ mono_metadata_decode_row_col (&image->tables [MONO_TABLE_MODULE],
+ 0, MONO_MODULE_NAME));
+}
+
static MonoImage *
do_mono_image_load (MonoImage *image, MonoImageOpenStatus *status,
gboolean care_about_cli, gboolean care_about_pecoff)
if (!mono_image_load_cli_data (image))
goto invalid_image;
- /* modules don't have an assembly table row */
- if (image->tables [MONO_TABLE_ASSEMBLY].rows) {
- image->assembly_name = mono_metadata_string_heap (image,
- mono_metadata_decode_row_col (&image->tables [MONO_TABLE_ASSEMBLY],
- 0, MONO_ASSEMBLY_NAME));
- }
+ if (!mono_verifier_verify_table_data (image, NULL))
+ goto invalid_image;
- image->module_name = mono_metadata_string_heap (image,
- mono_metadata_decode_row_col (&image->tables [MONO_TABLE_MODULE],
- 0, MONO_MODULE_NAME));
+ mono_image_load_names (image);
load_modules (image);
if (slot_type & VTFIXUP_TYPE_32BIT)
while (slot_count--) {
*((guint32*) slot) = (guint32) mono_marshal_get_vtfixup_ftnptr (image, *((guint32*) slot), slot_type);
- ((guint32*) slot)++;
+ slot = ((guint32*) slot) + 1;
}
else if (slot_type & VTFIXUP_TYPE_64BIT)
while (slot_count--) {
*((guint64*) slot) = (guint64) mono_marshal_get_vtfixup_ftnptr (image, *((guint64*) slot), slot_type);
- ((guint64*) slot)++;
+ slot = ((guint32*) slot) + 1;
}
else
g_assert_not_reached();
free_hash (image->castclass_cache);
free_hash (image->proxy_isinst_cache);
free_hash (image->thunk_invoke_cache);
- free_hash (image->static_rgctx_invoke_cache);
/* The ownership of signatures is not well defined */
//g_hash_table_foreach (image->memberref_signatures, free_mr_signatures, NULL);
/* Dynamic images are GC_MALLOCed */
g_free ((char*)image->module_name);
mono_dynamic_image_free ((MonoDynamicImage*)image);
- mono_mempool_destroy (image->mempool);
+ if (debug_assembly_unload)
+ mono_mempool_invalidate (image->mempool);
+ else
+ mono_mempool_destroy (image->mempool);
}
mono_profiler_module_event (image, MONO_PROFILE_END_UNLOAD);