-
Notifications
You must be signed in to change notification settings - Fork 5.3k
[browser][MT] JSImport dispatch to target thread via JSSynchronizationContext #96319
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
[browser][MT] JSImport dispatch to target thread via JSSynchronizationContext #96319
Conversation
|
Tagging subscribers to 'arch-wasm': @lewing Issue DetailsJSImport dispatch
Tests
Other
|
|
/azp run runtime-wasm |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run runtime-wasm |
|
Azure Pipelines successfully started running 1 pipeline(s). |
...eropServices.JavaScript/src/System/Runtime/InteropServices/JavaScript/JSObject.References.cs
Show resolved
Hide resolved
|
/azp run runtime-wasm |
| [MethodImpl(MethodImplOptions.AggressiveInlining)] | ||
| internal static unsafe void ResolveOrRejectPromise(JSProxyContext targetContext, Span<JSMarshalerArgument> arguments) | ||
| { | ||
| // this copy is freed in mono_wasm_invoke_import_async |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this used to be always synchronous, and now becomes always-asynchronous. should we preserve the old synchronous execution when the target context is the current context?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that JS Promise handlers always go through microtask queue. So in effect this was already async before from user code perspective. We could avoid allocating C# queue item if we do the optimization you suggest.
I want to switch this to emscripten dispatch later anyway. I will add comment and keep this open question for now.
...Runtime.InteropServices.JavaScript/src/System/Runtime/InteropServices/JavaScript/JSObject.cs
Outdated
Show resolved
Hide resolved
...pt/src/System/Runtime/InteropServices/JavaScript/Marshaling/JSMarshalerArgument.Exception.cs
Outdated
Show resolved
Hide resolved
...ervices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/JSImportExportTest.cs
Outdated
Show resolved
Hide resolved
...vices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/JavaScriptTestHelper.cs
Show resolved
Hide resolved
...eropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/WebWorkerTest.cs
Outdated
Show resolved
Hide resolved
...rvices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/WebWorkerTestHelper.cs
Outdated
Show resolved
Hide resolved
...rvices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/WebWorkerTestHelper.cs
Outdated
Show resolved
Hide resolved
...rvices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/WebWorkerTestHelper.cs
Outdated
Show resolved
Hide resolved
kg
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
other than my comments this all looks good to me, and i feel like i understand most of it
|
/azp run runtime-wasm |
|
Azure Pipelines successfully started running 1 pipeline(s). |
JSImport dispatch
JSImportwill now dispatch the call to the correct threadJSObjectpassed as parametersJSWebWorkerTask/PromiseTask/PromiseresultJSImportGeneratordoesn't generateThreadStaticanymore for the binding variableTests
System.Runtime.InteropServices.JavaScript.Tests.WebWorkerTest, more to come laterSystem.Runtime.InteropServices.JavaScript.Testsnow also run xunit on thread pool in MTOther
AssertIsInteropThreadJSFunctionBinding.FunctionNameonly in Debug buildJSWebWorkermono_set_thread_idimproves TID in JS console logging from threadsmono_wasm_main_thread_ptrworker.pthread_ptrFollow up in #95370