Skip to content

Commit

Permalink
Change native side instead
Browse files Browse the repository at this point in the history
  • Loading branch information
MichalStrehovsky authored and github-actions committed Jan 6, 2025
1 parent 3d03a9e commit fe399fb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/coreclr/nativeaot/Runtime/RestrictedCallouts.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,6 @@ class RestrictedCallouts
static CrstStatic s_sLock;

// Prototypes for the callouts.
typedef void (F_CALL_CONV * GcRestrictedCallbackFunction)(uint32_t uiCondemnedGeneration);
typedef void (* GcRestrictedCallbackFunction)(uint32_t uiCondemnedGeneration);
typedef CLR_BOOL (* HandleTableRestrictedCallbackFunction)(Object * pObject);
};
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,9 @@ public static void EndReferenceTracking()

public static unsafe void RegisterGCCallbacks()
{
delegate* unmanaged[Fastcall]<int, void> gcStartCallback = &GCStartCollection;
delegate* unmanaged[Fastcall]<int, void> gcStopCallback = &GCStopCollection;
delegate* unmanaged[Fastcall]<int, void> gcAfterMarkCallback = &GCAfterMarkPhase;
delegate* unmanaged<int, void> gcStartCallback = &GCStartCollection;
delegate* unmanaged<int, void> gcStopCallback = &GCStopCollection;
delegate* unmanaged<int, void> gcAfterMarkCallback = &GCAfterMarkPhase;

if (!RuntimeImports.RhRegisterGcCallout(RuntimeImports.GcRestrictedCalloutKind.StartCollection, (IntPtr)gcStartCallback) ||
!RuntimeImports.RhRegisterGcCallout(RuntimeImports.GcRestrictedCalloutKind.EndCollection, (IntPtr)gcStopCallback) ||
Expand All @@ -155,7 +155,7 @@ public static bool AddReferencePath(object target, object foundReference)
}

// Used during GC callback
[UnmanagedCallersOnly(CallConvs = [typeof(CallConvFastcall)])]
[UnmanagedCallersOnly]
private static void GCStartCollection(int condemnedGeneration)
{
if (condemnedGeneration >= 2)
Expand All @@ -167,7 +167,7 @@ private static void GCStartCollection(int condemnedGeneration)
}

// Used during GC callback
[UnmanagedCallersOnly(CallConvs = [typeof(CallConvFastcall)])]
[UnmanagedCallersOnly]
private static void GCStopCollection(int condemnedGeneration)
{
if (condemnedGeneration >= 2)
Expand All @@ -177,7 +177,7 @@ private static void GCStopCollection(int condemnedGeneration)
}

// Used during GC callback
[UnmanagedCallersOnly(CallConvs = [typeof(CallConvFastcall)])]
[UnmanagedCallersOnly]
private static void GCAfterMarkPhase(int condemnedGeneration)
{
DetachNonPromotedObjects();
Expand Down

0 comments on commit fe399fb

Please sign in to comment.