1 /* 2 * Part of Scheme 48 1.9. See file COPYING for notices and license. 3 * 4 * Authors: David Frese, Christos Freris 5 */ 6 7 #ifndef __S48_GC_CONFIG 8 #define __S48_GC_CONFIG 9 10 #include "page_constants.h" 11 #include "utils.h" 12 13 /* Configuration options */ 14 15 /* Debugging */ 16 17 #ifndef DISPLAY_MEASURE_GC 18 #define DISPLAY_MEASURE_GC FALSE 19 #endif 20 21 #ifndef BIBOP_LOG 22 #define BIBOP_LOG FALSE 23 #endif 24 25 26 /* Measurement */ 27 28 #ifndef S48_MEASURE_GC_TIME 29 #define S48_MEASURE_GC_TIME FALSE 30 #endif 31 32 #ifndef MEASURE_GC 33 #define MEASURE_GC FALSE 34 #endif 35 36 37 38 /* BIBOP */ 39 40 /* 1. Areas */ 41 42 /* For small objects */ 43 #ifndef S48_MINIMUM_SMALL_AREA_SIZE 44 #define S48_MINIMUM_SMALL_AREA_SIZE 32 /* 32 pages * 4KB = 128 KB */ 45 #endif 46 47 #ifndef S48_MAXIMUM_SMALL_AREA_SIZE 48 #define S48_MAXIMUM_SMALL_AREA_SIZE (2*S48_MINIMUM_SMALL_AREA_SIZE) 49 #endif 50 51 /* For weak pointers objects */ 52 #ifndef S48_MINIMUM_WEAK_AREA_SIZE 53 #define S48_MINIMUM_WEAK_AREA_SIZE 2 /* pages */ 54 #endif 55 56 #ifndef S48_MAXIMUM_WEAK_AREA_SIZE 57 #define S48_MAXIMUM_WEAK_AREA_SIZE 4 58 #endif 59 60 61 /* 2. Objects */ 62 63 #ifndef S48_SMALL_OBJECT_LIMIT 64 #define S48_SMALL_OBJECT_LIMIT PAGES_TO_BYTES_SMALL_CONST_FOR_CPP(16) 65 #endif 66 67 #if BYTES_TO_PAGES(S48_SMALL_OBJECT_LIMIT) > S48_MINIMUM_SMALL_AREA_SIZE 68 /* I replaced it ... 69 #error "S48_SMALL_OBJECT_LIMIT has to be smaller than S48_MINIMUM_SMALL_AREA_SIZE" 70 71 ... with this */ 72 #error "S48_MINIMUM_SMALL_AREA_SIZE has to be equal or greater than S48_SMALL_OBJECT_LIMIT" 73 #endif 74 75 76 /* 3. Creation Space (Ungar)*/ 77 78 /* Space for small objects */ 79 /* minimum_allocation_quantum= 128 pages (1p = 4KB) */ 80 81 #ifndef S48_CREATION_SPACE_SIZE 82 #define S48_CREATION_SPACE_SIZE (576) /* pages */ 83 #endif 84 85 /* Water mark for small objects */ 86 87 #ifndef S48_ADJUST_WATER_MARK 88 #define S48_ADJUST_WATER_MARK FALSE 89 #endif 90 91 #ifndef S48_DEFAULT_WATER_MARK 92 #define S48_DEFAULT_WATER_MARK (S48_CREATION_SPACE_SIZE / 2) 93 #endif 94 95 #if S48_DEFAULT_WATER_MARK >= S48_CREATION_SPACE_SIZE 96 #error "S48_DEFAULT_WATER_MARK has to be smaller than S48_CREATION_SPACE_SIZE" 97 #endif 98 99 /* If the large objects in the creation space sum up to more than 100 this, a collection is triggered. */ 101 #ifndef S48_MAXIMUM_LARGE_CREATION_SPACE_SIZE 102 #define S48_MAXIMUM_LARGE_CREATION_SPACE_SIZE (2*1024*1024) /* default: 2 MB */ 103 #endif 104 105 106 /* 4. Generations */ 107 108 /* Number of generations */ 109 #ifndef S48_GENERATIONS_COUNT 110 #define S48_GENERATIONS_COUNT 4 111 #endif 112 113 #if S48_GENERATIONS_COUNT < 1 114 #error "S48_GENERATIONS_COUNT has to be a positive number" 115 #endif 116 117 118 /* 5. Marking cards - Dirty vector */ 119 120 #ifndef S48_LOG_CARD_SIZE 121 #define S48_LOG_CARD_SIZE 11 122 #endif 123 124 #define S48_NO_DIRTY_VECTORS 0 /* For tracing everything always */ 125 #define S48_ADDRESS_DIRTY_VECTORS 1 126 127 #ifndef S48_DIRTY_VECTOR_METHOD 128 #define S48_DIRTY_VECTOR_METHOD S48_ADDRESS_DIRTY_VECTORS 129 #endif 130 131 /* Write Barrier Complexity */ 132 133 /* one can choose the complexity of the write-barrier. Currently there 134 are 3 implementations: 0 = every mutated location is traced. 1 = 135 only locations that now contain stobs are traced. 2 = only stobs 136 pointing into a younger generation are traced. */ 137 138 #define S48_MUTATED_LOCATION 0 139 #define S48_STOB_LOCATION 1 140 #define S48_INTERGEN_STOB_LOCATION 2 141 142 #ifndef S48_WRITE_BARRIER_COMPLEXITY 143 #define S48_WRITE_BARRIER_COMPLEXITY S48_INTERGEN_STOB_LOCATION 144 #endif 145 146 147 /* 6. Remembered Sets */ 148 149 #ifndef S48_USE_REMEMBERED_SETS 150 #define S48_USE_REMEMBERED_SETS TRUE 151 #endif 152 153 #if (S48_USE_REMEMBERED_SETS) 154 /* one can choose the kind of remembered set. Currently there are 3 155 implementations: 0 = dynamically allocated per stob, 1 = static 156 allocated space, 2 = static allocated but extensible by-need */ 157 158 #define S48_DYNAMIC_REMEMBERED_SETS 0 159 #define S48_STATIC_REMEMBERED_SETS 1 160 #define S48_EXTENSIBLE_REMEMBERED_SETS 2 161 162 #ifndef S48_REMEMBERED_SET_TYPE 163 #define S48_REMEMBERED_SET_TYPE S48_EXTENSIBLE_REMEMBERED_SETS 164 #endif 165 166 #ifndef S48_REMEMBERED_SET_SIZE 167 #define S48_REMEMBERED_SET_SIZE 1000 168 #endif 169 170 /* one can choose whether a remembered set may include duplicates or 171 not */ 172 173 #ifndef S48_UNIQUE_REMEMBERED_SET 174 #define S48_UNIQUE_REMEMBERED_SET TRUE 175 #endif 176 #endif /* if (S48_USE_REMEMBERED_SETS) */ 177 178 /* 7. Policies */ 179 180 /* Collection policy */ 181 /* Which generation should be collected? */ 182 183 #ifndef S48_COLLECTION_THRESHOLD 184 #define S48_COLLECTION_THRESHOLD FALSE 185 #endif 186 187 #ifndef S48_COLLECTION_HEAP_LIMIT 188 #define S48_COLLECTION_HEAP_LIMIT FALSE 189 #endif 190 191 #ifndef S48_COLLECTION_AGE_LIMIT 192 #define S48_COLLECTION_AGE_LIMIT FALSE 193 #endif 194 195 196 /* If no collection policy is defined ... */ 197 #if (S48_COLLECTION_THRESHOLD || \ 198 S48_COLLECTION_HEAP_LIMIT || \ 199 S48_COLLECTION_AGE_LIMIT) 200 #else 201 #undef S48_COLLECTION_THRESHOLD 202 #define S48_COLLECTION_THRESHOLD (1792*1024) /* Default */ 203 #endif 204 205 /* If a maximum heap size is defined, and we see that only this 206 percent of the maximum could be made free, we force a major 207 collection. */ 208 #ifndef S48_EMERGENCY_PERCENTAGE 209 #define S48_EMERGENCY_PERCENTAGE 10 210 #endif 211 212 /* Promotion policy */ 213 /* Which generation should the live objects be copied to? */ 214 215 #ifndef S48_PROMOTION_THRESHOLD 216 #define S48_PROMOTION_THRESHOLD FALSE 217 #endif 218 219 #ifndef S48_PROMOTION_HEAP_LIMIT 220 #define S48_PROMOTION_HEAP_LIMIT FALSE 221 #endif 222 223 #ifndef S48_PROMOTION_AGE_LIMIT 224 #define S48_PROMOTION_AGE_LIMIT FALSE 225 #endif 226 227 /* If no promotion policy is defined ... */ 228 #if (S48_PROMOTION_THRESHOLD || \ 229 S48_PROMOTION_HEAP_LIMIT || \ 230 S48_PROMOTION_AGE_LIMIT \ 231 ) 232 #else 233 #undef S48_PROMOTION_AGE_LIMIT 234 #define S48_PROMOTION_AGE_LIMIT 2 /* Default */ 235 #endif 236 237 /* Wilson's Opportunistic Objects promotion. The Objects become the 238 age of their Area according to the allocation. The first part 1/n of 239 all Areas are the older ones (i.e. 2 -> 1/2 = half of all Areas) */ 240 #ifndef S48_PART_OF_OLD_AREAS 241 #define S48_PART_OF_OLD_AREAS 1 242 #endif 243 244 /* From Paper: bigsurvey.ps, page 38 */ 245 #ifndef S48_USE_STATIC_SPACE 246 #define S48_USE_STATIC_SPACE TRUE 247 #endif 248 249 #if (S48_USE_STATIC_SPACE && S48_GENERATIONS_COUNT < 3) 250 #error "Static Space option needs at least 3 generations!" 251 #endif 252 253 /* Transport Link Cells - Ghuloum, Dybvig 2007 */ 254 #define S48_HAVE_TRANSPORT_LINK_CELLS TRUE 255 256 #endif /* #ifndef __S48_GC_CONFIG */ 257