Remove the few remaining compile time GC dependencies.
authorZoltan Varga <vargaz@gmail.com>
Mon, 9 Aug 2010 21:22:10 +0000 (23:22 +0200)
committerZoltan Varga <vargaz@gmail.com>
Mon, 9 Aug 2010 21:22:42 +0000 (23:22 +0200)
mono/mini/driver.c
mono/mini/method-to-ir.c
mono/mini/mini.c

index 988f737c62b7803fce0dbbdb88f1d651774bccba..fa38cb7a04d370ce1fafb2e95ca72e842b766b9a 100644 (file)
@@ -1433,24 +1433,24 @@ mono_main (int argc, char* argv[])
                } else if (strncmp (argv [i], "-O=", 3) == 0) {
                        opt = parse_optimizations (argv [i] + 3);
                } else if (strcmp (argv [i], "--gc=sgen") == 0) {
-#if HAVE_BOEHM_GC
-                       GString *path = g_string_new (argv [0]);
-                       g_string_append (path, "-sgen");
-                       argv [0] = path->str;
-                       execvp (path->str, argv);
-#endif
+                       if (!strcmp (mono_gc_get_gc_name (), "boehm")) {
+                               GString *path = g_string_new (argv [0]);
+                               g_string_append (path, "-sgen");
+                               argv [0] = path->str;
+                               execvp (path->str, argv);
+                       }
                } else if (strcmp (argv [i], "--gc=boehm") == 0) {
-#if HAVE_SGEN_GC
-                       char *copy = g_strdup (argv [0]);
-                       char *p = strstr (copy, "-sgen");
-                       if (p == NULL){
-                               fprintf (stderr, "Error, this process is not named mono-sgen and the command line option --boehm was passed");
-                               exit (1);
+                       if (!strcmp (mono_gc_get_gc_name (), "sgen")) {
+                               char *copy = g_strdup (argv [0]);
+                               char *p = strstr (copy, "-sgen");
+                               if (p == NULL){
+                                       fprintf (stderr, "Error, this process is not named mono-sgen and the command line option --boehm was passed");
+                                       exit (1);
+                               }
+                               *p = 0;
+                               argv [0] = p;
+                               execvp (p, argv);
                        }
-                       *p = 0;
-                       argv [0] = p;
-                       execvp (p, argv);
-#endif
                } else if (strcmp (argv [i], "--config") == 0) {
                        if (i +1 >= argc){
                                fprintf (stderr, "error: --config requires a filename argument\n");
index 2cda2a8b0f532303312cab2d2bdbee80f0ec89a2..871d33c3cde081907b21cd92404cb2b7c3d7be94 100644 (file)
@@ -4151,8 +4151,8 @@ mini_emit_inst_for_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSign
                        type_from_op (ins, NULL, NULL);
 
                        return ins;
-#if !defined(MONO_ARCH_EMULATE_MUL_DIV) && !defined(HAVE_MOVING_COLLECTOR)
-               } else if (strcmp (cmethod->name, "InternalGetHashCode") == 0) {
+#if !defined(MONO_ARCH_EMULATE_MUL_DIV)
+               } else if (strcmp (cmethod->name, "InternalGetHashCode") == 0 && !mono_gc_is_moving ()) {
                        int dreg = alloc_ireg (cfg);
                        int t1 = alloc_ireg (cfg);
        
@@ -8481,16 +8481,22 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                                        case MONO_TYPE_U:
                                        case MONO_TYPE_PTR:
                                        case MONO_TYPE_FNPTR:
-#ifndef HAVE_MOVING_COLLECTOR
+                                               EMIT_NEW_PCONST (cfg, *sp, *((gpointer *)addr));
+                                               type_to_eval_stack_type ((cfg), field->type, *sp);
+                                               sp++;
+                                               break;
                                        case MONO_TYPE_STRING:
                                        case MONO_TYPE_OBJECT:
                                        case MONO_TYPE_CLASS:
                                        case MONO_TYPE_SZARRAY:
                                        case MONO_TYPE_ARRAY:
-#endif
-                                               EMIT_NEW_PCONST (cfg, *sp, *((gpointer *)addr));
-                                               type_to_eval_stack_type ((cfg), field->type, *sp);
-                                               sp++;
+                                               if (!mono_gc_is_moving ()) {
+                                                       EMIT_NEW_PCONST (cfg, *sp, *((gpointer *)addr));
+                                                       type_to_eval_stack_type ((cfg), field->type, *sp);
+                                                       sp++;
+                                               } else {
+                                                       is_const = FALSE;
+                                               }
                                                break;
                                        case MONO_TYPE_I8:
                                        case MONO_TYPE_U8:
index fa4c1abac6124734d33f1e465f26285691c9886e..38f502c7c969a8a8c84acfa0cb464dbb63195638 100644 (file)
@@ -6110,9 +6110,7 @@ mini_init (const char *filename, const char *runtime_version)
        register_icall (mono_get_native_calli_wrapper, "mono_get_native_calli_wrapper", "ptr ptr ptr ptr", FALSE);
        register_icall (mono_resume_unwind, "mono_resume_unwind", "void", TRUE);
 
-#ifdef HAVE_WRITE_BARRIERS
        register_icall (mono_gc_wbarrier_value_copy_bitmap, "mono_gc_wbarrier_value_copy_bitmap", "void ptr ptr int int", FALSE);
-#endif
 
 #endif