14 for (
char* current =
begin; current <
end; ++current) {
23 const intptr_t kVirtualMemoryBlockSize = 64 *
KB;
29 EXPECT_EQ(kVirtualMemoryBlockSize, vm->
size());
30 EXPECT_EQ(vm->
start() + kVirtualMemoryBlockSize, vm->
end());
41 char* buf =
reinterpret_cast<char*
>(vm->
address());
49 EXPECT_STREQ(
"ac/dc", buf);
56 intptr_t kVirtualPageSize = 4096;
58 intptr_t kIterations = kHeapPageSize / kVirtualPageSize;
59 for (intptr_t
i = 0;
i < kIterations;
i++) {
61 kHeapPageSize, kHeapPageSize,
false,
false,
"test");
63 EXPECT_EQ(kHeapPageSize, vm->
size());
70 const intptr_t kVirtualMemoryBlockSize = 10 *
MB;
71 const intptr_t kIterations = 900;
72 for (intptr_t
i = 0;
i < kIterations; ++
i) {
78 for (intptr_t
i = 0;
i < kIterations; ++
i) {
81 vm->
Truncate(kVirtualMemoryBlockSize / 2);
84 for (intptr_t
i = 0;
i < kIterations; ++
i) {
92#if !defined(DART_TARGET_OS_FUCHSIA)
109 reinterpret_cast<void*
>(page_start), 2 * page_size);
110 EXPECT_NE(
nullptr, vm);
112#if defined(DART_HOST_OS_MACOS) && !defined(DART_PRECOMPILED_RUNTIME)
117 const bool is_executable =
true;
119 const bool is_executable =
false;
124 false,
"FfiCallbackMetadata::TrampolinePage");
128 auto testFunction2 =
reinterpret_cast<int (*)(
int)
>(vm2->
start() +
offset);
131 EXPECT_EQ(246, testFunction2(123));
static bool ok(int result)
static constexpr T RoundDown(T x, intptr_t alignment)
static constexpr bool IsAligned(T x, uintptr_t alignment, uintptr_t offset=0)
static VirtualMemory * AllocateAligned(intptr_t size, intptr_t alignment, bool is_executable, bool is_compressed, const char *name)
bool Contains(uword addr) const
static intptr_t PageSize()
bool DuplicateRX(VirtualMemory *target)
void Truncate(intptr_t new_size)
static VirtualMemory * Allocate(intptr_t size, bool is_executable, bool is_compressed, const char *name)
static VirtualMemory * ForImagePage(void *pointer, uword size)
static const char * begin(const StringSlice &s)
static int testFunction(int x)
static constexpr intptr_t kPageSize
bool IsZero(char *begin, char *end)
NO_SANITIZE_UNDEFINED("function") VM_UNIT_TEST_CASE(DuplicateRXVirtualMemory)
VM_UNIT_TEST_CASE(DirectoryCurrentNoScope)