alexcrichton opened PR #2632 from mach-ports
to main
:
This commit moves macOS to using mach ports instead of signals for
handling traps. The motivation for this is listed in #2456, namely that
once mach ports are used in a process that means traditional UNIX signal
handlers won't get used. This means that if Wasmtime is integrated with
Breakpad, for example, then Wasmtime's trap handler never fires and
traps don't work.The
traphandlers
module is refactored as part of this commit to split
the platform-specific bits into their own files (it was growing quite a
lot for one inlinecfg_if!
). Theunix.rs
andwindows.rs
files
remain the same as they were before with a few minor tweaks for some
refactored interfaces. Themacos.rs
file is brand new and lifts almost
its entire implementation from SpiderMonkey, adapted for Wasmtime
though.The main gotcha with mach ports is that a separate thread is what
services the exception. Some unsafe magic allows this separate thread to
read non-Send
and temporary state from other threads, but is hoped to
be safe in this context. The unfortunate downside is that calling wasm
on macOS now involves taking a global lock and modifying a global hash
map twice-per-call. I'm not entirely sure how to get out of this cost
for now, but hopefully for any embeddings on macOS it's not the end of
the world.Closes #2456
alexcrichton updated PR #2632 from mach-ports
to main
:
This commit moves macOS to using mach ports instead of signals for
handling traps. The motivation for this is listed in #2456, namely that
once mach ports are used in a process that means traditional UNIX signal
handlers won't get used. This means that if Wasmtime is integrated with
Breakpad, for example, then Wasmtime's trap handler never fires and
traps don't work.The
traphandlers
module is refactored as part of this commit to split
the platform-specific bits into their own files (it was growing quite a
lot for one inlinecfg_if!
). Theunix.rs
andwindows.rs
files
remain the same as they were before with a few minor tweaks for some
refactored interfaces. Themacos.rs
file is brand new and lifts almost
its entire implementation from SpiderMonkey, adapted for Wasmtime
though.The main gotcha with mach ports is that a separate thread is what
services the exception. Some unsafe magic allows this separate thread to
read non-Send
and temporary state from other threads, but is hoped to
be safe in this context. The unfortunate downside is that calling wasm
on macOS now involves taking a global lock and modifying a global hash
map twice-per-call. I'm not entirely sure how to get out of this cost
for now, but hopefully for any embeddings on macOS it's not the end of
the world.Closes #2456
alexcrichton updated PR #2632 from mach-ports
to main
:
This commit moves macOS to using mach ports instead of signals for
handling traps. The motivation for this is listed in #2456, namely that
once mach ports are used in a process that means traditional UNIX signal
handlers won't get used. This means that if Wasmtime is integrated with
Breakpad, for example, then Wasmtime's trap handler never fires and
traps don't work.The
traphandlers
module is refactored as part of this commit to split
the platform-specific bits into their own files (it was growing quite a
lot for one inlinecfg_if!
). Theunix.rs
andwindows.rs
files
remain the same as they were before with a few minor tweaks for some
refactored interfaces. Themacos.rs
file is brand new and lifts almost
its entire implementation from SpiderMonkey, adapted for Wasmtime
though.The main gotcha with mach ports is that a separate thread is what
services the exception. Some unsafe magic allows this separate thread to
read non-Send
and temporary state from other threads, but is hoped to
be safe in this context. The unfortunate downside is that calling wasm
on macOS now involves taking a global lock and modifying a global hash
map twice-per-call. I'm not entirely sure how to get out of this cost
for now, but hopefully for any embeddings on macOS it's not the end of
the world.Closes #2456
alexcrichton updated PR #2632 from mach-ports
to main
:
This commit moves macOS to using mach ports instead of signals for
handling traps. The motivation for this is listed in #2456, namely that
once mach ports are used in a process that means traditional UNIX signal
handlers won't get used. This means that if Wasmtime is integrated with
Breakpad, for example, then Wasmtime's trap handler never fires and
traps don't work.The
traphandlers
module is refactored as part of this commit to split
the platform-specific bits into their own files (it was growing quite a
lot for one inlinecfg_if!
). Theunix.rs
andwindows.rs
files
remain the same as they were before with a few minor tweaks for some
refactored interfaces. Themacos.rs
file is brand new and lifts almost
its entire implementation from SpiderMonkey, adapted for Wasmtime
though.The main gotcha with mach ports is that a separate thread is what
services the exception. Some unsafe magic allows this separate thread to
read non-Send
and temporary state from other threads, but is hoped to
be safe in this context. The unfortunate downside is that calling wasm
on macOS now involves taking a global lock and modifying a global hash
map twice-per-call. I'm not entirely sure how to get out of this cost
for now, but hopefully for any embeddings on macOS it's not the end of
the world.Closes #2456
alexcrichton updated PR #2632 from mach-ports
to main
:
This commit moves macOS to using mach ports instead of signals for
handling traps. The motivation for this is listed in #2456, namely that
once mach ports are used in a process that means traditional UNIX signal
handlers won't get used. This means that if Wasmtime is integrated with
Breakpad, for example, then Wasmtime's trap handler never fires and
traps don't work.The
traphandlers
module is refactored as part of this commit to split
the platform-specific bits into their own files (it was growing quite a
lot for one inlinecfg_if!
). Theunix.rs
andwindows.rs
files
remain the same as they were before with a few minor tweaks for some
refactored interfaces. Themacos.rs
file is brand new and lifts almost
its entire implementation from SpiderMonkey, adapted for Wasmtime
though.The main gotcha with mach ports is that a separate thread is what
services the exception. Some unsafe magic allows this separate thread to
read non-Send
and temporary state from other threads, but is hoped to
be safe in this context. The unfortunate downside is that calling wasm
on macOS now involves taking a global lock and modifying a global hash
map twice-per-call. I'm not entirely sure how to get out of this cost
for now, but hopefully for any embeddings on macOS it's not the end of
the world.Closes #2456
bnjbvr closed without merge PR #2632.
Last updated: Dec 23 2024 at 12:05 UTC