+/*
+ * We split fragments at the border of the current nursery limit. When we
+ * allocate from the nursery we only consider fragments that start in the
+ * current nursery section. We build fragments for the entire nursery in
+ * order to facilitate scanning it for objects (adding a nursery frag also
+ * marks a region in the nursery as being free)
+ */
+static void
+add_nursery_frag_checks (SgenFragmentAllocator *allocator, char *frag_start, char *frag_end)
+{
+ char *nursery_limit = sgen_nursery_start + sgen_nursery_size;
+
+ if (frag_start < nursery_limit && frag_end > nursery_limit) {
+ add_nursery_frag (allocator, nursery_limit - frag_start, frag_start, nursery_limit);
+ add_nursery_frag (allocator, frag_end - nursery_limit, nursery_limit, frag_end);
+ } else {
+ add_nursery_frag (allocator, frag_end - frag_start, frag_start, frag_end);
+ }
+}
+