-
Notifications
You must be signed in to change notification settings - Fork 2.7k
[Arm64/Unix] WIP-DoNotMerge-Draft 64K static support #10891
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There may be complications here for remote debugging with target having separate size as host. Also this may need a different mechanism to determine the os page size dynamically. |
||
#endif // !__PLATFORM_SPECIFIC_INCLUDED |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It would be nice to have a name for this magic number. Suggestions? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. GC_PAGE_SIZE |
||
|
||
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 ); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On Windows, this really is the true operating system page size and not an arbitrary constant. The array of pointers that we receive from I don't think that |
||
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, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These may be better converted to hard numbers. Since they are supposedly empirical. #if defined (_TARGET_WIN64_)
#define card_size 0x200
#else
#define card_size 0x100
#endif There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. They are empirical, yes, but they are also tied to |
||
// Returns the index of the card word a card is in | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -76,7 +76,7 @@ | |
#define USE_UPPER_ADDRESS 0 | ||
|
||
#elif defined(_TARGET_AMD64_) || defined(_TARGET_ARM64_) | ||
#define PAGE_SIZE 0x1000 | ||
#define PAGE_SIZE 0x10000 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Page size will become dynamic |
||
#define UPPER_ADDRESS_MAPPING_FACTOR 2 | ||
#define CLR_UPPER_ADDRESS_MIN 0x64400000000 | ||
#define CODEHEAP_START_ADDRESS 0x64480000000 | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,7 +58,7 @@ enum VIRTUAL_CONSTANTS | |
VIRTUAL_EXECUTE, | ||
VIRTUAL_EXECUTE_READ, | ||
|
||
VIRTUAL_PAGE_SIZE = 0x1000, | ||
VIRTUAL_PAGE_SIZE = 0x10000, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Virtual page size will become dynamic an so will VIRTUAL_PAGE_SIZE_MASK |
||
VIRTUAL_PAGE_MASK = VIRTUAL_PAGE_SIZE - 1, | ||
BOUNDARY_64K = 0xffff | ||
}; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 64K page size will increase the amount of wasted memory |
||
dwSize += alignment; | ||
SIZE_T addr = (SIZE_T)ClrVirtualAlloc(lpAddress, dwSize, flAllocationType, flProtect); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Section alignment to match maximum supported page size. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe that this will make native images a lot bigger. I am not sure whether this would be acceptable. How are the native binary formats like ELF dealing with the 64k pages? Do they have the sections aligned at 64k boundaries as well? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jkotas Based on what I read in golang/go#10180 (cited by @vielmetti). I think ELF will be aligning the sections to 64K page boundaries. However the ELF file size will not be padded to fill 64K, it will truncated as needed. It is possible we could support file with 4K alignment, but PAL loader would need to be updated. This seems feasible since we have RELOC_PAGE_SIZE set to 4K. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @sdmaclea what do you mean by RELOC_PAGE_SIZE? I don't see such a symbol defined anywhere. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @janvorli src/zap/zaprelocs.h:#define RELOCATION_PAGE_SIZE 0x1000 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jkotas For the smallest files the size is growing about the same amount
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jkotas I'll see if I can fix the native image loader to not require 64K alignment There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We may to tweak the file format so that we can get the page alignment, without the padding. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
@jkotas We objdumped an elf. The sections are only aligned to something like 8 byte boundaries. The VA of the section is incremented by a multiple of the maximum page size. I think for Arm64 is should be 16byte boundaries. I took a look at "Visual Studio, Microsoft Portable Executable and Common Object File Format Specification Revision 9.3 – December 29, 2015" the following statement appears in the text.
I think this would allow the PE to behave similarly to ELF. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK I created PR #10959 with the ZapWriter Loader rework to prevent this bloat. |
||
#elif defined(_TARGET_ARM_) && defined(FEATURE_CORESYSTEM) | ||
if (!IsReadyToRunCompilation()) | ||
{ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,7 +55,7 @@ void ZapWriter::Initialize() | |
m_FileAlignment = 0x200; | ||
} | ||
|
||
#define SECTION_ALIGNMENT 0x1000 | ||
#define SECTION_ALIGNMENT 0x10000 | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Section alignment to match maximum supported page size. |
||
void ZapWriter::Save(IStream * pStream) | ||
{ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice to stop duplicating this GC code here.