Skip to content

Instantly share code, notes, and snippets.

@kumpera
Created October 31, 2012 21:50
Show Gist options
  • Select an option

  • Save kumpera/3990153 to your computer and use it in GitHub Desktop.

Select an option

Save kumpera/3990153 to your computer and use it in GitHub Desktop.
diff --git a/mono/mini/aot-compiler.c b/mono/mini/aot-compiler.c
index 9502e54..1c197fd 100644
--- a/mono/mini/aot-compiler.c
+++ b/mono/mini/aot-compiler.c
@@ -65,6 +65,7 @@
#include "mini.h"
#include "image-writer.h"
#include "dwarfwriter.h"
+#include "mini-gc.h"
#if !defined(DISABLE_AOT) && !defined(DISABLE_JIT)
@@ -5260,6 +5261,8 @@ mono_aot_parse_options (const char *aot_options, MonoAotOptions *opts)
} else if (str_begins_with (arg, "info")) {
printf ("AOT target setup: %s.\n", AOT_TARGET_STR);
exit (0);
+ } else if (str_begins_with (arg, "gc-maps")) {
+ mini_gc_enable_gc_maps_for_aot ();
} else if (str_begins_with (arg, "help") || str_begins_with (arg, "?")) {
printf ("Supported options for --aot:\n");
printf (" outfile=\n");
@@ -5281,6 +5284,7 @@ mono_aot_parse_options (const char *aot_options, MonoAotOptions *opts)
printf (" tool-prefix=\n");
printf (" readonly-value=\n");
printf (" soft-debug\n");
+ printf (" gc-maps\n");
printf (" print-skipped\n");
printf (" stats\n");
printf (" info\n");
diff --git a/mono/mini/mini-gc.c b/mono/mini/mini-gc.c
index 088225e..f1121d0 100644
--- a/mono/mini/mini-gc.c
+++ b/mono/mini/mini-gc.c
@@ -262,6 +262,14 @@ static JITGCStats stats;
static FILE *logfile;
+static gboolean enable_gc_maps_for_aot;
+
+void
+mini_gc_enable_gc_maps_for_aot (void)
+{
+ enable_gc_maps_for_aot = TRUE;
+}
+
// FIXME: Move these to a shared place
static inline void
@@ -1210,7 +1218,10 @@ mini_gc_init_gc_map (MonoCompile *cfg)
if (!mono_gc_is_moving ())
return;
- if (!cfg->compile_aot && !mono_gc_precise_stack_mark_enabled ())
+ if (cfg->compile_aot) {
+ if (!enable_gc_maps_for_aot)
+ return;
+ } else if (!mono_gc_precise_stack_mark_enabled ())
return;
#if 1
diff --git a/mono/mini/mini-gc.h b/mono/mini/mini-gc.h
index 4e63550..63366bb 100644
--- a/mono/mini/mini-gc.h
+++ b/mono/mini/mini-gc.h
@@ -22,6 +22,8 @@ void mini_gc_init (void) MONO_INTERNAL;
void mini_gc_init_cfg (MonoCompile *cfg) MONO_INTERNAL;
+void mini_gc_enable_gc_maps_for_aot (void) MONO_INTERNAL;
+
void mini_gc_create_gc_map (MonoCompile *cfg) MONO_INTERNAL;
void mini_gc_set_slot_type_from_fp (MonoCompile *cfg, int slot_offset, GCSlotType type) MONO_INTERNAL;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment