52#if defined(DART_HOST_OS_MACOS) && defined(DART_PRECOMPILED_RUNTIME)
57 const mach_port_t task = mach_task_self();
58 const vm_address_t source_address =
reinterpret_cast<vm_address_t
>(
address());
59 const vm_size_t mem_size = aligned_size;
60 const vm_prot_t read_execute = VM_PROT_READ | VM_PROT_EXECUTE;
61 vm_prot_t current_protection = read_execute;
62 vm_prot_t max_protection = read_execute;
63 vm_address_t target_address =
64 reinterpret_cast<vm_address_t
>(
target->address());
65 kern_return_t status = vm_remap(
66 task, &target_address, mem_size,
68 VM_FLAGS_FIXED | VM_FLAGS_OVERWRITE, task, source_address,
69 true, ¤t_protection, &max_protection,
71 if (status != KERN_SUCCESS) {
74 ASSERT(
reinterpret_cast<void*
>(target_address) ==
target->address());
75 ASSERT_EQUAL(current_protection & read_execute, read_execute);
76 ASSERT_EQUAL(max_protection & read_execute, read_execute);