gc_config.h 6.0 KB

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