From 9499b8af9f8ee474d115adb27785316b1b09b748 Mon Sep 17 00:00:00 2001 From: Jan Kotas Date: Thu, 7 Feb 2019 10:17:45 -0800 Subject: [PATCH] Fix GCSample bit rot (dotnet/coreclr#22462) Fixes dotnet/coreclr#22459 Commit migrated from https://github.com/dotnet/coreclr/commit/46cbd93c20780bcacd9f39fe18079acf2a9f4178 --- src/coreclr/src/gc/sample/CMakeLists.txt | 2 -- src/coreclr/src/gc/sample/GCSample.cpp | 8 -------- src/coreclr/src/gc/sample/GCSample.vcxproj | 17 +++++++++++------ src/coreclr/src/gc/sample/GCSample.vcxproj.filters | 14 +++++++++++++- src/coreclr/src/gc/sample/gcenv.ee.cpp | 11 +++++++++-- src/coreclr/src/gc/sample/gcenv.h | 2 ++ 6 files changed, 35 insertions(+), 19 deletions(-) diff --git a/src/coreclr/src/gc/sample/CMakeLists.txt b/src/coreclr/src/gc/sample/CMakeLists.txt index 953d049..5a02d02 100644 --- a/src/coreclr/src/gc/sample/CMakeLists.txt +++ b/src/coreclr/src/gc/sample/CMakeLists.txt @@ -5,8 +5,6 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON) include_directories(..) include_directories(../env) -add_definitions(-DFEATURE_REDHAWK) - set(SOURCES GCSample.cpp gcenv.ee.cpp diff --git a/src/coreclr/src/gc/sample/GCSample.cpp b/src/coreclr/src/gc/sample/GCSample.cpp index 4248d92..4e22850 100644 --- a/src/coreclr/src/gc/sample/GCSample.cpp +++ b/src/coreclr/src/gc/sample/GCSample.cpp @@ -119,14 +119,6 @@ int __cdecl main(int argc, char* argv[]) return -1; } - // - // Initialize free object methodtable. The GC uses a special array-like methodtable as placeholder - // for collected free space. - // - static MethodTable freeObjectMT; - freeObjectMT.InitializeFreeObject(); - g_gc_pFreeObjectMethodTable = &freeObjectMT; - // // Initialize GC heap // diff --git a/src/coreclr/src/gc/sample/GCSample.vcxproj b/src/coreclr/src/gc/sample/GCSample.vcxproj index 105e289..de16164 100644 --- a/src/coreclr/src/gc/sample/GCSample.vcxproj +++ b/src/coreclr/src/gc/sample/GCSample.vcxproj @@ -1,5 +1,5 @@  - + Debug @@ -14,18 +14,19 @@ {58D6B7AE-0A12-49F0-BCF7-200ED8BA445A} Win32Proj GCSample + 10.0.17763.0 Application true - v140 + v141 Unicode Application false - v140 + v141 true Unicode @@ -83,13 +84,17 @@ - - - + NotUsing + + + + + + diff --git a/src/coreclr/src/gc/sample/GCSample.vcxproj.filters b/src/coreclr/src/gc/sample/GCSample.vcxproj.filters index f6aacfd0..b5647b3 100644 --- a/src/coreclr/src/gc/sample/GCSample.vcxproj.filters +++ b/src/coreclr/src/gc/sample/GCSample.vcxproj.filters @@ -59,7 +59,19 @@ Source Files - + + Source Files + + + Source Files + + + Source Files + + + Source Files + + Source Files diff --git a/src/coreclr/src/gc/sample/gcenv.ee.cpp b/src/coreclr/src/gc/sample/gcenv.ee.cpp index 20be78c..9a4e9c9 100644 --- a/src/coreclr/src/gc/sample/gcenv.ee.cpp +++ b/src/coreclr/src/gc/sample/gcenv.ee.cpp @@ -319,9 +319,16 @@ bool GCToEEInterface::WasCurrentThreadCreatedByGC() return false; } +static MethodTable freeObjectMT; + MethodTable* GCToEEInterface::GetFreeObjectMethodTable() { - return g_pFreeObjectMethodTable; + // + // Initialize free object methodtable. The GC uses a special array-like methodtable as placeholder + // for collected free space. + // + freeObjectMT.InitializeFreeObject(); + return &freeObjectMT; } bool GCToEEInterface::CreateThread(void (*threadStart)(void*), void* arg, bool is_suspendable, const char* name) @@ -349,7 +356,7 @@ void *GCToEEInterface::GetAppDomainAtIndex(uint32_t appDomainIndex) bool GCToEEInterface::AppDomainCanAccessHandleTable(uint32_t appDomainID) { - return false; + return true; } uint32_t GCToEEInterface::GetIndexOfAppDomainBeingUnloaded() diff --git a/src/coreclr/src/gc/sample/gcenv.h b/src/coreclr/src/gc/sample/gcenv.h index 4dc2da0..0da2e44 100644 --- a/src/coreclr/src/gc/sample/gcenv.h +++ b/src/coreclr/src/gc/sample/gcenv.h @@ -10,6 +10,8 @@ #undef BUILD_AS_STANDALONE #endif // BUILD_AS_STANDALONE +#define FEATURE_REDHAWK + #if defined(_DEBUG) #ifndef _DEBUG_IMPL #define _DEBUG_IMPL 1 -- 2.7.4