diff options
author | Jan Vorlicek <janvorli@microsoft.com> | 2019-04-10 15:18:03 +0200 |
---|---|---|
committer | Jan Vorlicek <janvorli@microsoft.com> | 2019-04-10 15:18:03 +0200 |
commit | fe355a617ff5e56c8607c2b12c650c3b95c5cfbd (patch) | |
tree | c60b462e41a0d26ff13e960dcd64da00b7d4b4f9 /src/gc | |
parent | 3c07febf02b67c4c5f8eef846d5aa581372e454e (diff) | |
download | coreclr-fe355a617ff5e56c8607c2b12c650c3b95c5cfbd.tar.gz coreclr-fe355a617ff5e56c8607c2b12c650c3b95c5cfbd.tar.bz2 coreclr-fe355a617ff5e56c8607c2b12c650c3b95c5cfbd.zip |
Fix few issues discovered by testing
Diffstat (limited to 'src/gc')
-rw-r--r-- | src/gc/unix/gcenv.unix.cpp | 7 | ||||
-rw-r--r-- | src/gc/windows/gcenv.windows.cpp | 11 |
2 files changed, 8 insertions, 10 deletions
diff --git a/src/gc/unix/gcenv.unix.cpp b/src/gc/unix/gcenv.unix.cpp index fbba7d90ab..65a20d82f7 100644 --- a/src/gc/unix/gcenv.unix.cpp +++ b/src/gc/unix/gcenv.unix.cpp @@ -575,12 +575,11 @@ bool GCToOSInterface::VirtualCommit(void* address, size_t size, uint16_t node) { int usedNodeMaskBits = g_highestNumaNode + 1; int nodeMaskLength = (usedNodeMaskBits + sizeof(unsigned long) - 1) / sizeof(unsigned long); - unsigned long *nodeMask = (unsigned long*)alloca(nodeMaskLength * sizeof(unsigned long)); - memset(nodeMask, 0, nodeMaskLength); + unsigned long nodeMask[nodeMaskLength]; + memset(nodeMask, 0, sizeof(nodeMask)); int index = node / sizeof(unsigned long); - int mask = ((unsigned long)1) << (node & (sizeof(unsigned long) - 1)); - nodeMask[index] = mask; + nodeMask[index] = ((unsigned long)1) << (node & (sizeof(unsigned long) - 1)); int st = mbind(address, size, MPOL_PREFERRED, nodeMask, usedNodeMaskBits, 0); assert(st == 0); diff --git a/src/gc/windows/gcenv.windows.cpp b/src/gc/windows/gcenv.windows.cpp index d2bcde899a..5f6a0ff291 100644 --- a/src/gc/windows/gcenv.windows.cpp +++ b/src/gc/windows/gcenv.windows.cpp @@ -1298,7 +1298,7 @@ bool GCToOSInterface::GetProcessorForHeap(uint16_t heap_number, uint16_t* proc_n bool success = false; // Locate heap_number-th available processor - uint16_t procNumber; + uint16_t procIndex; size_t cnt = heap_number; for (uint16_t i = 0; i < GCToOSInterface::GetTotalProcessorCount(); i++) { @@ -1306,7 +1306,7 @@ bool GCToOSInterface::GetProcessorForHeap(uint16_t heap_number, uint16_t* proc_n { if (cnt == 0) { - procNumber = i; + procIndex = i; success = true; break; } @@ -1321,12 +1321,12 @@ bool GCToOSInterface::GetProcessorForHeap(uint16_t heap_number, uint16_t* proc_n if (CanEnableGCCPUGroups()) { - GetGroupForProcessor(procNumber, &gn, &gpn); + GetGroupForProcessor(procIndex, &gn, &gpn); } else { gn = GroupProcNo::NoGroup; - gpn = procNumber; + gpn = procIndex; } GroupProcNo groupProcNo(gn, gpn); @@ -1343,14 +1343,13 @@ bool GCToOSInterface::GetProcessorForHeap(uint16_t heap_number, uint16_t* proc_n else { // Get the current processor group - PROCESSOR_NUMBER procNumber; GetCurrentProcessorNumberEx(&procNumber); } procNumber.Number = (BYTE)gpn; procNumber.Reserved = 0; - if (GetNumaProcessorNodeEx(&procNumber, node_no)) + if (!GetNumaProcessorNodeEx(&procNumber, node_no)) { *node_no = NUMA_NODE_UNDEFINED; } |