diff options
author | Jan Kotas <jkotas@microsoft.com> | 2019-05-14 19:07:53 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-14 19:07:53 -0700 |
commit | 718598334310f6ad331ba2893ee4557beffaa74c (patch) | |
tree | 7bc4830b29442e79be150b67dc0f67473e5ba681 /src/gc | |
parent | 6a85ca560a7dfa109c6f17c0b76d93373dbd5a00 (diff) | |
download | coreclr-718598334310f6ad331ba2893ee4557beffaa74c.tar.gz coreclr-718598334310f6ad331ba2893ee4557beffaa74c.tar.bz2 coreclr-718598334310f6ad331ba2893ee4557beffaa74c.zip |
Fix issues reported by PREfast static analysis tool (#24577)
Diffstat (limited to 'src/gc')
-rw-r--r-- | src/gc/env/gcenv.os.h | 2 | ||||
-rw-r--r-- | src/gc/env/gcenv.unix.inl | 2 | ||||
-rw-r--r-- | src/gc/env/gcenv.windows.inl | 2 | ||||
-rw-r--r-- | src/gc/gc.cpp | 14 | ||||
-rw-r--r-- | src/gc/handletablecore.cpp | 4 | ||||
-rw-r--r-- | src/gc/softwarewritewatch.h | 2 |
6 files changed, 9 insertions, 17 deletions
diff --git a/src/gc/env/gcenv.os.h b/src/gc/env/gcenv.os.h index 7fa1ba7062..393bd1fe18 100644 --- a/src/gc/env/gcenv.os.h +++ b/src/gc/env/gcenv.os.h @@ -444,7 +444,7 @@ public: static void GetMemoryStatus(uint32_t* memory_load, uint64_t* available_physical, uint64_t* available_page_file); // Get size of an OS memory page - static uint32_t GetPageSize(); + static size_t GetPageSize(); // // Misc diff --git a/src/gc/env/gcenv.unix.inl b/src/gc/env/gcenv.unix.inl index 50683aeea8..42b8a434a0 100644 --- a/src/gc/env/gcenv.unix.inl +++ b/src/gc/env/gcenv.unix.inl @@ -11,7 +11,7 @@ extern uint32_t g_pageSizeUnixInl; #define OS_PAGE_SIZE GCToOSInterface::GetPageSize() -__forceinline uint32_t GCToOSInterface::GetPageSize() +__forceinline size_t GCToOSInterface::GetPageSize() { return g_pageSizeUnixInl; } diff --git a/src/gc/env/gcenv.windows.inl b/src/gc/env/gcenv.windows.inl index 3b15dfd890..7e81016735 100644 --- a/src/gc/env/gcenv.windows.inl +++ b/src/gc/env/gcenv.windows.inl @@ -10,7 +10,7 @@ #define OS_PAGE_SIZE GCToOSInterface::GetPageSize() -__forceinline uint32_t GCToOSInterface::GetPageSize() +__forceinline size_t GCToOSInterface::GetPageSize() { return 0x1000; } diff --git a/src/gc/gc.cpp b/src/gc/gc.cpp index e8f2400c1b..c6a858c8fa 100644 --- a/src/gc/gc.cpp +++ b/src/gc/gc.cpp @@ -28077,15 +28077,7 @@ BOOL gc_heap::find_card(uint32_t* card_table, { card_word_value = *(++last_card_word); } while ((last_card_word < &card_table [card_word_end]) && - -#ifdef _MSC_VER - (card_word_value == (1 << card_word_width)-1) -#else - // if left shift count >= width of type, - // gcc reports error. - (card_word_value == ~0u) -#endif // _MSC_VER - ); + (card_word_value == ~0u /* (1 << card_word_width)-1 */)); bit_position = 0; } } while (card_word_value & 1); @@ -30477,7 +30469,7 @@ size_t gc_heap::joined_youngest_desired (size_t new_allocation) uint32_t memory_load = 0; get_memory_info (&memory_load); settings.exit_memory_load = memory_load; - dprintf (2, ("Current emory load: %d", memory_load)); + dprintf (2, ("Current memory load: %d", memory_load)); size_t final_total = trim_youngest_desired (memory_load, total_new_allocation, total_min_allocation); @@ -37418,7 +37410,7 @@ void GCHeap::DiagScanDependentHandles (handle_scan_fn fn, int gen_number, ScanCo // Go through and touch (read) each page straddled by a memory block. void TouchPages(void * pStart, size_t cb) { - const uint32_t pagesize = OS_PAGE_SIZE; + const size_t pagesize = OS_PAGE_SIZE; _ASSERTE(0 == (pagesize & (pagesize-1))); // Must be a power of 2. if (cb) { diff --git a/src/gc/handletablecore.cpp b/src/gc/handletablecore.cpp index 7e531f9ce6..5fc661c000 100644 --- a/src/gc/handletablecore.cpp +++ b/src/gc/handletablecore.cpp @@ -1409,7 +1409,7 @@ uint32_t SegmentInsertBlockFromFreeListWorker(TableSegment *pSegment, uint32_t u void * pvCommit = pSegment->rgValue + (uCommitLine * HANDLE_HANDLES_PER_BLOCK); // we should commit one more page of handles - uint32_t dwCommit = OS_PAGE_SIZE; + size_t dwCommit = OS_PAGE_SIZE; // commit the memory if (!GCToOSInterface::VirtualCommit(pvCommit, dwCommit)) @@ -1774,7 +1774,7 @@ BOOL DoesSegmentNeedsToTrimExcessPages(TableSegment *pSegment) if (uEmptyLine < uDecommitLine) { // derive some useful info about the page size - uintptr_t dwPageRound = (uintptr_t)OS_PAGE_SIZE - 1; + uintptr_t dwPageRound = OS_PAGE_SIZE - 1; uintptr_t dwPageMask = ~dwPageRound; // compute the address corresponding to the empty line diff --git a/src/gc/softwarewritewatch.h b/src/gc/softwarewritewatch.h index e59fd61d04..92ffbf82db 100644 --- a/src/gc/softwarewritewatch.h +++ b/src/gc/softwarewritewatch.h @@ -8,7 +8,7 @@ #include "gcinterface.h" #include "gc.h" -#define WRITE_WATCH_UNIT_SIZE 0x1000 +#define WRITE_WATCH_UNIT_SIZE ((size_t)0x1000) #ifdef FEATURE_USE_SOFTWARE_WRITE_WATCH_FOR_GC_HEAP #ifndef DACCESS_COMPILE |