[runtime] Don't set flag to skip future initialization on half-baked classes
[mono.git] / mono / metadata / sgen-conf.h
index d22d92130ea4591deaf22bb44e7e96fdf598d91a..1cfcffb5128e536a1f3c44f5c9fb6eb7782f250d 100644 (file)
 #ifndef __MONO_SGENCONF_H__
 #define __MONO_SGENCONF_H__
 
+#include <glib.h>
+
 /*Basic defines and static tunables */
 
 #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
 
 
@@ -39,6 +39,12 @@ typedef guint64 mword;
  */
 // #define HEAVY_STATISTICS
 
+#ifdef HEAVY_STATISTICS
+#define HEAVY_STAT(x)  x
+#else
+#define HEAVY_STAT(x)
+#endif
+
 /*
  * Define this to allow the user to change the nursery size by
  * specifying its value in the MONO_GC_PARAMS environmental
@@ -46,15 +52,6 @@ typedef guint64 mword;
  */
 #define USER_CONFIG 1
 
-
-/*
- * If this is set, the nursery is aligned to an address aligned to its size, ie.
- * a 1MB nursery will be aligned to an address divisible by 1MB. This allows us to
- * speed up ptr_in_nursery () checks which are very frequent. This requires the
- * nursery size to be a compile time constant.
- */
-#define SGEN_ALIGN_NURSERY 1
-
 /*
  * The binary protocol enables logging a lot of the GC ativity in a way that is not very
  * intrusive and produces a compact file that can be searched using a custom tool.  This
@@ -76,6 +73,15 @@ typedef guint64 mword;
  */
 //#define SGEN_CHECK_GRAY_OBJECT_SECTIONS
 
+/*
+ * Enable this to check every reference update for null references and whether the update is
+ * made in a worker thread.  In only a few cases do we potentially update references by
+ * writing nulls, so we assert in all the cases where it's not allowed.  The concurrent
+ * collector's worker thread is not allowed to update references at all, so we also assert
+ * that we're not in the worker thread.
+ */
+//#define SGEN_CHECK_UPDATE_REFERENCE
+
 /*
  * Define this and use the "xdomain-checks" MONO_GC_DEBUG option to
  * have cross-domain checks in the write barrier.
@@ -136,12 +142,9 @@ typedef guint64 mword;
 #define SGEN_SCAN_START_SIZE (4096*2)
 
 /*
- * Objects bigger then this go into the large object space.  This size
- * has a few constraints.  It must fit into the major heap, which in
- * the case of the copying collector means that it must fit into a
- * pinned chunk.  It must also play well with the GC descriptors, some
- * of which (DESC_TYPE_RUN_LENGTH, DESC_TYPE_SMALL_BITMAP) encode the
- * object size.
+ * Objects bigger then this go into the large object space.  This size has a few
+ * constraints.  At least two of them must fit into a major heap block.  It must also play
+ * well with the run length GC descriptor, which encodes the object size.
  */
 #define SGEN_MAX_SMALL_OBJ_SIZE 8000
 
@@ -192,16 +195,17 @@ typedef guint64 mword;
 /*
  * Configurable cementing parameters.
  *
- * The hash table size should be a prime.  If there are too many
- * pinned nursery objects with many references from the major heap,
- * this number must be increased.
+ * If there are too many pinned nursery objects with many references
+ * from the major heap, the hash table size must be increased.
  *
  * The threshold is the number of references from the major heap to a
  * pinned nursery object which triggers cementing: if there are more
  * than that number of references, the pinned object is cemented until
  * the next major collection.
  */
-#define SGEN_CEMENT_HASH_SIZE  61
+#define SGEN_CEMENT_HASH_SHIFT 6
+#define SGEN_CEMENT_HASH_SIZE  (1 << SGEN_CEMENT_HASH_SHIFT)
+#define SGEN_CEMENT_HASH(hv)   (((hv) ^ ((hv) >> SGEN_CEMENT_HASH_SHIFT)) & (SGEN_CEMENT_HASH_SIZE - 1))
 #define SGEN_CEMENT_THRESHOLD  1000
 
 #endif