mirror of
https://github.com/dart-lang/sdk
synced 2024-10-04 16:04:53 +00:00
[vm] Support 16k page size on Android.
- Increase the size of the FFI trampoline template. - Increase alignment of ELF binaries generated by the VM. - Pass flags for binaries generated by the NDK's linker increase alignment. - Runtime allocation already either rounds up to the runtime-queried page size or assumes it is no more than 512k. TEST=ci, readelf Bug: go/16k-app-guide Change-Id: I4fdb2a47534a6a24875e205c3a357b5415ca18b8 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/321302 Commit-Queue: Ryan Macnak <rmacnak@google.com> Reviewed-by: Liam Appelbe <liama@google.com> Reviewed-by: Slava Egorov <vegorov@google.com>
This commit is contained in:
parent
edaea9b489
commit
6dcbc9fc14
|
@ -388,6 +388,10 @@ config("compiler") {
|
|||
"-Wl,--exclude-libs=libc++_static.a",
|
||||
|
||||
"-fuse-ld=lld",
|
||||
|
||||
# Currently defaults to 4k, but Android will be moving to 16k page size,
|
||||
# and for future-proofing, 64k boundaries will be required.
|
||||
"-Wl,-z,max-page-size=65536",
|
||||
]
|
||||
|
||||
if (is_clang) {
|
||||
|
|
|
@ -1025,6 +1025,7 @@ class PrecompilerCompilerConfiguration extends CompilerConfiguration
|
|||
"$host-x86_64/bin/$abiTriple-gcc";
|
||||
shared = '-shared';
|
||||
ldFlags.add('-Wl,--no-undefined');
|
||||
ldFlags.add('-Wl,-z,max-page-size=65536');
|
||||
} else if (Platform.isLinux) {
|
||||
if (_isSimArm || (_isArm && _configuration.useQemu)) {
|
||||
cc = 'arm-linux-gnueabihf-gcc';
|
||||
|
|
|
@ -25,6 +25,8 @@ namespace dart {
|
|||
// Follow LLVM (https://reviews.llvm.org/D25079) and set maximum page size
|
||||
// to 64 KB for ARM64 Linux builds.
|
||||
static constexpr intptr_t kElfPageSize = 64 * KB;
|
||||
#elif defined(DART_TARGET_OS_ANDROID) && defined(TARGET_ARCH_IS_64_BIT)
|
||||
static constexpr intptr_t kElfPageSize = 64 * KB;
|
||||
#else
|
||||
static constexpr intptr_t kElfPageSize = 16 * KB;
|
||||
#endif
|
||||
|
|
|
@ -25,7 +25,7 @@ void FfiCallbackMetadata::EnsureStubPageLocked() {
|
|||
const Code& trampoline_code = StubCode::FfiCallbackTrampoline();
|
||||
const uword code_start = trampoline_code.EntryPoint();
|
||||
const uword code_end = code_start + trampoline_code.Size();
|
||||
const uword page_start = code_start & kPageMask;
|
||||
const uword page_start = code_start & ~(VirtualMemory::PageSize() - 1);
|
||||
|
||||
ASSERT_LESS_OR_EQUAL((code_start - page_start) + trampoline_code.Size(),
|
||||
RXMappingSize());
|
||||
|
|
|
@ -184,6 +184,8 @@ class FfiCallbackMetadata {
|
|||
// get it as close as possible to avoid wasting memory.
|
||||
#if defined(DART_TARGET_OS_LINUX) && defined(TARGET_ARCH_ARM64)
|
||||
static constexpr intptr_t kPageSize = 64 * KB;
|
||||
#elif defined(DART_TARGET_OS_ANDROID) && defined(TARGET_ARCH_IS_64_BIT)
|
||||
static constexpr intptr_t kPageSize = 64 * KB;
|
||||
#elif defined(DART_TARGET_OS_MACOS) && defined(TARGET_ARCH_ARM64)
|
||||
static constexpr intptr_t kPageSize = 16 * KB;
|
||||
#elif defined(DART_TARGET_OS_FUCHSIA)
|
||||
|
|
Loading…
Reference in a new issue