Fix GCSample bit rot (dotnet/coreclr#22462)
authorJan Kotas <jkotas@microsoft.com>
Thu, 7 Feb 2019 18:17:45 +0000 (10:17 -0800)
committerGitHub <noreply@github.com>
Thu, 7 Feb 2019 18:17:45 +0000 (10:17 -0800)
Fixes dotnet/coreclr#22459

Commit migrated from https://github.com/dotnet/coreclr/commit/46cbd93c20780bcacd9f39fe18079acf2a9f4178

src/coreclr/src/gc/sample/CMakeLists.txt
src/coreclr/src/gc/sample/GCSample.cpp
src/coreclr/src/gc/sample/GCSample.vcxproj
src/coreclr/src/gc/sample/GCSample.vcxproj.filters
src/coreclr/src/gc/sample/gcenv.ee.cpp
src/coreclr/src/gc/sample/gcenv.h

index 953d049..5a02d02 100644 (file)
@@ -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
index 4248d92..4e22850 100644 (file)
@@ -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
     //
index 105e289..de16164 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <ItemGroup Label="ProjectConfigurations">
     <ProjectConfiguration Include="Debug|Win32">
       <Configuration>Debug</Configuration>
     <ProjectGuid>{58D6B7AE-0A12-49F0-BCF7-200ED8BA445A}</ProjectGuid>
     <Keyword>Win32Proj</Keyword>
     <RootNamespace>GCSample</RootNamespace>
+    <WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
   </PropertyGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
     <UseDebugLibraries>true</UseDebugLibraries>
-    <PlatformToolset>v140</PlatformToolset>
+    <PlatformToolset>v141</PlatformToolset>
     <CharacterSet>Unicode</CharacterSet>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
     <UseDebugLibraries>false</UseDebugLibraries>
-    <PlatformToolset>v140</PlatformToolset>
+    <PlatformToolset>v141</PlatformToolset>
     <WholeProgramOptimization>true</WholeProgramOptimization>
     <CharacterSet>Unicode</CharacterSet>
   </PropertyGroup>
     <ClInclude Include="gcenv.h" />
   </ItemGroup>
   <ItemGroup>
-    <ClCompile Include="gcenv.ee.cpp" />
     <ClCompile Include="GCSample.cpp" />
-    <ClCompile Include="..\gccommon.cpp" />
-    <ClCompile Include="..\gceewks.cpp" />
+    <ClCompile Include="gcenv.ee.cpp" />
     <ClCompile Include="..\windows\gcenv.windows.cpp">
       <PrecompiledHeader>NotUsing</PrecompiledHeader>
     </ClCompile>
+    <ClCompile Include="..\gcconfig.cpp" />
+    <ClCompile Include="..\gceventstatus.cpp" />
+    <ClCompile Include="..\gchandletable.cpp" />
+    <ClCompile Include="..\gcload.cpp" />
+    <ClCompile Include="..\gccommon.cpp" />
+    <ClCompile Include="..\gceewks.cpp" />
     <ClCompile Include="..\gcscan.cpp" />
     <ClCompile Include="..\gcwks.cpp" />
     <ClCompile Include="..\handletable.cpp" />
index f6aacfd..b5647b3 100644 (file)
     <ClCompile Include="gcenv.ee.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\gcenv.windows.cpp">
+    <ClCompile Include="..\windows\gcenv.windows.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\gchandletable.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\gcconfig.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\gcload.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\gceventstatus.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
   </ItemGroup>
index 20be78c..9a4e9c9 100644 (file)
@@ -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()
index 4dc2da0..0da2e44 100644 (file)
@@ -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