Merge pull request #409 from Alkarex/patch-1
[mono.git] / mono / metadata / sgen-conf.h
index 1ad7b10f6bf55ff7450d576bed1d5a551ef03213..8221812cc895a93096e3901b71c268aa2cad2d7a 100644 (file)
 
 #if SIZEOF_VOID_P == 4
 typedef guint32 mword;
+#define MWORD_MAX_VALUE ((uint32_t) 0xffffffff)
 #else
 typedef guint64 mword;
+#define MWORD_MAX_VALUE (G_MAXUINT64)
 #endif
 
 
@@ -80,11 +82,17 @@ typedef guint64 mword;
 
 /*
  * Maximum level of debug to enable on this build.
- * Making this a static variable enables us to put logging in a lot of places.
- * FIXME decouple logging from assertions
+ * Making this a constant enables us to put logging in a lot of places and
+ * not pay its cost on release builds.
  */
 #define SGEN_MAX_DEBUG_LEVEL 2
 
+/*
+ * Maximum level of asserts to enable on this build.
+ * FIXME replace all magic numbers with defines.
+ */
+#define SGEN_MAX_ASSERT_LEVEL 2
+
 
 #define GC_BITS_PER_WORD (sizeof (mword) * 8)
 
@@ -140,4 +148,34 @@ typedef guint64 mword;
  */
 #define DEFAULT_REMSET_SIZE 1024
 
+
+/*
+ * Minimum allowance for nursery allocations, as a multiple of the size of nursery.
+ *
+ * We allow at least this much allocation to happen to the major heap from multiple
+ * minor collections before triggering a major collection.
+ *
+ * Bigger values increases throughput by allowing more garbage to sit in the major heap.
+ * Smaller values leads to better memory effiency but more frequent major collections.
+ */
+#define SGEN_DEFAULT_ALLOWANCE_NURSERY_SIZE_RATIO 4.0
+
+#define SGEN_MIN_ALLOWANCE_NURSERY_SIZE_RATIO 1.0
+#define SGEN_MAX_ALLOWANCE_NURSERY_SIZE_RATIO 10.0
+
+/*
+ * Default ratio of memory we want to release in a major collection in relation to the the current heap size.
+ *
+ * A major collection target is to free a given amount of memory. This amount is a ratio of the major heap size.
+ *
+ * Values above 0.5 cause the heap to agressively grow when it's small and waste memory when it's big.
+ * Lower values will produce more reasonable sized heaps when it's small, but will be suboptimal at large
+ * sizes as they will use a small fraction only.
+ *
+ */
+#define SGEN_DEFAULT_SAVE_TARGET_RATIO 0.5
+
+#define SGEN_MIN_SAVE_TARGET_RATIO 0.1
+#define SGEN_MAX_SAVE_TARGET_RATIO 2.0
+
 #endif