Skip to content

Commit 8ef9f7f

Browse files
committed
[WebAssembly] Temporarily work around lack of __attribute__((constructor))
We don't have a great way to ensure that the current-global-actor hook will get installed by the concurrency library with WebAssembly, so temporarily work around the issue by relying on the fact that we also aren't doing actual concurrency with WebAssembly.
1 parent 296e146 commit 8ef9f7f

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

stdlib/public/runtime/ProtocolConformance.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1392,8 +1392,17 @@ static bool swift_isInConformanceExecutionContextImpl(
13921392
return true;
13931393

13941394
if (context->globalActorIsolationType) {
1395-
if (!_swift_task_isCurrentGlobalActorHook)
1395+
if (!_swift_task_isCurrentGlobalActorHook) {
1396+
#if defined(__wasm__)
1397+
// FIXME: We don't currently support a concurrency model for WebAssembly,
1398+
// and the global actor hook isn't getting initialized due to the
1399+
// lack of __attribute__((constructor)) support. Therefore, we
1400+
// treat everything "as if" it were on the correct global actor.
1401+
return true;
1402+
#else
13961403
return false;
1404+
#endif
1405+
}
13971406

13981407
// Check whether we are running on this global actor.
13991408
if (!_swift_task_isCurrentGlobalActorHook(

0 commit comments

Comments
 (0)