Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix GC interfaces versioning #81188

Merged
merged 2 commits into from
Jan 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion src/coreclr/gc/gccommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ IGCHeapInternal* g_theGCHeap;
IGCHandleManager* g_theGCHandleManager;

#ifdef BUILD_AS_STANDALONE
IGCToCLR2* g_theGCToCLR;
IGCToCLR* g_theGCToCLR;
VersionInfo g_runtimeSupportedVersion;
#endif // BUILD_AS_STANDALONE

Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/gc/gcenv.ee.standalone.inl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

// The singular interface instance. All calls in GCToEEInterface
// will be forwarded to this interface instance.
extern IGCToCLR2* g_theGCToCLR;
extern IGCToCLR* g_theGCToCLR;

// GC version that the current runtime supports
extern VersionInfo g_runtimeSupportedVersion;
Expand Down Expand Up @@ -316,7 +316,7 @@ inline void GCToEEInterface::DiagAddNewRegion(int generation, uint8_t* rangeStar

inline void GCToEEInterface::LogErrorToHost(const char *message)
{
if (g_runtimeSupportedVersion.MajorVersion >= GC_INTERFACE2_MAJOR_VERSION)
if (g_runtimeSupportedVersion.MajorVersion >= 1)
{
g_theGCToCLR->LogErrorToHost(message);
}
Expand Down
5 changes: 1 addition & 4 deletions src/coreclr/gc/gcinterface.ee.h
Original file line number Diff line number Diff line change
Expand Up @@ -446,11 +446,8 @@ class IGCToCLR {

virtual
void DiagAddNewRegion(int generation, uint8_t* rangeStart, uint8_t* rangeEnd, uint8_t* rangeEndReserved) = 0;
};

class IGCToCLR2 : public IGCToCLR {
public:

// The following method is available only with EE_INTERFACE_MAJOR_VERSION >= 1
virtual
void LogErrorToHost(const char *message) = 0;
};
Expand Down
12 changes: 6 additions & 6 deletions src/coreclr/gc/gcinterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@
#ifndef _GC_INTERFACE_H_
#define _GC_INTERFACE_H_

// The major version of the GC/EE interface. Breaking changes to this interface
// The major version of the IGCHeap interface. Breaking changes to this interface
// require bumps in the major version number.
#define GC_INTERFACE_MAJOR_VERSION 6
#define GC_INTERFACE_MAJOR_VERSION 5

// The minor version of the GC/EE interface. Non-breaking changes are required
// The minor version of the IGCHeap interface. Non-breaking changes are required
// to bump the minor version number. GCs and EEs with minor version number
// mismatches can still interopate correctly, with some care.
// mismatches can still interoperate correctly, with some care.
#define GC_INTERFACE_MINOR_VERSION 1

// The major version of the GC/EE interface. Breaking changes to this interface
// The major version of the IGCToCLR interface. Breaking changes to this interface
// require bumps in the major version number.
#define GC_INTERFACE2_MAJOR_VERSION 6
#define EE_INTERFACE_MAJOR_VERSION 1

struct ScanContext;
struct gc_alloc_context;
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/gc/gcload.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ GC_Initialize(

#ifdef BUILD_AS_STANDALONE
assert(clrToGC != nullptr);
g_theGCToCLR = (IGCToCLR2*)clrToGC;
g_theGCToCLR = clrToGC;
#else
UNREFERENCED_PARAMETER(clrToGC);
assert(clrToGC == nullptr);
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/vm/gcheaputilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,8 @@ HRESULT LoadAndInitializeGC(LPCWSTR standaloneGcLocation)
}

g_gc_load_status = GC_LOAD_STATUS_GET_VERSIONINFO;
g_gc_version_info.MajorVersion = GC_INTERFACE_MAJOR_VERSION;
g_gc_version_info.MinorVersion = GC_INTERFACE_MINOR_VERSION;
g_gc_version_info.MajorVersion = EE_INTERFACE_MAJOR_VERSION;
g_gc_version_info.MinorVersion = 0;
g_gc_version_info.BuildVersion = 0;
versionInfo(&g_gc_version_info);
g_gc_load_status = GC_LOAD_STATUS_CALL_VERSIONINFO;
Expand Down