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

Enable Finalizer event in NativeAOT #88056

Closed
LakshanF opened this issue Jun 26, 2023 · 2 comments · Fixed by #88604
Closed

Enable Finalizer event in NativeAOT #88056

LakshanF opened this issue Jun 26, 2023 · 2 comments · Fixed by #88604
Assignees
Milestone

Comments

@LakshanF
Copy link
Contributor

The finalizer thread in NativeAOT is in managed code and should fire events similar to the CoreCLR native implementation.

The managed code in NativeAOT for this is in the base class library, as opposed to the CoreLib implementation for exception event and require investigation on the RuntimeImport support to enable the event.

@LakshanF LakshanF added this to the 8.0.0 milestone Jun 26, 2023
@LakshanF LakshanF self-assigned this Jun 26, 2023
@ghost
Copy link

ghost commented Jun 26, 2023

Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas
See info in area-owners.md if you want to be subscribed.

Issue Details

The finalizer thread in NativeAOT is in managed code and should fire events similar to the CoreCLR native implementation.

The managed code in NativeAOT for this is in the base class library, as opposed to the CoreLib implementation for exception event and require investigation on the RuntimeImport support to enable the event.

Author: LakshanF
Assignees: LakshanF
Labels:

area-NativeAOT-coreclr

Milestone: 8.0.0

@MichalStrehovsky
Copy link
Member

If we need to fire an event at the beginning/end, the implementation being in managed doesn't matter:

if (InternalCalls.RhpWaitForFinalizerRequest() != 0)
{
DrainQueue();
// Tell anybody that's interested that the finalization pass is complete (there is a race condition here
// where we might immediately signal a new request as complete, but this is acceptable).
InternalCalls.RhpSignalFinalizationComplete();
}

RhpWaitForFinalizerRequest and RhpSignalFinalizationComplete are in native and we can call into eventpipe easily from there. We can add a parameter to RhpSignalFinalizationComplete with the number of finalized objects.

@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label Jul 10, 2023
@ghost ghost removed the in-pr There is an active PR which will close this issue when it is merged label Jul 12, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Aug 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants