Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid declaring an object cannot fit in a segment if we already have committed space for it #55585

Merged
merged 1 commit into from
Jul 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions src/coreclr/gc/gc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14646,6 +14646,7 @@ BOOL gc_heap::short_on_end_of_seg (heap_segment* seg)
BOOL sufficient_p = sufficient_space_regions (end_gen0_region_space, end_space_after_gc());
#else
BOOL sufficient_p = sufficient_space_end_seg (allocated,
heap_segment_committed (seg),
heap_segment_reserved (seg),
end_space_after_gc());
#endif //USE_REGIONS
Expand Down Expand Up @@ -37875,13 +37876,18 @@ bool gc_heap::sufficient_space_regions (size_t end_space, size_t end_space_requi
return false;
}
#else //USE_REGIONS
BOOL gc_heap::sufficient_space_end_seg (uint8_t* start, uint8_t* seg_end, size_t end_space_required)
BOOL gc_heap::sufficient_space_end_seg (uint8_t* start, uint8_t* committed, uint8_t* reserved, size_t end_space_required)
{
BOOL can_fit = FALSE;
size_t end_seg_space = (size_t)(seg_end - start);
if (end_seg_space > end_space_required)
size_t committed_space = (size_t)(committed - start);
size_t end_seg_space = (size_t)(reserved - start);
if (committed_space > end_space_required)
{
return check_against_hard_limit (end_space_required);
return true;
}
else if (end_seg_space > end_space_required)
{
return check_against_hard_limit (end_space_required - committed_space);
}
else
return false;
Expand Down Expand Up @@ -38045,7 +38051,7 @@ BOOL gc_heap::ephemeral_gen_fit_p (gc_tuning_point tp)
size_t gen0_end_space = get_gen0_end_space();
BOOL can_fit = sufficient_space_regions (gen0_end_space, end_space);
#else //USE_REGIONS
BOOL can_fit = sufficient_space_end_seg (start, heap_segment_reserved (ephemeral_heap_segment), end_space);
BOOL can_fit = sufficient_space_end_seg (start, heap_segment_committed (ephemeral_heap_segment), heap_segment_reserved (ephemeral_heap_segment), end_space);
#endif //USE_REGIONS
return can_fit;
}
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/gc/gcpriv.h
Original file line number Diff line number Diff line change
Expand Up @@ -3182,7 +3182,7 @@ class gc_heap
BOOL& should_expand);
#ifndef USE_REGIONS
PER_HEAP
BOOL sufficient_space_end_seg (uint8_t* start, uint8_t* seg_end,
BOOL sufficient_space_end_seg (uint8_t* start, uint8_t* committed, uint8_t* reserved,
size_t end_space_required);
#endif //!USE_REGIONS

Expand Down