Skip to content

Commit 546604c

Browse files
authored
[sgen] Transition to GC Unsafe in mono_gc_wait_for_bridge_processing (#55681)
* [sgen] Transition to GC Unsafe in mono_gc_wait_for_bridge_processing Mark it as an external only API. In the runtime, use mono_gc_wait_for_bridge_processing_internal.
1 parent 9717cf5 commit 546604c

File tree

4 files changed

+19
-3
lines changed

4 files changed

+19
-3
lines changed

src/mono/mono/metadata/sgen-bridge.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,14 @@ volatile gboolean mono_bridge_processing_in_progress = FALSE;
5454
*/
5555
void
5656
mono_gc_wait_for_bridge_processing (void)
57+
{
58+
MONO_ENTER_GC_UNSAFE;
59+
mono_gc_wait_for_bridge_processing_internal ();
60+
MONO_EXIT_GC_UNSAFE;
61+
}
62+
63+
void
64+
mono_gc_wait_for_bridge_processing_internal (void)
5765
{
5866
if (!mono_bridge_processing_in_progress)
5967
return;
@@ -738,6 +746,11 @@ mono_gc_wait_for_bridge_processing (void)
738746
{
739747
}
740748

749+
void
750+
mono_gc_wait_for_bridge_processing_internal (void)
751+
{
752+
}
753+
741754
MonoGCBridgeObjectKind
742755
sgen_bridge_class_kind (MonoClass *klass)
743756
{

src/mono/mono/metadata/sgen-bridge.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ typedef struct {
103103
*/
104104
MONO_API void mono_gc_register_bridge_callbacks (MonoGCBridgeCallbacks *callbacks);
105105

106-
MONO_API void mono_gc_wait_for_bridge_processing (void);
106+
MONO_API MONO_RT_EXTERNAL_ONLY void mono_gc_wait_for_bridge_processing (void);
107107

108108
MONO_END_DECLS
109109

src/mono/mono/metadata/sgen-client-mono.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,10 +250,13 @@ sgen_client_bridge_processing_stw_step (void)
250250
sgen_bridge_processing_stw_step ();
251251
}
252252

253+
void
254+
mono_gc_wait_for_bridge_processing_internal (void);
255+
253256
static void G_GNUC_UNUSED
254257
sgen_client_bridge_wait_for_processing (void)
255258
{
256-
mono_gc_wait_for_bridge_processing ();
259+
mono_gc_wait_for_bridge_processing_internal ();
257260
}
258261

259262
static void G_GNUC_UNUSED

src/mono/mono/metadata/sgen-mono.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2848,7 +2848,7 @@ sgen_client_ensure_weak_gchandles_accessible (void)
28482848
* should wait for bridge processing but would fail to do so.
28492849
*/
28502850
if (G_UNLIKELY (mono_bridge_processing_in_progress))
2851-
mono_gc_wait_for_bridge_processing ();
2851+
mono_gc_wait_for_bridge_processing_internal ();
28522852
}
28532853

28542854
void*

0 commit comments

Comments
 (0)