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

[sgen] Transition to GC Unsafe in mono_gc_wait_for_bridge_processing #55681

Merged
merged 2 commits into from
Jul 15, 2021

Conversation

lambdageek
Copy link
Member

Mark it as an external only API. In the runtime, use mono_gc_wait_for_bridge_processing_internal

Mark it as an external only API.  In the runtime, use
mono_gc_wait_for_bridge_processing_internal.
@ghost
Copy link

ghost commented Jul 14, 2021

Tagging subscribers to this area: @BrzVlad
See info in area-owners.md if you want to be subscribed.

Issue Details

Mark it as an external only API. In the runtime, use mono_gc_wait_for_bridge_processing_internal

Author: lambdageek
Assignees: -
Labels:

area-GC-mono

Milestone: -

@@ -103,7 +103,7 @@ typedef struct {
*/
MONO_API void mono_gc_register_bridge_callbacks (MonoGCBridgeCallbacks *callbacks);

MONO_API void mono_gc_wait_for_bridge_processing (void);
MONO_API MONO_RT_EXTERNAL_ONLY void mono_gc_wait_for_bridge_processing (void);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume this MONO_RT_EXTERNAL_ONLY thing is to mark it as something that should only be called externally, not by the runtime itself? Is there some static checking that prevents such calls?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It expands to an __attribute__((deprecated)) when it's compiled inside the runtime, so we get a build error.

the general pattern we've been following with GC Unsafe transitions in MONO_API functions is that we add an _internal vesion which doesn't do the transition (because inside the runtime we're in GC Unsafe mode most of the time and do transitions explicitly), and an external-only API function that performs the transition explicitly because they are primarily called from outside the runtime which is mostly in GC Safe mode. (transitions to enter unsafe are ok to nest, so it would be harmless to dispense with the _internal function, but it's a bit nicer to avoid the extraneous function call)

@lambdageek lambdageek merged commit 546604c into dotnet:main Jul 15, 2021
@akoeplinger
Copy link
Member

/azp run sync-runtime-to-mono

1 similar comment
@akoeplinger
Copy link
Member

/azp run sync-runtime-to-mono

@ghost ghost locked as resolved and limited conversation to collaborators Aug 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants