Merge pull request #4048 from kumpera/iface_casting_cleanup
[mono.git] / mono / mini / aot-compiler.c
index cc8422f06f4205699984adaf1469b01811d0b072..91b9b1c52b7c6f040b1b89648e61b78ca91095ae 100644 (file)
@@ -5846,6 +5846,7 @@ encode_patch (MonoAotCompile *acfg, MonoJumpInfo *patch_info, guint8 *buf, guint
                break;
        case MONO_PATCH_INFO_GC_SAFE_POINT_FLAG:
        case MONO_PATCH_INFO_GET_TLS_TRAMP:
+       case MONO_PATCH_INFO_JIT_THREAD_ATTACH:
                break;
        default:
                g_warning ("unable to handle jump info %d", patch_info->type);
@@ -7642,7 +7643,7 @@ compile_method (MonoAotCompile *acfg, MonoMethod *method)
         * encountered.
         */
        depth = GPOINTER_TO_UINT (g_hash_table_lookup (acfg->method_depth, method));
-       if (!acfg->aot_opts.no_instances && depth < 32) {
+       if (!acfg->aot_opts.no_instances && depth < 32 && mono_aot_mode_is_full (&acfg->aot_opts)) {
                for (patch_info = cfg->patch_info; patch_info; patch_info = patch_info->next) {
                        switch (patch_info->type) {
                        case MONO_PATCH_INFO_RGCTX_FETCH:
@@ -7661,7 +7662,7 @@ compile_method (MonoAotCompile *acfg, MonoMethod *method)
 
                                if (!m)
                                        break;
-                               if (m->is_inflated) {
+                               if (m->is_inflated && mono_aot_mode_is_full (&acfg->aot_opts)) {
                                        if (!(mono_class_generic_sharing_enabled (m->klass) &&
                                                  mono_method_is_generic_sharable_full (m, FALSE, FALSE, FALSE)) &&
                                                (!method_has_type_vars (m) || mono_method_is_generic_sharable_full (m, TRUE, TRUE, FALSE))) {
@@ -9866,7 +9867,8 @@ collect_methods (MonoAotCompile *acfg)
                }
        }
 
-       add_generic_instances (acfg);
+       if (mono_aot_mode_is_full (&acfg->aot_opts))
+               add_generic_instances (acfg);
 
        if (mono_aot_mode_is_full (&acfg->aot_opts))
                add_wrappers (acfg);
@@ -9921,7 +9923,7 @@ compile_methods (MonoAotCompile *acfg)
                g_free (methods);
 
                for (i = 0; i < threads->len; ++i) {
-                       mono_thread_info_wait_one_handle (g_ptr_array_index (threads, i), INFINITE, FALSE);
+                       mono_thread_info_wait_one_handle (g_ptr_array_index (threads, i), MONO_INFINITE_WAIT, FALSE);
                        mono_threads_close_thread_handle (g_ptr_array_index (threads, i));
                }
        } else {
@@ -10495,6 +10497,11 @@ add_preinit_got_slots (MonoAotCompile *acfg)
        get_got_offset (acfg, FALSE, ji);
        get_got_offset (acfg, TRUE, ji);
 
+       ji = (MonoJumpInfo *)mono_mempool_alloc0 (acfg->mempool, sizeof (MonoJumpInfo));
+       ji->type = MONO_PATCH_INFO_JIT_THREAD_ATTACH;
+       get_got_offset (acfg, FALSE, ji);
+       get_got_offset (acfg, TRUE, ji);
+
        for (i = 0; i < sizeof (preinited_jit_icalls) / sizeof (char*); ++i) {
                ji = (MonoJumpInfo *)mono_mempool_alloc0 (acfg->mempool, sizeof (MonoAotCompile));
                ji->type = MONO_PATCH_INFO_INTERNAL_METHOD;