Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Replace ENABLE_COREE with a runtime switch.

  • Loading branch information...
commit e439067bfed0d9dbd70537cfce818c4d0afe5589 1 parent 3d67797
Vincent Povirk authored gonzalop committed
View
2  mono/metadata/assembly.c
@@ -1634,7 +1634,7 @@ mono_assembly_load_from_full (MonoImage *image, const char*fname,
loaded_assemblies = g_list_prepend (loaded_assemblies, ass);
mono_assemblies_unlock ();
-#ifdef ENABLE_COREE
+#ifdef HOST_WIN32
if (image->is_module_handle)
mono_image_fixup_vtable (image);
#endif
View
7 mono/metadata/coree.c
@@ -33,14 +33,10 @@
#include "environment.h"
#include "coree.h"
-#ifdef ENABLE_COREE
-
HMODULE coree_module_handle = NULL;
static gboolean init_from_coree = FALSE;
-#endif
-
gchar*
mono_get_module_file_name (HMODULE module_handle)
{
@@ -73,7 +69,6 @@ mono_get_module_file_name (HMODULE module_handle)
return file_name_utf8;
}
-#ifdef ENABLE_COREE
/* Entry point called by LdrLoadDll of ntdll.dll after _CorValidateImage. */
BOOL STDMETHODCALLTYPE _CorDllMain(HINSTANCE hInst, DWORD dwReason, LPVOID lpReserved)
{
@@ -928,6 +923,4 @@ mono_fixup_exe_image (MonoImage* image)
MonoFixupExe ((HMODULE) image->raw_data);
}
-#endif /* ENABLE_COREE */
-
#endif /* HOST_WIN32 */
View
5 mono/metadata/domain.c
@@ -1242,9 +1242,6 @@ mono_init_internal (const char *filename, const char *exe_filename, const char *
#ifdef HOST_WIN32
/* Avoid system error message boxes. */
SetErrorMode (SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX);
-#ifdef ENABLE_COREE
- mono_load_coree (exe_filename);
-#endif
#endif
mono_perfcounters_init ();
@@ -1283,7 +1280,7 @@ mono_init_internal (const char *filename, const char *exe_filename, const char *
* exe_image, and close it during shutdown.
*/
get_runtimes_from_exe (exe_filename, &exe_image, runtimes);
-#ifdef ENABLE_COREE
+#ifdef HOST_WIN32
if (!exe_image) {
exe_image = mono_assembly_open_from_bundle (exe_filename, NULL, FALSE);
if (!exe_image)
View
26 mono/metadata/image.c
@@ -121,7 +121,7 @@ mono_cli_rva_image_map (MonoImage *image, guint32 addr)
for (i = 0; i < top; i++){
if ((addr >= tables->st_virtual_address) &&
(addr < tables->st_virtual_address + tables->st_raw_data_size)){
-#ifdef ENABLE_COREE
+#ifdef HOST_WIN32
if (image->is_module_handle)
return addr;
#endif
@@ -158,7 +158,7 @@ mono_image_rva_map (MonoImage *image, guint32 addr)
if (!mono_image_ensure_section_idx (image, i))
return NULL;
}
-#ifdef ENABLE_COREE
+#ifdef HOST_WIN32
if (image->is_module_handle)
return image->raw_data + addr;
#endif
@@ -239,7 +239,7 @@ mono_image_ensure_section_idx (MonoImage *image, int section)
if (sect->st_raw_data_ptr + sect->st_raw_data_size > image->raw_data_len)
return FALSE;
-#ifdef ENABLE_COREE
+#ifdef HOST_WIN32
if (image->is_module_handle)
iinfo->cli_sections [section] = image->raw_data + sect->st_virtual_address;
else
@@ -628,7 +628,7 @@ mono_image_load_module (MonoImage *image, int idx)
if (image->modules [idx - 1]) {
mono_image_addref (image->modules [idx - 1]);
image->modules [idx - 1]->assembly = image->assembly;
-#ifdef ENABLE_COREE
+#ifdef HOST_WIN32
if (image->modules [idx - 1]->is_module_handle)
mono_image_fixup_vtable (image->modules [idx - 1]);
#endif
@@ -702,7 +702,7 @@ do_load_header (MonoImage *image, MonoDotNetHeader *header, int offset)
{
MonoDotNetHeader64 header64;
-#ifdef ENABLE_COREE
+#ifdef HOST_WIN32
if (!image->is_module_handle)
#endif
if (offset + sizeof (MonoDotNetHeader32) > image->raw_data_len)
@@ -823,7 +823,7 @@ do_load_header (MonoImage *image, MonoDotNetHeader *header, int offset)
SWAPPDE (header->datadir.pe_cli_header);
SWAPPDE (header->datadir.pe_reserved);
-#ifdef ENABLE_COREE
+#ifdef HOST_WIN32
if (image->is_module_handle)
image->raw_data_len = header->nt.pe_image_size;
#endif
@@ -842,7 +842,7 @@ mono_image_load_pe_data (MonoImage *image)
iinfo = image->image_info;
header = &iinfo->cli_header;
-#ifdef ENABLE_COREE
+#ifdef HOST_WIN32
if (!image->is_module_handle)
#endif
if (offset + sizeof (msdos) > image->raw_data_len)
@@ -1178,7 +1178,7 @@ mono_image_open_from_data (char *data, guint32 data_len, gboolean need_copy, Mon
return mono_image_open_from_data_full (data, data_len, need_copy, status, FALSE);
}
-#ifdef ENABLE_COREE
+#ifdef HOST_WIN32
/* fname is not duplicated. */
MonoImage*
mono_image_open_from_module_handle (HMODULE module_handle, char* fname, gboolean has_entry_point, MonoImageOpenStatus* status)
@@ -1212,7 +1212,7 @@ mono_image_open_full (const char *fname, MonoImageOpenStatus *status, gboolean r
g_return_val_if_fail (fname != NULL, NULL);
-#ifdef ENABLE_COREE
+#ifdef HOST_WIN32
/* Load modules using LoadLibrary. */
if (!refonly && coree_module_handle) {
HMODULE module_handle;
@@ -1364,7 +1364,7 @@ mono_image_open_raw (const char *fname, MonoImageOpenStatus *status)
void
mono_image_fixup_vtable (MonoImage *image)
{
-#ifdef ENABLE_COREE
+#ifdef HOST_WIN32
MonoCLIImageInfo *iinfo;
MonoPEDirEntry *de;
MonoVTableFixup *vtfixup;
@@ -1502,7 +1502,7 @@ mono_image_close_except_pools (MonoImage *image)
mono_images_unlock ();
-#ifdef ENABLE_COREE
+#ifdef HOST_WIN32
if (image->is_module_handle && image->has_entry_point) {
mono_images_lock ();
if (image->ref_count == 0) {
@@ -1545,7 +1545,7 @@ mono_image_close_except_pools (MonoImage *image)
}
}
-#ifdef ENABLE_COREE
+#ifdef HOST_WIN32
mono_images_lock ();
if (image->is_module_handle && !image->has_entry_point)
FreeLibrary ((HMODULE) image->raw_data);
@@ -2000,7 +2000,7 @@ mono_image_load_file_for_image (MonoImage *image, int fileidx)
}
image->files [fileidx - 1] = res;
-#ifdef ENABLE_COREE
+#ifdef HOST_WIN32
if (res->is_module_handle)
mono_image_fixup_vtable (res);
#endif
View
17 mono/mini/driver.c
@@ -1143,6 +1143,9 @@ mini_usage (void)
" Currently the only supported option is 'disable'.\n"
" --llvm, --nollvm Controls whenever the runtime uses LLVM to compile code.\n"
" --gc=[sgen,boehm] Select SGen or Boehm GC (runs mono or mono-sgen)\n"
+#ifdef HOST_WIN32
+ " --mixed-mode Enable mixed-mode image support.\n"
+#endif
);
}
@@ -1250,10 +1253,8 @@ BOOL APIENTRY DllMain (HMODULE module_handle, DWORD reason, LPVOID reserved)
mono_install_runtime_load (mini_init);
break;
case DLL_PROCESS_DETACH:
-#ifdef ENABLE_COREE
if (coree_module_handle)
FreeLibrary (coree_module_handle);
-#endif
break;
}
return TRUE;
@@ -1345,6 +1346,9 @@ mono_main (int argc, char* argv[])
#ifdef MONO_JIT_INFO_TABLE_TEST
int test_jit_info_table = FALSE;
#endif
+#ifdef HOST_WIN32
+ int mixed_mode = FALSE;
+#endif
#ifdef MOONLIGHT
#ifndef HOST_WIN32
@@ -1473,6 +1477,10 @@ mono_main (int argc, char* argv[])
return 1;
}
config_file = argv [++i];
+#ifdef HOST_WIN32
+ } else if (strcmp (argv [i], "--mixed-mode") == 0) {
+ mixed_mode = TRUE;
+#endif
} else if (strcmp (argv [i], "--ncompile") == 0) {
if (i + 1 >= argc){
fprintf (stderr, "error: --ncompile requires an argument\n");
@@ -1737,6 +1745,11 @@ mono_main (int argc, char* argv[])
}
#endif
+#ifdef HOST_WIN32
+ if (mixed_mode)
+ mono_load_coree (argv [i]);
+#endif
+
mono_set_defaults (mini_verbose, opt);
domain = mini_init (argv [i], forced_version);
Please sign in to comment.
Something went wrong with that request. Please try again.