Skip to content
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

[2018-08][watchos] Use mono_dangerous_add_raw_internal_call for watchOS icalls #5030

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions runtime/exports.t4
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,11 @@
"const void *", "method"
),

new Export (true, "void", "mono_dangerous_add_raw_internal_call",
"const char *", "name",
"const void *", "method"
),

new Export ("MonoMethodSignature *", "mono_method_signature",
"MonoMethod *", "method"
),
Expand Down
25 changes: 22 additions & 3 deletions runtime/runtime.m
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,25 @@
uint8_t flags;
};

static void
xamarin_add_internal_call (const char *name, const void *method)
{
/* COOP: With cooperative GC, icalls will run, like manageed methods,
* in GC Unsafe mode, avoiding a thread state trandition. In return
* the icalls must guarantee that they won't block, or run indefinitely
* without a safepoint, by manually performing a transition to GC Safe
* mode. With backward-compatible hybrid GC, icalls run in GC Safe
* mode and the Mono API functions take care of thread state
* transitions, so don't need to perform GC thread state transitions
* themselves.
*
*/
if (xamarin_is_gc_coop)
mono_dangerous_add_raw_internal_call (name, method);
else
mono_add_internal_call (name, method);
}

id
xamarin_get_nsobject_handle (MonoObject *obj)
{
Expand Down Expand Up @@ -881,7 +900,7 @@ -(void) xamarinSetGCHandle: (int) gc_handle;

mono_gc_toggleref_register_callback (gc_toggleref_callback);

mono_add_internal_call (xamarin_use_new_assemblies ? "Foundation.NSObject::RegisterToggleRef" : PRODUCT_COMPAT_NAMESPACE ".Foundation.NSObject::RegisterToggleRef", (const void *) gc_register_toggleref);
xamarin_add_internal_call (xamarin_use_new_assemblies ? "Foundation.NSObject::RegisterToggleRef" : PRODUCT_COMPAT_NAMESPACE ".Foundation.NSObject::RegisterToggleRef", (const void *) gc_register_toggleref);
mono_profiler_install ((MonoProfiler *) prof, NULL);
mono_profiler_install_gc (gc_event_callback, NULL);
}
Expand Down Expand Up @@ -1359,8 +1378,8 @@ -(void) xamarinSetGCHandle: (int) gc_handle;
nsvalue_class = get_class_from_name (platform_image, foundation, "NSValue", true);
nsstring_class = get_class_from_name (platform_image, foundation, "NSString", true);

mono_add_internal_call (xamarin_use_new_assemblies ? "Foundation.NSObject::xamarin_release_managed_ref" : PRODUCT_COMPAT_NAMESPACE ".Foundation.NSObject::xamarin_release_managed_ref", (const void *) xamarin_release_managed_ref);
mono_add_internal_call (xamarin_use_new_assemblies ? "Foundation.NSObject::xamarin_create_managed_ref" : PRODUCT_COMPAT_NAMESPACE ".Foundation.NSObject::xamarin_create_managed_ref", (const void *) xamarin_create_managed_ref);
xamarin_add_internal_call (xamarin_use_new_assemblies ? "Foundation.NSObject::xamarin_release_managed_ref" : PRODUCT_COMPAT_NAMESPACE ".Foundation.NSObject::xamarin_release_managed_ref", (const void *) xamarin_release_managed_ref);
xamarin_add_internal_call (xamarin_use_new_assemblies ? "Foundation.NSObject::xamarin_create_managed_ref" : PRODUCT_COMPAT_NAMESPACE ".Foundation.NSObject::xamarin_create_managed_ref", (const void *) xamarin_create_managed_ref);

runtime_initialize = mono_class_get_method_from_name (runtime_class, "Initialize", 1);

Expand Down