From 864f227358baaf29822f1f1ef702af06e64af9bd Mon Sep 17 00:00:00 2001 From: "Steve MacLean, Qualcomm Datacenter Technologies, Inc" Date: Mon, 10 Apr 2017 19:52:42 +0000 Subject: [PATCH 1/2] Draft 64K static support --- src/gc/gcsvr.cpp | 1 + src/gc/gcwks.cpp | 1 + src/inc/switches.h | 2 +- src/pal/src/include/pal/virtual.h | 2 +- src/utilcode/util.cpp | 2 ++ src/zap/zapimage.cpp | 2 +- src/zap/zapwriter.cpp | 2 +- 7 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/gc/gcsvr.cpp b/src/gc/gcsvr.cpp index 70801dd4ee70..7656dd9f7f36 100644 --- a/src/gc/gcsvr.cpp +++ b/src/gc/gcsvr.cpp @@ -4,6 +4,7 @@ +#define OS_PAGE_SIZE 0x1000 #include "common.h" #if defined(FEATURE_SVR_GC) diff --git a/src/gc/gcwks.cpp b/src/gc/gcwks.cpp index 5c489df0e0dd..0c4728958756 100644 --- a/src/gc/gcwks.cpp +++ b/src/gc/gcwks.cpp @@ -4,6 +4,7 @@ +#define OS_PAGE_SIZE 0x1000 #include "common.h" #include "gcenv.h" diff --git a/src/inc/switches.h b/src/inc/switches.h index bb303876e8ae..3b01b006ad9c 100644 --- a/src/inc/switches.h +++ b/src/inc/switches.h @@ -76,7 +76,7 @@ #define USE_UPPER_ADDRESS 0 #elif defined(_TARGET_AMD64_) || defined(_TARGET_ARM64_) - #define PAGE_SIZE 0x1000 + #define PAGE_SIZE 0x10000 #define UPPER_ADDRESS_MAPPING_FACTOR 2 #define CLR_UPPER_ADDRESS_MIN 0x64400000000 #define CODEHEAP_START_ADDRESS 0x64480000000 diff --git a/src/pal/src/include/pal/virtual.h b/src/pal/src/include/pal/virtual.h index 31d225fc0442..f6cf6a18f677 100644 --- a/src/pal/src/include/pal/virtual.h +++ b/src/pal/src/include/pal/virtual.h @@ -58,7 +58,7 @@ enum VIRTUAL_CONSTANTS VIRTUAL_EXECUTE, VIRTUAL_EXECUTE_READ, - VIRTUAL_PAGE_SIZE = 0x1000, + VIRTUAL_PAGE_SIZE = 0x10000, VIRTUAL_PAGE_MASK = VIRTUAL_PAGE_SIZE - 1, BOUNDARY_64K = 0xffff }; diff --git a/src/utilcode/util.cpp b/src/utilcode/util.cpp index c215a4921348..10e934fa9060 100644 --- a/src/utilcode/util.cpp +++ b/src/utilcode/util.cpp @@ -551,6 +551,8 @@ LPVOID ClrVirtualAllocAligned(LPVOID lpAddress, SIZE_T dwSize, DWORD flAllocatio #else // !FEATURE_PAL + if(alignment < PAGE_SIZE) alignment = PAGE_SIZE; + // UNIXTODO: Add a specialized function to PAL so that we don't have to waste memory dwSize += alignment; SIZE_T addr = (SIZE_T)ClrVirtualAlloc(lpAddress, dwSize, flAllocationType, flProtect); diff --git a/src/zap/zapimage.cpp b/src/zap/zapimage.cpp index cb69ba9f96c9..ca8ba3d8dd66 100644 --- a/src/zap/zapimage.cpp +++ b/src/zap/zapimage.cpp @@ -1547,7 +1547,7 @@ void ZapImage::OutputTables() #if defined(FEATURE_PAL) // PAL library requires native image sections to align to page bounaries. - SetFileAlignment(0x1000); + SetFileAlignment(0x10000); #elif defined(_TARGET_ARM_) && defined(FEATURE_CORESYSTEM) if (!IsReadyToRunCompilation()) { diff --git a/src/zap/zapwriter.cpp b/src/zap/zapwriter.cpp index e1a0c2786461..7ccf7e47fd47 100644 --- a/src/zap/zapwriter.cpp +++ b/src/zap/zapwriter.cpp @@ -55,7 +55,7 @@ void ZapWriter::Initialize() m_FileAlignment = 0x200; } -#define SECTION_ALIGNMENT 0x1000 +#define SECTION_ALIGNMENT 0x10000 void ZapWriter::Save(IStream * pStream) { From 3d7aec5c80b30d5facc6ea4a98a6ec10e19276d6 Mon Sep 17 00:00:00 2001 From: "Steve MacLean, Qualcomm Datacenter Technologies, Inc" Date: Tue, 11 Apr 2017 18:16:35 +0000 Subject: [PATCH 2/2] Use 64K page for GC --- src/ToolBox/SOS/Strike/gcroot.cpp | 4 ++-- src/ToolBox/SOS/Strike/platformspecific.h | 2 +- src/gc/env/gcenv.base.h | 2 +- src/gc/gc.cpp | 8 ++++---- src/gc/gcpriv.h | 4 ++-- src/gc/gcsvr.cpp | 1 - src/gc/gcwks.cpp | 1 - 7 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/ToolBox/SOS/Strike/gcroot.cpp b/src/ToolBox/SOS/Strike/gcroot.cpp index 86080989ec7b..3cb282677a0c 100644 --- a/src/ToolBox/SOS/Strike/gcroot.cpp +++ b/src/ToolBox/SOS/Strike/gcroot.cpp @@ -1317,9 +1317,9 @@ void PrintNotReachableInRange(TADDR rngStart, TADDR rngEnd, BOOL bExcludeReadyFo // In the code we also rely on the assumption that one card_table entry (DWORD) covers an entire os page // #if defined (_TARGET_WIN64_) -#define card_size ((size_t)(2*DT_OS_PAGE_SIZE/card_word_width)) +#define card_size ((size_t)(2*4096/card_word_width)) #else -#define card_size ((size_t)(DT_OS_PAGE_SIZE/card_word_width)) +#define card_size ((size_t)(4096/card_word_width)) #endif //_TARGET_WIN64_ // so card_size = 128 on x86, 256 on x64 diff --git a/src/ToolBox/SOS/Strike/platformspecific.h b/src/ToolBox/SOS/Strike/platformspecific.h index fdbc5b52ca50..db6800c22e78 100644 --- a/src/ToolBox/SOS/Strike/platformspecific.h +++ b/src/ToolBox/SOS/Strike/platformspecific.h @@ -190,6 +190,6 @@ struct DT_RTL_USER_PROCESS_PARAMETERS #endif // !FEATURE_PAL -#define DT_OS_PAGE_SIZE 4096 +#define DT_OS_PAGE_SIZE 0x10000 #endif // !__PLATFORM_SPECIFIC_INCLUDED diff --git a/src/gc/env/gcenv.base.h b/src/gc/env/gcenv.base.h index a4befca09ede..77da76de8a60 100644 --- a/src/gc/env/gcenv.base.h +++ b/src/gc/env/gcenv.base.h @@ -300,7 +300,7 @@ typedef DPTR(uint8_t) PTR_uint8_t; #define DECLSPEC_ALIGN(x) __declspec(align(x)) -#define OS_PAGE_SIZE 4096 +#define OS_PAGE_SIZE 0x10000 #ifndef _ASSERTE #define _ASSERTE(_expr) ASSERT(_expr) diff --git a/src/gc/gc.cpp b/src/gc/gc.cpp index ecc13e38fd54..f8624e753c01 100644 --- a/src/gc/gc.cpp +++ b/src/gc/gc.cpp @@ -6306,7 +6306,7 @@ void gc_heap::make_c_mark_list (uint8_t** arr) static const size_t card_bundle_word_width = 32; // How do we express the fact that 32 bits (card_word_width) is one uint32_t? -static const size_t card_bundle_size = (size_t)(OS_PAGE_SIZE / (sizeof(uint32_t)*card_bundle_word_width)); +static const size_t card_bundle_size = (size_t)(4096 / (sizeof(uint32_t)*card_bundle_word_width)); inline size_t card_bundle_word (size_t cardb) @@ -18786,13 +18786,13 @@ void gc_heap::fix_card_table () time_stop - time_start, tot_cycles); #endif //TIME_WRITE_WATCH - assert( ((card_size * card_word_width)&(OS_PAGE_SIZE-1))==0 ); + assert( ((card_size * card_word_width)&(4096-1))==0 ); //printf ("%Ix written into\n", bcount); dprintf (3,("Found %Id pages written", bcount)); for (unsigned i = 0; i < bcount; i++) { // Set the card words corresponding to the entire page. - for (unsigned j = 0; j < (card_size*card_word_width)/OS_PAGE_SIZE; j++) + for (unsigned j = 0; j < (card_size*card_word_width)/4096; j++) { card_table [card_word (card_of (g_addresses [i]))+j] = ~0u; } @@ -26610,7 +26610,7 @@ void gc_heap::revisit_written_pages (BOOL concurrent_p, BOOL reset_only_p) card_table [card_word (card_of (background_written_addresses [i]))] = ~0u; dprintf (3,("Set Cards [%p:%p, %p:%p[", card_of (background_written_addresses [i]), g_addresses [i], - card_of (background_written_addresses [i]+OS_PAGE_SIZE), background_written_addresses [i]+OS_PAGE_SIZE)); + card_of (background_written_addresses [i]+4096), background_written_addresses [i]+4096)); #endif //NO_WRITE_BARRIER uint8_t* page = (uint8_t*)background_written_addresses[i]; dprintf (3, ("looking at page %d at %Ix(h: %Ix)", i, diff --git a/src/gc/gcpriv.h b/src/gc/gcpriv.h index 108045cd37c6..4308e43245b3 100644 --- a/src/gc/gcpriv.h +++ b/src/gc/gcpriv.h @@ -4311,9 +4311,9 @@ dynamic_data* gc_heap::dynamic_data_of (int gen_number) // In the code we also rely on the assumption that one card_table entry (uint32_t) covers an entire os page // #if defined (BIT64) -#define card_size ((size_t)(2*OS_PAGE_SIZE/card_word_width)) +#define card_size ((size_t)(8192/card_word_width)) #else -#define card_size ((size_t)(OS_PAGE_SIZE/card_word_width)) +#define card_size ((size_t)(4096/card_word_width)) #endif // BIT64 // Returns the index of the card word a card is in diff --git a/src/gc/gcsvr.cpp b/src/gc/gcsvr.cpp index 7656dd9f7f36..70801dd4ee70 100644 --- a/src/gc/gcsvr.cpp +++ b/src/gc/gcsvr.cpp @@ -4,7 +4,6 @@ -#define OS_PAGE_SIZE 0x1000 #include "common.h" #if defined(FEATURE_SVR_GC) diff --git a/src/gc/gcwks.cpp b/src/gc/gcwks.cpp index 0c4728958756..5c489df0e0dd 100644 --- a/src/gc/gcwks.cpp +++ b/src/gc/gcwks.cpp @@ -4,7 +4,6 @@ -#define OS_PAGE_SIZE 0x1000 #include "common.h" #include "gcenv.h"