Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit 46cbd93

Browse files
authored
Fix GCSample bit rot (#22462)
Fixes #22459
1 parent f340a5f commit 46cbd93

File tree

6 files changed

+35
-19
lines changed

6 files changed

+35
-19
lines changed

src/gc/sample/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
55
include_directories(..)
66
include_directories(../env)
77

8-
add_definitions(-DFEATURE_REDHAWK)
9-
108
set(SOURCES
119
GCSample.cpp
1210
gcenv.ee.cpp

src/gc/sample/GCSample.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -119,14 +119,6 @@ int __cdecl main(int argc, char* argv[])
119119
return -1;
120120
}
121121

122-
//
123-
// Initialize free object methodtable. The GC uses a special array-like methodtable as placeholder
124-
// for collected free space.
125-
//
126-
static MethodTable freeObjectMT;
127-
freeObjectMT.InitializeFreeObject();
128-
g_gc_pFreeObjectMethodTable = &freeObjectMT;
129-
130122
//
131123
// Initialize GC heap
132124
//

src/gc/sample/GCSample.vcxproj

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2+
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<ItemGroup Label="ProjectConfigurations">
44
<ProjectConfiguration Include="Debug|Win32">
55
<Configuration>Debug</Configuration>
@@ -14,18 +14,19 @@
1414
<ProjectGuid>{58D6B7AE-0A12-49F0-BCF7-200ED8BA445A}</ProjectGuid>
1515
<Keyword>Win32Proj</Keyword>
1616
<RootNamespace>GCSample</RootNamespace>
17+
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
1718
</PropertyGroup>
1819
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
1920
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
2021
<ConfigurationType>Application</ConfigurationType>
2122
<UseDebugLibraries>true</UseDebugLibraries>
22-
<PlatformToolset>v140</PlatformToolset>
23+
<PlatformToolset>v141</PlatformToolset>
2324
<CharacterSet>Unicode</CharacterSet>
2425
</PropertyGroup>
2526
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
2627
<ConfigurationType>Application</ConfigurationType>
2728
<UseDebugLibraries>false</UseDebugLibraries>
28-
<PlatformToolset>v140</PlatformToolset>
29+
<PlatformToolset>v141</PlatformToolset>
2930
<WholeProgramOptimization>true</WholeProgramOptimization>
3031
<CharacterSet>Unicode</CharacterSet>
3132
</PropertyGroup>
@@ -83,13 +84,17 @@
8384
<ClInclude Include="gcenv.h" />
8485
</ItemGroup>
8586
<ItemGroup>
86-
<ClCompile Include="gcenv.ee.cpp" />
8787
<ClCompile Include="GCSample.cpp" />
88-
<ClCompile Include="..\gccommon.cpp" />
89-
<ClCompile Include="..\gceewks.cpp" />
88+
<ClCompile Include="gcenv.ee.cpp" />
9089
<ClCompile Include="..\windows\gcenv.windows.cpp">
9190
<PrecompiledHeader>NotUsing</PrecompiledHeader>
9291
</ClCompile>
92+
<ClCompile Include="..\gcconfig.cpp" />
93+
<ClCompile Include="..\gceventstatus.cpp" />
94+
<ClCompile Include="..\gchandletable.cpp" />
95+
<ClCompile Include="..\gcload.cpp" />
96+
<ClCompile Include="..\gccommon.cpp" />
97+
<ClCompile Include="..\gceewks.cpp" />
9398
<ClCompile Include="..\gcscan.cpp" />
9499
<ClCompile Include="..\gcwks.cpp" />
95100
<ClCompile Include="..\handletable.cpp" />

src/gc/sample/GCSample.vcxproj.filters

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,19 @@
5959
<ClCompile Include="gcenv.ee.cpp">
6060
<Filter>Source Files</Filter>
6161
</ClCompile>
62-
<ClCompile Include="..\gcenv.windows.cpp">
62+
<ClCompile Include="..\windows\gcenv.windows.cpp">
63+
<Filter>Source Files</Filter>
64+
</ClCompile>
65+
<ClCompile Include="..\gchandletable.cpp">
66+
<Filter>Source Files</Filter>
67+
</ClCompile>
68+
<ClCompile Include="..\gcconfig.cpp">
69+
<Filter>Source Files</Filter>
70+
</ClCompile>
71+
<ClCompile Include="..\gcload.cpp">
72+
<Filter>Source Files</Filter>
73+
</ClCompile>
74+
<ClCompile Include="..\gceventstatus.cpp">
6375
<Filter>Source Files</Filter>
6476
</ClCompile>
6577
</ItemGroup>

src/gc/sample/gcenv.ee.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,9 +319,16 @@ bool GCToEEInterface::WasCurrentThreadCreatedByGC()
319319
return false;
320320
}
321321

322+
static MethodTable freeObjectMT;
323+
322324
MethodTable* GCToEEInterface::GetFreeObjectMethodTable()
323325
{
324-
return g_pFreeObjectMethodTable;
326+
//
327+
// Initialize free object methodtable. The GC uses a special array-like methodtable as placeholder
328+
// for collected free space.
329+
//
330+
freeObjectMT.InitializeFreeObject();
331+
return &freeObjectMT;
325332
}
326333

327334
bool GCToEEInterface::CreateThread(void (*threadStart)(void*), void* arg, bool is_suspendable, const char* name)
@@ -349,7 +356,7 @@ void *GCToEEInterface::GetAppDomainAtIndex(uint32_t appDomainIndex)
349356

350357
bool GCToEEInterface::AppDomainCanAccessHandleTable(uint32_t appDomainID)
351358
{
352-
return false;
359+
return true;
353360
}
354361

355362
uint32_t GCToEEInterface::GetIndexOfAppDomainBeingUnloaded()

src/gc/sample/gcenv.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
#undef BUILD_AS_STANDALONE
1111
#endif // BUILD_AS_STANDALONE
1212

13+
#define FEATURE_REDHAWK
14+
1315
#if defined(_DEBUG)
1416
#ifndef _DEBUG_IMPL
1517
#define _DEBUG_IMPL 1

0 commit comments

Comments
 (0)