From bd1a4491351a8f049edf6e52b9d5071f0532b5f2 Mon Sep 17 00:00:00 2001 From: Zoltan Varga Date: Thu, 8 Mar 2018 19:10:12 -0500 Subject: [PATCH] [jit] Move the check for open constructed types later in mono_jit_compile_method_with_opt (), this function can receive (mono/mono#7494) gshared methods in llvmonly mode. Fixes https://github.com/mono/mono/issues/7364. Commit migrated from https://github.com/mono/mono/commit/c745a9575d0633175ca1c770baa84f9b47b74864 --- src/mono/mono/mini/aot-tests.cs | 6 ++++++ src/mono/mono/mini/mini-runtime.c | 9 ++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/mono/mono/mini/aot-tests.cs b/src/mono/mono/mini/aot-tests.cs index 61ce3623370f1..e111f5291860c 100644 --- a/src/mono/mono/mini/aot-tests.cs +++ b/src/mono/mono/mini/aot-tests.cs @@ -510,4 +510,10 @@ public static int test_0_fault_clauses () { } return 0; } + + public static int test_0_regress_gh_7364 () { + var map1 = new Dictionary (EqualityComparer.Default); + var map2 = new Dictionary (EqualityComparer.Default); + return 0; + } } diff --git a/src/mono/mono/mini/mini-runtime.c b/src/mono/mono/mini/mini-runtime.c index bb5f256065038..c9f74fbe5e57c 100644 --- a/src/mono/mono/mini/mini-runtime.c +++ b/src/mono/mono/mini/mini-runtime.c @@ -2063,11 +2063,6 @@ mono_jit_compile_method_with_opt (MonoMethod *method, guint32 opt, gboolean jit_ error_init (error); - if (mono_class_is_open_constructed_type (&method->klass->byval_arg)) { - mono_error_set_invalid_operation (error, "Could not execute the method because the containing type is not fully instantiated."); - return NULL; - } - if (mono_use_interpreter && !jit_only) { code = mini_get_interp_callbacks ()->create_method_pointer (method, error); if (code) @@ -2196,6 +2191,10 @@ mono_jit_compile_method_with_opt (MonoMethod *method, guint32 opt, gboolean jit_ } if (!code) { + if (mono_class_is_open_constructed_type (&method->klass->byval_arg)) { + mono_error_set_invalid_operation (error, "Could not execute the method because the containing type is not fully instantiated."); + return NULL; + } if (wait_or_register_method_to_compile (method, target_domain)) goto lookup_start; code = mono_jit_compile_method_inner (method, target_domain, opt, error);