Răsfoiți Sursa

Fix PreservedVirtualAllocWrapper and CodeGenAllocators' HeapPageAllocator clean up order.

In the ThreadContext dtor sequence, PreservedVirtualAllocWrapper::Shutdown is called explicitly, before the CodeGenAllocators' HeapPageAllocator dtor is called.  The release should be in PreReservedVirtualAllocWrapper dtor instead, which will be the right order.
Curtis Man 10 ani în urmă
părinte
comite
7d545c110e

+ 1 - 2
lib/Common/Memory/VirtualAllocWrapper.cpp

@@ -78,8 +78,7 @@ PreReservedVirtualAllocWrapper::PreReservedVirtualAllocWrapper() :
     freeSegments.SetAll();
 }
 
-void
-PreReservedVirtualAllocWrapper::Shutdown()
+PreReservedVirtualAllocWrapper::~PreReservedVirtualAllocWrapper()
 {
     Assert(this);
     if (IsPreReservedRegionPresent())

+ 1 - 1
lib/Common/Memory/VirtualAllocWrapper.h

@@ -40,7 +40,7 @@ public:
 #endif
 public:
     PreReservedVirtualAllocWrapper();
-    void        Shutdown();
+    ~PreReservedVirtualAllocWrapper();
     LPVOID      Alloc(LPVOID lpAddress, size_t dwSize, DWORD allocationType, DWORD protectFlags, bool isCustomHeapAllocation = false);
     BOOL        Free(LPVOID lpAddress, size_t dwSize, DWORD dwFreeType);
 

+ 0 - 11
lib/Runtime/Base/ThreadContext.cpp

@@ -319,13 +319,6 @@ void ThreadContext::GlobalInitialize()
     }
 }
 
-#if ENABLE_NATIVE_CODEGEN
-void ThreadContext::ReleasePreReservedSegment()
-{
-    preReservedVirtualAllocator.Shutdown();
-}
-#endif
-
 ThreadContext::~ThreadContext()
 {
     {
@@ -501,10 +494,6 @@ ThreadContext::~ThreadContext()
     }
 #endif
 #endif
-
-#if ENABLE_NATIVE_CODEGEN
-    ReleasePreReservedSegment();
-#endif
 }
 
 void

+ 0 - 4
lib/Runtime/Base/ThreadContext.h

@@ -372,10 +372,6 @@ public:
         WorkerThread(HANDLE handle = nullptr) :threadHandle(handle){};
     };
 
-#if ENABLE_NATIVE_CODEGEN
-    void ReleasePreReservedSegment();
-#endif
-
     void SetCurrentThreadId(DWORD threadId) { this->currentThreadId = threadId; }
     DWORD GetCurrentThreadId() const { return this->currentThreadId; }
     void SetIsThreadBound()