-
Notifications
You must be signed in to change notification settings - Fork 2.7k
[Arm64/Unix] WIP-DoNotMerge-Draft 64K static support #10891
Changes from 1 commit
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 |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
|
||
|
||
|
||
#define OS_PAGE_SIZE 0x1000 | ||
#include "common.h" | ||
|
||
#if defined(FEATURE_SVR_GC) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
|
||
|
||
|
||
#define OS_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. Same as above |
||
#include "common.h" | ||
|
||
#include "gcenv.h" | ||
|
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.
This creates two definitions for OS_PAGE_SIZE in the same project. Needs to be actual current OS_PAGE_SIZE.