Skip to content
Merged
Changes from 3 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
6 changes: 4 additions & 2 deletions src/coreclr/gc/gc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6450,7 +6450,8 @@ class heap_select
if (GCToOSInterface::CanGetCurrentProcessorNumber())
{
uint32_t proc_no = GCToOSInterface::GetCurrentProcessorNumber();
proc_no_to_heap_no[proc_no] = (uint16_t)heap_number;
// proc_no could likely exceed MAX_SUPPORTED_CPUS on x86
proc_no_to_heap_no[proc_no % MAX_SUPPORTED_CPUS] = (uint16_t)heap_number;
}
}

Expand All @@ -6472,7 +6473,8 @@ class heap_select
if (GCToOSInterface::CanGetCurrentProcessorNumber())
{
uint32_t proc_no = GCToOSInterface::GetCurrentProcessorNumber();
int adjusted_heap = proc_no_to_heap_no[proc_no];
// proc_no could likely exceed MAX_SUPPORTED_CPUS on x86
int adjusted_heap = proc_no_to_heap_no[proc_no % MAX_SUPPORTED_CPUS];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this was code from before but do we need adjusted_heap to be signed? Will there ever be a case where adjusted_heap is negative?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't believe that could occur.

// with dynamic heap count, need to make sure the value is in range.
if (adjusted_heap >= gc_heap::n_heaps)
{
Expand Down