@@ -16657,6 +16657,41 @@ void gc_heap::adjust_limit_clr (uint8_t* start, size_t limit_size, size_t size,
1665716657 // - ephemeral_heap_segment may change due to other threads allocating
1665816658 heap_segment* gen0_segment = ephemeral_heap_segment;
1665916659
16660+ #ifdef BACKGROUND_GC
16661+ {
16662+ if (uoh_p && gc_heap::background_running_p())
16663+ {
16664+ uint8_t* obj = acontext->alloc_ptr;
16665+ uint8_t* result = obj;
16666+ uint8_t* current_lowest_address = background_saved_lowest_address;
16667+ uint8_t* current_highest_address = background_saved_highest_address;
16668+
16669+ if (current_c_gc_state == c_gc_state_planning)
16670+ {
16671+ dprintf (3, ("Concurrent allocation of a large object %zx",
16672+ (size_t)obj));
16673+ //mark the new block specially so we know it is a new object
16674+ if ((result < current_highest_address) && (result >= current_lowest_address))
16675+ {
16676+ #ifdef DOUBLY_LINKED_FL
16677+ heap_segment* seg = seg_mapping_table_segment_of (result);
16678+ // if bgc_allocated is 0 it means it was allocated during bgc sweep,
16679+ // and since sweep does not look at this seg we cannot set the mark array bit.
16680+ uint8_t* background_allocated = heap_segment_background_allocated(seg);
16681+ if (background_allocated != 0)
16682+ #endif //DOUBLY_LINKED_FL
16683+ {
16684+ dprintf(3, ("Setting mark bit at address %zx",
16685+ (size_t)(&mark_array[mark_word_of(result)])));
16686+
16687+ mark_array_set_marked(result);
16688+ }
16689+ }
16690+ }
16691+ }
16692+ }
16693+ #endif //BACKGROUND_GC
16694+
1666016695 // check if space to clear is all dirty from prior use or only partially
1666116696 if ((seg == 0) || (clear_limit <= heap_segment_used (seg)))
1666216697 {
@@ -44508,37 +44543,6 @@ CObjectHeader* gc_heap::allocate_uoh_object (size_t jsize, uint32_t flags, int g
4450844543
4450944544 CObjectHeader* obj = (CObjectHeader*)result;
4451044545
44511- #ifdef BACKGROUND_GC
44512- if (gc_heap::background_running_p())
44513- {
44514- uint8_t* current_lowest_address = background_saved_lowest_address;
44515- uint8_t* current_highest_address = background_saved_highest_address;
44516-
44517- if (current_c_gc_state == c_gc_state_planning)
44518- {
44519- dprintf (3, ("Concurrent allocation of a large object %zx",
44520- (size_t)obj));
44521- //mark the new block specially so we know it is a new object
44522- if ((result < current_highest_address) && (result >= current_lowest_address))
44523- {
44524- #ifdef DOUBLY_LINKED_FL
44525- heap_segment* seg = seg_mapping_table_segment_of (result);
44526- // if bgc_allocated is 0 it means it was allocated during bgc sweep,
44527- // and since sweep does not look at this seg we cannot set the mark array bit.
44528- uint8_t* background_allocated = heap_segment_background_allocated(seg);
44529- if (background_allocated != 0)
44530- #endif //DOUBLY_LINKED_FL
44531- {
44532- dprintf(3, ("Setting mark bit at address %zx",
44533- (size_t)(&mark_array[mark_word_of(result)])));
44534-
44535- mark_array_set_marked(result);
44536- }
44537- }
44538- }
44539- }
44540- #endif //BACKGROUND_GC
44541-
4454244546 assert (obj != 0);
4454344547 assert ((size_t)obj == Align ((size_t)obj, align_const));
4454444548
0 commit comments