-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[2018-10][marshal] Emit GC Safe transitions around foreign internal c…
…alls (mono#11184) * [threads] Make mono_add_internal_call external only The runtime should use mono_add_internal_call_internal or mono_add_internal_call_with_flags. The thread suspend mechanism needs to know if an icall is added via the legacy mono_add_internal_call API (which is not coop-aware, and so the registered icalls must run in GC Safe mode), or if it is added by the runtime or by a cooperative client (currently either the profiler or the System.Native PAL) which knows to add GC transitions and safepoints and not to block indefinitely. * [marshal] Factor out GCSafeTransitionBuilder Make a local builder for creating the GC Safe transition calls for a method wraper. * [sgen] Add coop GC transitions in mono_gc_toggleref_add Also mark it external only. It's not used inside the runtime. * [marshal] Emit GC Safe transitions around foreign icalls. A foreign icall is added using mono_add_internal_call and that is not coop GC aware. (The runtime uses mono_add_internal_call_with_flags or mono_add_internal_call_internal) Under hybrid suspend, foreign icalls will run in GC Safe mode and transition to GC Unsafe only when the call back into the runtime or invoke managed code. Fixes mono#11138 * [cxx] function type overloads for mono_add_internal_call_internal and mono_add_internal_call_with_flags * [runtime] Add new API call mono_dangerous_add_raw_internal_call Under hybrid suspend, this adds an icall that is assumed to run in GC Unsafe mode. As such it has additional requirements for correct operation: it must not run loops without periodically polling the runtime, and it must not perform blocking operations such as blocking I/O or taking locks without manually switching to GC Safe mode.
- Loading branch information
1 parent
90fe086
commit bbcc3eb
Showing
13 changed files
with
280 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.