Remove the JIT entitlement from gen_snapshot, take 2.

Push this down to VirtualMemory since some parts of the VM go there directly instead of through Page.

TEST=ci
Change-Id: Icc65242e9099e8785a38ba9e38311146d8b5845b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/510260
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
This commit is contained in:
Ryan Macnak
2026-06-10 12:56:03 -07:00
committed by dart-scoped@luci-project-accounts.iam.gserviceaccount.com
parent 9057e23671
commit 49546393c6
7 changed files with 31 additions and 17 deletions
@@ -2,7 +2,5 @@
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.cs.allow-jit</key>
<true/>
</dict>
</plist>
@@ -2,7 +2,5 @@
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.cs.allow-jit</key>
<true/>
</dict>
</plist>
+2 -12
View File
@@ -69,12 +69,7 @@ static intptr_t CacheIndex(uword flags) {
}
Page* Page::Allocate(intptr_t size, uword flags) {
#if defined(DART_INCLUDE_SIMULATOR)
const bool using_simulator = FLAG_use_simulator;
#else
const bool using_simulator = false;
#endif
const bool executable = (flags & Page::kExecutable) != 0 && !using_simulator;
const bool executable = (flags & Page::kExecutable) != 0;
const bool compressed = !executable;
const char* name = executable ? "dart-code" : "dart-heap";
@@ -316,12 +311,7 @@ void Page::ResetProgressBar() {
void Page::WriteProtect(bool read_only) {
ASSERT(!is_image());
#if defined(DART_INCLUDE_SIMULATOR)
const bool using_simulator = FLAG_use_simulator;
#else
const bool using_simulator = false;
#endif
if (is_executable() && read_only && !using_simulator) {
if (is_executable() && read_only) {
// Handle making code executable in a special way.
memory_->WriteProtectCode();
} else {
+11 -1
View File
@@ -76,10 +76,20 @@ class VirtualMemory {
#endif
}
DART_FORCE_INLINE static bool ExecutesGeneratedCode() {
#if defined(DART_PRECOMPILER) && !defined(TESTING)
return false; // I.e., gen_snapshot.
#else
return true;
#endif
}
// Write protect a chunk of machine code which is currently writable.
DART_FORCE_INLINE static void WriteProtectCode(void* address, intptr_t size) {
Protect(address, size,
ShouldDualMapExecutablePages() ? kReadOnly : kReadExecute);
ShouldDualMapExecutablePages() || !ExecutesGeneratedCode()
? kReadOnly
: kReadExecute);
}
DART_FORCE_INLINE void WriteProtectCode() const {
WriteProtectCode(address(), size());
+6
View File
@@ -151,6 +151,12 @@ VirtualMemory* VirtualMemory::AllocateAligned(intptr_t size,
ASSERT(Utils::IsPowerOfTwo(alignment));
ASSERT(Utils::IsAligned(alignment, page_size_));
// Ignore executable for gen_snapshot/simulator, but still let the heap
// track code and data pages separately.
if (!VirtualMemory::ExecutesGeneratedCode()) {
is_executable = false;
}
const zx_vm_option_t align_flag = Utils::ShiftForPowerOfTwo(alignment)
<< ZX_VM_ALIGN_BASE;
ASSERT((ZX_VM_ALIGN_1KB <= align_flag) && (align_flag <= ZX_VM_ALIGN_4GB));
+6
View File
@@ -621,6 +621,12 @@ VirtualMemory* VirtualMemory::AllocateAligned(intptr_t size,
ASSERT(Utils::IsAligned(alignment, PageSize()));
ASSERT(name != nullptr);
// Ignore executable for gen_snapshot/simulator, but still let the heap
// track code and data pages separately.
if (!VirtualMemory::ExecutesGeneratedCode()) {
is_executable = false;
}
#if defined(DART_COMPRESSED_POINTERS)
if (is_compressed) {
RELEASE_ASSERT(!is_executable);
+6
View File
@@ -139,6 +139,12 @@ VirtualMemory* VirtualMemory::AllocateAligned(intptr_t size,
ASSERT(Utils::IsPowerOfTwo(alignment));
ASSERT(Utils::IsAligned(alignment, PageSize()));
// Ignore executable for gen_snapshot/simulator, but still let the heap
// track code and data pages separately.
if (!VirtualMemory::ExecutesGeneratedCode()) {
is_executable = false;
}
#if defined(DART_COMPRESSED_POINTERS)
if (is_compressed) {
RELEASE_ASSERT(!is_executable);