Permalink
Browse files

Don't disable sharing for open generic async methods, since the JIT c…

…an't compile these without sharing.
  • Loading branch information...
1 parent 10ef887 commit c29511f2e6e8bf697ed050f2ee5a2d56a001fa04 @vargaz vargaz committed Mar 31, 2013
Showing with 19 additions and 1 deletion.
  1. +19 −1 mono/mini/mini-generic-sharing.c
View
20 mono/mini/mini-generic-sharing.c
@@ -1868,6 +1868,20 @@ has_constraints (MonoGenericContainer *container)
*/
}
+static gboolean
+mini_method_is_open (MonoMethod *method)
+{
+ if (method->is_inflated) {
+ MonoGenericContext *ctx = mono_method_get_context (method);
+
+ if (ctx->class_inst && ctx->class_inst->is_open)
+ return TRUE;
+ if (ctx->method_inst && ctx->method_inst->is_open)
+ return TRUE;
+ }
+ return FALSE;
+}
+
static G_GNUC_UNUSED gboolean
is_async_state_machine_class (MonoClass *klass)
{
@@ -1978,8 +1992,12 @@ mono_method_is_generic_sharable_impl_full (MonoMethod *method, gboolean allow_ty
return FALSE;
/* This does potentially expensive cattr checks, so do it at the end */
- if (is_async_method (method))
+ if (is_async_method (method)) {
+ if (mini_method_is_open (method))
+ /* The JIT can't compile these without sharing */
+ return TRUE;
return FALSE;
+ }
return TRUE;
}

0 comments on commit c29511f

Please sign in to comment.