Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
90 commits
Select commit Hold shift + click to select a range
09a7e0a
init
max-charlamb Jul 25, 2025
4da67a4
Merge remote-tracking branch 'origin/main' into cdac-multi-contract
max-charlamb Jul 25, 2025
8fe911d
wip 2 adding gc contract descriptor
max-charlamb Jul 25, 2025
4363c0f
add datadescriptor function
max-charlamb Jul 25, 2025
d308a7f
Merge remote-tracking branch 'origin/main' into cdac-multi-contract
max-charlamb Jul 28, 2025
9365a4b
fix merge issue
max-charlamb Jul 28, 2025
47c23f3
rename configure file
max-charlamb Jul 28, 2025
1a9c57a
update
max-charlamb Jul 28, 2025
780cda3
wip
max-charlamb Jul 28, 2025
9ad4256
verify in-proc gc contract
max-charlamb Jul 28, 2025
452db7d
fix typo
max-charlamb Jul 30, 2025
7d67771
rename ContractDescriptor type
max-charlamb Jul 30, 2025
0477d96
use gcDacVars to initialize descriptor pointer
max-charlamb Jul 31, 2025
462c06c
initial work on managed side
max-charlamb Jul 31, 2025
c1ba596
gc_descriptors -> gc_descriptor
max-charlamb Jul 31, 2025
a6e4366
add option to export contract
max-charlamb Aug 1, 2025
29c3f73
support having zero of a type of descriptor
max-charlamb Aug 1, 2025
58422b8
fix bug in ContractDescriptorTarget change
max-charlamb Aug 1, 2025
de5ef0d
try modify contract machinery to support subdescriptors
max-charlamb Aug 1, 2025
192a5b1
update to use interface target
max-charlamb Aug 5, 2025
5ceeacf
fix linking in datadescriptors
max-charlamb Aug 5, 2025
c74a18a
working version
max-charlamb Aug 5, 2025
c5f8064
working
max-charlamb Aug 5, 2025
632dead
remove test var
max-charlamb Aug 5, 2025
ec7539f
fix building datadescriptor
max-charlamb Aug 5, 2025
18a22eb
implement GetGCHeapData
max-charlamb Aug 5, 2025
3f6690c
fix infra
max-charlamb Aug 5, 2025
41550b8
remove debug tool
max-charlamb Aug 5, 2025
d77c3fb
renames
max-charlamb Aug 5, 2025
d63be19
fix
max-charlamb Aug 5, 2025
d9820c5
rename
max-charlamb Aug 5, 2025
f29e7a7
Merge remote-tracking branch 'origin/main' into cdac-multi-contract
max-charlamb Aug 5, 2025
39c531c
add docs
max-charlamb Aug 5, 2025
9b77c90
fix merge issue
max-charlamb Aug 6, 2025
50f2431
refactor
max-charlamb Aug 6, 2025
0216767
change name
max-charlamb Aug 6, 2025
e00088c
remove docs
max-charlamb Aug 6, 2025
823379a
clean-up
max-charlamb Aug 6, 2025
5f77536
clean up
max-charlamb Aug 6, 2025
bec16e6
trim docs
max-charlamb Aug 6, 2025
61698e1
fix
max-charlamb Aug 6, 2025
9728139
doc
max-charlamb Aug 6, 2025
ea63649
address comment
max-charlamb Aug 6, 2025
cad5e9e
fix targettests
max-charlamb Aug 6, 2025
4698361
rename DLLEXPORT -> EXPORT_VISIBLE
max-charlamb Aug 6, 2025
378a71f
fix license
max-charlamb Aug 6, 2025
8f13833
add comment
max-charlamb Aug 6, 2025
8a6a118
rename add_interface_library -> _add_interface_library_before
max-charlamb Aug 6, 2025
e61c682
remove sub_descriptor reference from PR
max-charlamb Aug 6, 2025
0770a04
improve comment
max-charlamb Aug 6, 2025
291fe19
move datadescriptors from src/debug -> src/vm
max-charlamb Aug 6, 2025
0461bb3
undo change
max-charlamb Aug 6, 2025
9182cab
nit spacing
max-charlamb Aug 6, 2025
948efd7
update doc
max-charlamb Aug 6, 2025
0bd833f
add GetGCHeapList and cdac_data<> in GC
max-charlamb Aug 6, 2025
4ca29e4
Merge remote-tracking branch 'fork/datadescriptor-refactor' into cdac…
max-charlamb Aug 6, 2025
f9fa94e
update to fix merge issues
max-charlamb Aug 6, 2025
51860e0
Merge remote-tracking branch 'origin/main' into cdac-multi-contract
max-charlamb Aug 7, 2025
3e9256d
reduce diff
max-charlamb Aug 7, 2025
9a9d6c7
fix build issue
max-charlamb Aug 7, 2025
8a71e6e
reduce diff
max-charlamb Aug 7, 2025
18d23ab
fix gc usage of cdac_data<>
max-charlamb Aug 7, 2025
8a936e5
try fix scoping issue again
max-charlamb Aug 7, 2025
aaca402
fix
max-charlamb Aug 7, 2025
a85bc13
remove dead code
max-charlamb Aug 7, 2025
08240da
change to use single string global for identifiers
max-charlamb Aug 7, 2025
2187ecf
move gcdatadescriptors behind a #ifdef
max-charlamb Aug 8, 2025
6fe2642
undo commenting out
max-charlamb Aug 8, 2025
8a28a69
fix clang preprocessor issue
max-charlamb Aug 8, 2025
7ca6ab2
remove accidental file
max-charlamb Aug 11, 2025
c52465a
Merge remote-tracking branch 'origin/main' into cdac-multi-contract
max-charlamb Aug 11, 2025
2814588
remove use of /Zc:externConstexpr which caused problems with existing…
max-charlamb Aug 11, 2025
3e3f2ec
fix msvc compiler constexpr
max-charlamb Aug 11, 2025
532c3cf
handle Volatile<T> in datadescriptors
max-charlamb Aug 11, 2025
7833955
be more careful about when to include descriptors
max-charlamb Aug 11, 2025
766a7de
fix clang errors
max-charlamb Aug 11, 2025
97eb6a5
Merge branch 'main' into cdac-multi-contract
max-charlamb Aug 12, 2025
31fb39d
fix volatile address of
max-charlamb Aug 12, 2025
0629832
try fix pointer data
max-charlamb Aug 12, 2025
d42f8c7
fix pointer data
max-charlamb Aug 13, 2025
edcdb6b
spacing nits
max-charlamb Aug 13, 2025
af2dc29
Merge branch 'main' into cdac-multi-contract
max-charlamb Aug 19, 2025
9240dd6
mark volatile addressof as constexpr
max-charlamb Aug 19, 2025
bd2566a
clean up whitespace
max-charlamb Aug 19, 2025
74c521f
whitespace
max-charlamb Aug 19, 2025
4fdcde7
Merge remote-tracking branch 'origin/main' into cdac-multi-contract
max-charlamb Aug 19, 2025
d6b1757
add inline
max-charlamb Aug 20, 2025
8a75183
Merge remote-tracking branch 'origin/main' into cdac-multi-contract
max-charlamb Aug 20, 2025
b7ab8ea
Merge branch 'main' into cdac-multi-contract
max-charlamb Aug 25, 2025
d8d7ea6
Merge branch 'main' into cdac-multi-contract
max-charlamb Aug 25, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 83 additions & 0 deletions docs/design/datacontracts/GC.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# Contract GC

This contract is for getting information about the garbage collector configuration and state.

## APIs of contract


```csharp
// Return an array of strings identifying the GC type.
// Current return values can include:
// "workstation" or "server"
// "segments" or "regions"
string[] GetGCIdentifiers();
// Return the number of GC heaps
uint GetGCHeapCount();
// Return true if the GC structure is valid, otherwise return false
bool GetGCStructuresValid();
// Return the maximum generation of the current GC
uint GetMaxGeneration();
```

## Version 1

Data descriptors used:
| Data Descriptor Name | Field | Meaning |
| --- | --- | --- |
| _(none)_ | | |

Global variables used:
| Global Name | Type | Purpose |
| --- | --- | --- |
| `GCIdentifiers` | string | CSV string containing identifiers of the GC. Current values are "server", "workstation", "regions", and "segments" |
| `NumHeaps` | TargetPointer | Pointer to the number of heaps for server GC (int) |
| `StructureInvalidCount` | TargetPointer | Pointer to the count of invalid GC structures (int) |
| `MaxGeneration` | TargetPointer | Pointer to the maximum generation number (uint) |

Contracts used:
| Contract Name |
| --- |
| _(none)_ |


Constants used:
| Name | Type | Purpose | Value |
| --- | --- | --- | --- |
| `WRK_HEAP_COUNT` | uint | The number of heaps in the `workstation` GC type | `1` |

```csharp
GCHeapType GetGCIdentifiers()
{
string gcIdentifiers = _target.ReadGlobalString("GCIdentifiers");
return gcIdentifiers.Split(", ");
}

uint GetGCHeapCount()
{
string[] gcIdentifiers = GetGCIdentifiers()
if (gcType.Contains("workstation"))
{
return WRK_HEAP_COUNT;
}
if (gcType.Contains("server"))
{
TargetPointer pNumHeaps = target.ReadGlobalPointer("NumHeaps");
return (uint)target.Read<int>(pNumHeaps);
}

throw new NotImplementedException("Unknown GC heap type");
}

bool GetGCStructuresValid()
{
TargetPointer pInvalidCount = target.ReadGlobalPointer("StructureInvalidCount");
int invalidCount = target.Read<int>(pInvalidCount);
return invalidCount == 0; // Structures are valid if the count of invalid structures is zero
}

uint GetMaxGeneration()
{
TargetPointer pMaxGeneration = target.ReadGlobalPointer("MaxGeneration");
return target.Read<uint>(pMaxGeneration);
}
```
1 change: 1 addition & 0 deletions src/coreclr/clrdefinitions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ if (FEATURE_ENABLE_NO_ADDRESS_SPACE_RANDOMIZATION)
add_definitions(-DFEATURE_ENABLE_NO_ADDRESS_SPACE_RANDOMIZATION)
endif(FEATURE_ENABLE_NO_ADDRESS_SPACE_RANDOMIZATION)
if (NOT CLR_CMAKE_HOST_ANDROID)
set(FEATURE_SVR_GC 1)
add_definitions(-DFEATURE_SVR_GC)
endif(NOT CLR_CMAKE_HOST_ANDROID)
add_definitions(-DFEATURE_SYMDIFF)
Expand Down
6 changes: 6 additions & 0 deletions src/coreclr/debug/datadescriptor-shared/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@ The build system uses a two-phase approach:
- Defines a global string value
- `stringValue` must be a compile-time string literal

**`CDAC_GLOBAL_SUB_DESCRIPTOR(globalName, address)`**
- Defines a reference to another contract descriptor
- `address` must be a compile-time constant pointer to a pointer to a contract descriptor
- Used for multi-contract scenarios where one contract references another
- Example: `CDAC_GLOBAL_SUB_DESCRIPTOR(GC, &(g_gc_dac_vars.gc_descriptor))`


## Current Implementation

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,3 @@ extern "C"
#include "wrappeddatadescriptor.inc"
};
};

45 changes: 39 additions & 6 deletions src/coreclr/debug/datadescriptor-shared/datadescriptor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@

#include "datadescriptor.h"

#ifndef DLLEXPORT
#ifdef _MSC_VER
#define DLLEXPORT __declspec(dllexport)
#else
#define DLLEXPORT __attribute__ ((visibility ("default")))
#endif // _MSC_VER
#endif // DLLEXPORT

// begin blob definition

extern "C"
Expand Down Expand Up @@ -52,7 +60,8 @@ struct GlobalStringSpec
#define MAKE_GLOBALVALUELEN_NAME(globalname) CONCAT(cdac_string_pool_globalvalue__, globalname)

// used to stringify the result of a macros expansion
#define STRINGIFY(x) #x
// __VA_ARGS__ is the argument list comma separated
#define STRINGIFY(...) #__VA_ARGS__

// define a struct where the size of each field is the length of some string. we will use offsetof to get
// the offset of each struct element, which will be equal to the offset of the beginning of that string in the
Expand All @@ -68,6 +77,7 @@ struct CDacStringPoolSizes
#define CDAC_GLOBAL_STRING(name, stringval) DECL_LEN(MAKE_GLOBALLEN_NAME(name), sizeof(#name)) \
DECL_LEN(MAKE_GLOBALVALUELEN_NAME(name), sizeof(STRINGIFY(stringval)))
#define CDAC_GLOBAL_POINTER(name,value) DECL_LEN(MAKE_GLOBALLEN_NAME(name), sizeof(#name))
#define CDAC_GLOBAL_SUB_DESCRIPTOR(name,value) DECL_LEN(MAKE_GLOBALLEN_NAME(name), sizeof(#name))
#define CDAC_GLOBAL(name,tyname,value) DECL_LEN(MAKE_GLOBALLEN_NAME(name), sizeof(#name)) \
DECL_LEN(MAKE_GLOBALTYPELEN_NAME(name), sizeof(#tyname))
#include "wrappeddatadescriptor.inc"
Expand Down Expand Up @@ -129,6 +139,15 @@ enum
#include "wrappeddatadescriptor.inc"
};

// count the global sub-descriptors
enum
{
CDacBlobGlobalSubDescriptorsCount =
#define CDAC_GLOBALS_BEGIN() 0
#define CDAC_GLOBAL_SUB_DESCRIPTOR(name,value) + 1
#include "wrappeddatadescriptor.inc"
};


#define MAKE_TYPEFIELDS_TYNAME(tyname) CONCAT(CDacFieldsPoolTypeStart__, tyname)

Expand Down Expand Up @@ -178,6 +197,7 @@ struct CDacGlobalPointerIndex
#define DECL_LEN(membername) char membername;
#define CDAC_GLOBALS_BEGIN() DECL_LEN(cdac_global_pointer_index_start_placeholder__)
#define CDAC_GLOBAL_POINTER(name,value) DECL_LEN(CONCAT(cdac_global_pointer_index__, name))
#define CDAC_GLOBAL_SUB_DESCRIPTOR(name,value) DECL_LEN(CONCAT(cdac_global_pointer_index__, name))
#include "wrappeddatadescriptor.inc"
#undef DECL_LEN
};
Expand All @@ -204,6 +224,8 @@ struct BinaryBlobDataDescriptor

uint32_t GlobalPointersStart;
uint32_t GlobalStringValuesStart;

uint32_t GlobalSubDescriptorsStart;
uint32_t NamesPoolStart;

uint32_t TypeCount;
Expand All @@ -212,6 +234,7 @@ struct BinaryBlobDataDescriptor
uint32_t GlobalLiteralValuesCount;
uint32_t GlobalPointerValuesCount;
uint32_t GlobalStringValuesCount;
uint32_t GlobalSubDescriptorsCount;

uint32_t NamesPoolCount;

Expand All @@ -223,11 +246,13 @@ struct BinaryBlobDataDescriptor
} Directory;
uint32_t PlatformFlags;
uint32_t BaselineName;
struct TypeSpec Types[CDacBlobTypesCount];
struct FieldSpec FieldsPool[CDacBlobFieldsPoolCount];
struct GlobalLiteralSpec GlobalLiteralValues[CDacBlobGlobalLiteralsCount];
struct GlobalPointerSpec GlobalPointerValues[CDacBlobGlobalPointersCount];
struct GlobalStringSpec GlobalStringValues[CDacBlobGlobalStringsCount];
// cpp does not allow zero-length arrays, so we add one extra element to allow having zero of a given type of descriptor
struct TypeSpec Types[CDacBlobTypesCount + 1];
struct FieldSpec FieldsPool[CDacBlobFieldsPoolCount + 1];
struct GlobalLiteralSpec GlobalLiteralValues[CDacBlobGlobalLiteralsCount + 1];
struct GlobalPointerSpec GlobalPointerValues[CDacBlobGlobalPointersCount + 1];
struct GlobalStringSpec GlobalStringValues[CDacBlobGlobalStringsCount + 1];
struct GlobalPointerSpec GlobalSubDescriptorValues[CDacBlobGlobalSubDescriptorsCount + 1];
uint8_t NamesPool[sizeof(struct CDacStringPoolSizes)];
uint8_t EndMagic[4];
};
Expand All @@ -253,12 +278,14 @@ struct MagicAndBlob BlobDataDescriptor = {
/* .GlobalLiteralValuesStart = */ offsetof(struct BinaryBlobDataDescriptor, GlobalLiteralValues),
/* .GlobalPointersStart = */ offsetof(struct BinaryBlobDataDescriptor, GlobalPointerValues),
/* .GlobalStringValuesStart = */ offsetof(struct BinaryBlobDataDescriptor, GlobalStringValues),
/* .GlobalSubDescriptorsStart = */ offsetof(struct BinaryBlobDataDescriptor, GlobalSubDescriptorValues),
/* .NamesPoolStart = */ offsetof(struct BinaryBlobDataDescriptor, NamesPool),
/* .TypeCount = */ CDacBlobTypesCount,
/* .FieldsPoolCount = */ CDacBlobFieldsPoolCount,
/* .GlobalLiteralValuesCount = */ CDacBlobGlobalLiteralsCount,
/* .GlobalPointerValuesCount = */ CDacBlobGlobalPointersCount,
/* .GlobalStringValuesCount = */ CDacBlobGlobalStringsCount,
/* .GlobalSubDescriptorsCount = */ CDacBlobGlobalSubDescriptorsCount,
/* .NamesPoolCount = */ sizeof(struct CDacStringPoolSizes),
/* .TypeSpecSize = */ sizeof(struct TypeSpec),
/* .FieldSpecSize = */ sizeof(struct FieldSpec),
Expand Down Expand Up @@ -305,12 +332,18 @@ struct MagicAndBlob BlobDataDescriptor = {
#include "wrappeddatadescriptor.inc"
},

/* .GlobalSubDescriptorValues = */ {
#define CDAC_GLOBAL_SUB_DESCRIPTOR(name,value) { /* .Name = */ GET_GLOBAL_NAME(name), /* .PointerDataIndex = */ GET_GLOBAL_POINTER_INDEX(name) },
#include "wrappeddatadescriptor.inc"
},

/* .NamesPool = */ ("\0" // starts with a nul
#define CDAC_BASELINE(name) name "\0"
#define CDAC_TYPE_BEGIN(name) #name "\0"
#define CDAC_TYPE_FIELD(tyname,membertyname,membername,offset) #membername "\0" #membertyname "\0"
#define CDAC_GLOBAL_STRING(name,value) #name "\0" STRINGIFY(value) "\0"
#define CDAC_GLOBAL_POINTER(name,value) #name "\0"
#define CDAC_GLOBAL_SUB_DESCRIPTOR(name,value) #name "\0"
#define CDAC_GLOBAL(name,tyname,value) #name "\0" #tyname "\0"
#include "wrappeddatadescriptor.inc"
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@
#ifndef CDAC_GLOBAL_STRING
#define CDAC_GLOBAL_STRING(globalname,stringval)
#endif
#ifndef CDAC_GLOBAL_SUB_DESCRIPTOR
#define CDAC_GLOBAL_SUB_DESCRIPTOR(globalname,addr)
#endif
#ifndef CDAC_GLOBALS_END
#define CDAC_GLOBALS_END()
#endif
Expand All @@ -58,4 +61,5 @@
#undef CDAC_GLOBAL
#undef CDAC_GLOBAL_POINTER
#undef CDAC_GLOBAL_STRING
#undef CDAC_GLOBAL_SUB_DESCRIPTOR
#undef CDAC_GLOBALS_END
9 changes: 9 additions & 0 deletions src/coreclr/dlls/mscoree/coreclr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ if (NOT CLR_CMAKE_HOST_ARCH_WASM)
set(LIB_CORDBEE cordbee_wks)
set(LIB_INTEROP interop)
set(LIB_CDAC_CONTRACT_DESCRIPTOR cdac_contract_descriptor)
set(LIB_CDAC_GC_WKS_DESCRIPTOR gc_wks_descriptor)
set(LIB_CDAC_GC_SVR_DESCRIPTOR gc_svr_descriptor)
endif(NOT CLR_CMAKE_HOST_ARCH_WASM)

if (CLR_CMAKE_HOST_UNIX AND NOT CLR_CMAKE_TARGET_ARCH_WASM)
Expand Down Expand Up @@ -104,8 +106,15 @@ set(CORECLR_LIBRARIES
coreclrminipal
gc_pal
${LIB_CDAC_CONTRACT_DESCRIPTOR}
${LIB_CDAC_GC_WKS_DESCRIPTOR}
)

if (FEATURE_SVR_GC)
list(APPEND CORECLR_LIBRARIES
${LIB_CDAC_GC_SVR_DESCRIPTOR}
)
endif(FEATURE_SVR_GC)

if(CLR_CMAKE_TARGET_ARCH_AMD64)
list(APPEND CORECLR_LIBRARIES
gc_vxsort
Expand Down
20 changes: 18 additions & 2 deletions src/coreclr/gc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ endif (CLR_CMAKE_TARGET_ARCH_AMD64)

if (CLR_CMAKE_TARGET_WIN32)
set(GC_HEADERS
env/cdacdata.h
env/common.h
env/etmdummy.h
env/gcenv.base.h
Expand Down Expand Up @@ -104,19 +105,31 @@ list(APPEND GC_SOURCES ${GC_HEADERS})
convert_to_absolute_path(GC_SOURCES ${GC_SOURCES})

if(FEATURE_STANDALONE_GC)
# clrgcexp is build with standalone+regions
if (CLR_CMAKE_TARGET_ARCH_ARM64 OR CLR_CMAKE_TARGET_ARCH_AMD64)
set(BUILD_EXP_GC 1)
endif()

# clrgcexp is build with standalone+regions
if (BUILD_EXP_GC)
add_library_clr(clrgcexp SHARED ${GC_SOURCES})
add_dependencies(clrgcexp eventing_headers)
target_link_libraries(clrgcexp PRIVATE ${GC_LINK_LIBRARIES})
target_link_libraries(clrgcexp PRIVATE gcexp_dll_wks_descriptor)
if (FEATURE_SVR_GC)
target_link_libraries(clrgcexp PRIVATE gcexp_dll_svr_descriptor)
endif()
target_compile_definitions(clrgcexp PRIVATE -DUSE_REGIONS)
install_clr(TARGETS clrgcexp DESTINATIONS . COMPONENT runtime)
endif (CLR_CMAKE_TARGET_ARCH_ARM64 OR CLR_CMAKE_TARGET_ARCH_AMD64)
endif (BUILD_EXP_GC)

# clrgc is build with standalone+segments
add_library_clr(clrgc SHARED ${GC_SOURCES})
add_dependencies(clrgc eventing_headers)
target_link_libraries(clrgc PRIVATE ${GC_LINK_LIBRARIES})
target_link_libraries(clrgc PRIVATE gc_dll_wks_descriptor)
if(FEATURE_SVR_GC)
target_link_libraries(clrgc PRIVATE gc_dll_svr_descriptor)
endif()
install_clr(TARGETS clrgc DESTINATIONS . COMPONENT runtime)

add_definitions(-DBUILD_AS_STANDALONE)
Expand All @@ -134,6 +147,9 @@ if(FEATURE_STANDALONE_GC)
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/env)

add_definitions(-DGC_DESCRIPTOR)
add_subdirectory(datadescriptor)

install_clr(TARGETS clrgc DESTINATIONS . sharedFramework COMPONENT runtime)
if (CLR_CMAKE_TARGET_ARCH_ARM64 OR CLR_CMAKE_TARGET_ARCH_AMD64)
install_clr(TARGETS clrgcexp DESTINATIONS . sharedFramework COMPONENT runtime)
Expand Down
2 changes: 2 additions & 0 deletions src/coreclr/gc/datadescriptor/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[contracts.jsonc]
indent_size = 2
57 changes: 57 additions & 0 deletions src/coreclr/gc/datadescriptor/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# cDAC GC contract descriptor

# Up to four separate descriptors can be generated:
# 1. gc_dll_wks_descriptor - WKS GC contract descriptor for the GC DLL
# 2. gc_dll_svr_descriptor - SVR GC contract descriptor for the GC DLL (if FEATURE_SVR_GC is enabled)
# 3. gcexp_dll_wks_descriptor - WKS GC contract descriptor for the GC EXP DLL (if BUILD_EXP_GC is enabled)
# 4. gcexp_dll_svr_descriptor - SVR GC contract descriptor for the GC EXP DLL (if BUILD_EXP_GC and FEATURE_SVR_GC are enabled)

add_library(gc_dll_wks_descriptor_interface INTERFACE)
target_include_directories(gc_dll_wks_descriptor_interface INTERFACE
${CMAKE_CURRENT_SOURCE_DIR})
add_dependencies(gc_dll_wks_descriptor_interface eventing_headers)
generate_data_descriptors(
LIBRARY_NAME gc_dll_wks_descriptor
CONTRACT_NAME "GCContractDescriptorWKS"
CONTRACT_FILE "${CMAKE_CURRENT_SOURCE_DIR}/contracts.jsonc"
INTERFACE_TARGET gc_dll_wks_descriptor_interface)

if (FEATURE_SVR_GC)
add_library(gc_dll_svr_descriptor_interface INTERFACE)
target_include_directories(gc_dll_svr_descriptor_interface INTERFACE
${CMAKE_CURRENT_SOURCE_DIR})
add_dependencies(gc_dll_svr_descriptor_interface eventing_headers)
target_compile_definitions(gc_dll_svr_descriptor_interface INTERFACE -DSERVER_GC)
generate_data_descriptors(
LIBRARY_NAME gc_dll_svr_descriptor
CONTRACT_NAME "GCContractDescriptorSVR"
CONTRACT_FILE "${CMAKE_CURRENT_SOURCE_DIR}/contracts.jsonc"
INTERFACE_TARGET gc_dll_svr_descriptor_interface)
endif()

if(BUILD_EXP_GC)
add_library(gcexp_dll_wks_descriptor_interface INTERFACE)
target_include_directories(gcexp_dll_wks_descriptor_interface INTERFACE
${CMAKE_CURRENT_SOURCE_DIR})
add_dependencies(gcexp_dll_wks_descriptor_interface eventing_headers)
target_compile_definitions(gcexp_dll_wks_descriptor_interface INTERFACE -DUSE_REGIONS)
generate_data_descriptors(
LIBRARY_NAME gcexp_dll_wks_descriptor
CONTRACT_NAME "GCContractDescriptorWKS"
CONTRACT_FILE "${CMAKE_CURRENT_SOURCE_DIR}/contracts.jsonc"
INTERFACE_TARGET gcexp_dll_wks_descriptor_interface)

if (FEATURE_SVR_GC)
add_library(gcexp_dll_svr_descriptor_interface INTERFACE)
target_include_directories(gcexp_dll_svr_descriptor_interface INTERFACE
${CMAKE_CURRENT_SOURCE_DIR})
add_dependencies(gcexp_dll_svr_descriptor_interface eventing_headers)
target_compile_definitions(gcexp_dll_svr_descriptor_interface INTERFACE -DUSE_REGIONS)
target_compile_definitions(gcexp_dll_svr_descriptor_interface INTERFACE -DSERVER_GC)
generate_data_descriptors(
LIBRARY_NAME gcexp_dll_svr_descriptor
CONTRACT_NAME "GCContractDescriptorSVR"
CONTRACT_FILE "${CMAKE_CURRENT_SOURCE_DIR}/contracts.jsonc"
INTERFACE_TARGET gcexp_dll_svr_descriptor_interface)
endif()
endif()
Loading