From 54990d90fcffbae79d72cfb2e37bb4cac4e0660c Mon Sep 17 00:00:00 2001 From: Jan Vorlicek Date: Wed, 14 Oct 2015 03:01:25 +0200 Subject: GC OS interface refactoring This change replaces all calls of OS specific functions in the GC by a call to a platform agnostic interface. Critical sections were abstracted too. The logging file access was changed to use CRT functions instead of Windows specific APIs. A "size" member was added to the card_table_info so that we can pass the right size to the VirtualRelease method when destroying the card table. I have also fixed a bug in the gc_heap::make_card_table error path where when VirtualCommit failed, it called VirtualRelease with size that was not the reserved size, but the committed size. Other related changes - All interlocked operations moved to Interlocked class as static methods - Removed unused function prototypes - Shuffled stuff in the root CMakeLists.txt to enable building the GC sample using the settings inherited from the root CMakeLists.txt and to clean up some things that have rotted over time, like the FEATURE_xxx macros not being in one alphabetically ordered block - Fixed the VOLATILE_MEMORY_BARRIER macro in the gcenv.base.h - Replaced uint32_t thread id by EEThreadId - Removed thread handles storage (g_gc_thread) from the GC. The thread handle is closed right after the thread is launched. That allowed me to get rid of the GCThreadHandle - Renamed the methods of the EEThreadId to be easier to understand - Moved the gcenv.windows.cpp and gcenv.unix.cpp to the sample folder --- src/vm/hash.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/vm/hash.cpp') diff --git a/src/vm/hash.cpp b/src/vm/hash.cpp index 8a0ab28652..8e8408c9a2 100644 --- a/src/vm/hash.cpp +++ b/src/vm/hash.cpp @@ -298,7 +298,7 @@ void HashMap::Init(DWORD cbInitialSize, Compare* pCompare, BOOL fAsyncMode, Lock m_pfnLockOwner = pLock->lockOwnerFunc; } if (m_pfnLockOwner == NULL) { - m_writerThreadId.SetThreadId(); + m_writerThreadId.SetToCurrentThread(); } #endif // _DEBUG } @@ -1079,7 +1079,7 @@ BOOL HashMap::OwnLock() DEBUG_ONLY_FUNCTION; if (m_pfnLockOwner == NULL) { - return m_writerThreadId.IsSameThread(); + return m_writerThreadId.IsCurrentThread(); } else { BOOL ret = m_pfnLockOwner(m_lockData); -- cgit v1.2.3