From 4a3ce7bcb92e58113805e8104c92315ccad82c92 Mon Sep 17 00:00:00 2001 From: Rajat Dua Date: Thu, 26 Jul 2018 12:14:36 -0700 Subject: [PATCH] Don't allocate in pre-reserved section if we had failed to reserve it on jit server init time. OS#15209418 --- lib/Backend/ServerThreadContext.cpp | 6 ++++++ lib/Backend/ServerThreadContext.h | 2 +- lib/JITServer/JITServer.cpp | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/Backend/ServerThreadContext.cpp b/lib/Backend/ServerThreadContext.cpp index 37093123181..be1827b63a8 100644 --- a/lib/Backend/ServerThreadContext.cpp +++ b/lib/Backend/ServerThreadContext.cpp @@ -169,6 +169,12 @@ ServerThreadContext::CanCreatePreReservedSegment() const return m_canCreatePreReservedSegment; } +void +ServerThreadContext::SetCanCreatePreReservedSegment(bool value) +{ + m_canCreatePreReservedSegment = value; +} + bool ServerThreadContext::IsNumericProperty(Js::PropertyId propertyId) { diff --git a/lib/Backend/ServerThreadContext.h b/lib/Backend/ServerThreadContext.h index 7aa1d258415..26e2a9de649 100644 --- a/lib/Backend/ServerThreadContext.h +++ b/lib/Backend/ServerThreadContext.h @@ -72,7 +72,7 @@ class ServerThreadContext : public ThreadContextInfo intptr_t GetRuntimeChakraBaseAddress() const; intptr_t GetRuntimeCRTBaseAddress() const; bool CanCreatePreReservedSegment() const; - + void SetCanCreatePreReservedSegment(bool value); static intptr_t GetJITCRTBaseAddress(); private: diff --git a/lib/JITServer/JITServer.cpp b/lib/JITServer/JITServer.cpp index 5712447bcef..b86fd3d5841 100644 --- a/lib/JITServer/JITServer.cpp +++ b/lib/JITServer/JITServer.cpp @@ -221,6 +221,7 @@ ServerInitializeThreadContext( if (!PHASE_OFF1(Js::PreReservedHeapAllocPhase)) { *prereservedRegionAddr = (intptr_t)contextInfo->GetPreReservedSectionAllocator()->EnsurePreReservedRegion(); + contextInfo->SetCanCreatePreReservedSegment(*prereservedRegionAddr != 0); } #if !defined(_M_ARM) *jitThunkAddr = (intptr_t)contextInfo->GetJITThunkEmitter()->EnsureInitialized();