-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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] threads & js cleanup #86278
Conversation
Tagging subscribers to 'arch-wasm': @lewing Issue Detailsnull
|
/azp run runtime-wasm |
Azure Pipelines successfully started running 1 pipeline(s). |
126ce7b
to
85c2276
Compare
/azp run runtime-wasm |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run runtime-wasm |
Azure Pipelines successfully started running 1 pipeline(s). |
eaebbbc
to
43f6941
Compare
/azp run runtime-wasm |
Azure Pipelines successfully started running 1 pipeline(s). |
AOT issues are #86621 |
/azp run runtime-wasm |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run runtime-wasm |
Azure Pipelines successfully started running 1 pipeline(s). |
CI failures are unrelated |
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.
After discussing offline: LGTM.
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.
After discussing offline: LGTM.
@lambdageek or @kg please have yet another look and approve. I think the only part which needs your attention is change from invoke via mono reflection to invoke via |
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.
Mostly LGTM. A couple of nits.
Two things to consider addressing:
- The
_DataIsAvailable
delegate is there to avoid allocating a new delegate object each time - The 25s delay is testing the threadpool worker timeout doesn't kill a worker that has unsettled promise. Changing to 5s changes the test.
...ervices.JavaScript/src/System/Runtime/InteropServices/JavaScript/JSSynchronizationContext.cs
Show resolved
Hide resolved
...ervices.JavaScript/src/System/Runtime/InteropServices/JavaScript/JSSynchronizationContext.cs
Outdated
Show resolved
Hide resolved
src/mono/System.Private.CoreLib/src/System/Threading/ThreadPool.Browser.Mono.cs
Show resolved
Hide resolved
src/mono/System.Private.CoreLib/src/System/Threading/ThreadPool.Browser.Mono.cs
Outdated
Show resolved
Hide resolved
src/mono/System.Private.CoreLib/src/System/Threading/ThreadPool.Browser.Mono.cs
Outdated
Show resolved
Hide resolved
[MethodImplAttribute(MethodImplOptions.InternalCall)] | ||
private static extern void QueueCallback(); | ||
internal static extern unsafe void MainThreadScheduleBackgroundJob(void* callback); |
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.
nit: It would be nice to collect all of these internal calls that are called inside S.P.C into a single class
src/mono/System.Private.CoreLib/src/System/Threading/TimerQueue.Browser.Mono.cs
Outdated
Show resolved
Hide resolved
src/mono/System.Private.CoreLib/src/System/Threading/TimerQueue.Browser.Mono.cs
Outdated
Show resolved
Hide resolved
added comments added missing export of _emscripten_main_runtime_thread_id
/azp run runtime-wasm |
Azure Pipelines successfully started running 1 pipeline(s). |
...ervices.JavaScript/src/System/Runtime/InteropServices/JavaScript/JSSynchronizationContext.cs
Outdated
Show resolved
Hide resolved
add asserts and exception handlers
/azp run runtime-wasm |
Azure Pipelines successfully started running 1 pipeline(s). |
I'm not sure that invoking via UnmanagedCallersOnly will transition from one GC mode to another correctly. @lambdageek do you know? |
It will work correctly (unless you use |
# Conflicts: # src/mono/wasm/wasm.proj
This is just cleanup. There are no intended functional changes.
TimerQueue
SetTimeout
toMainThreadScheduleTimer
ReplaceNextSetTimeout
toReplaceNextTimer
TimeoutCallback
toTimerHandler
mono_wasm_set_timeout
tomono_wasm_main_thread_schedule_timer
mono_set_timeout_exec
tomono_wasm_execute_timer
[UnmanagedCallersOnly]
instead ofmono_runtime_try_invoke
ThreadPool
QueueCallback
toMainThreadScheduleBackgroundJob
usingmono_main_thread_schedule_background_job
Callback
toBackgroundJobHandler
[UnmanagedCallersOnly]
instead ofmono_runtime_try_invoke
JSSynchronizationContext
RequestPumpCallback
ScheduleBackgroundJob
toMainThreadScheduleBackgroundJob
usingmono_main_thread_schedule_background_job
Jobs
mono_threads_schedule_background_job
intomono_current_thread_schedule_background_job
andmono_main_thread_schedule_background_job
MT Debugger
bind_static_method
.Other
install_sync_context
browser-threads-minimal
to pass on Windowsmono_threads_wasm_async_run_in_target_thread
mono_bound_thread_schedule_background_job
in preparation for next stepconv_string
to different file_get_class_name
,_get_type_name
,_get_type_aqn
methodsmono_wasm_bind_cs_function
andmono_wasm_bind_js_function
only under Debug build of the runtime. It makes debugging easier because names the exported/imported function are visible on the stack trace.normalizeConfig
after it arrived by message.