Fix the build.
[mono.git] / mono / mini / method-to-ir.c
index e3a296534a210367e757e32a25358b6cc0094f04..4c0a925becfeda42c3460cbe2b8bb122ad7dc503 100644 (file)
@@ -5032,22 +5032,6 @@ handle_delegate_ctor (MonoCompile *cfg, MonoClass *klass, MonoInst *target, Mono
        if (!obj)
                return NULL;
 
-       if (cfg->llvm_only) {
-               MonoInst *args [16];
-
-               /*
-                * If the method to be called needs an rgctx, we can't fall back to mono_delegate_ctor (), since it might receive
-                * the address of a gshared method. So use a JIT icall.
-                * FIXME: Optimize this.
-                */
-               args [0] = obj;
-               args [1] = target;
-               args [2] = emit_get_rgctx_method (cfg, context_used, method, MONO_RGCTX_INFO_METHOD);
-               mono_emit_jit_icall (cfg, virtual_ ? mono_llvmonly_init_delegate_virtual : mono_llvmonly_init_delegate, args);
-
-               return obj;
-       }
-
        /* Inline the contents of mono_delegate_ctor */
 
        /* Set target field */
@@ -5092,6 +5076,22 @@ handle_delegate_ctor (MonoCompile *cfg, MonoClass *klass, MonoInst *target, Mono
                MONO_EMIT_NEW_STORE_MEMBASE (cfg, OP_STORE_MEMBASE_REG, obj->dreg, MONO_STRUCT_OFFSET (MonoDelegate, method_code), code_slot_ins->dreg);                
        }
 
+       if (cfg->llvm_only) {
+               MonoInst *args [16];
+
+               if (virtual_) {
+                       args [0] = obj;
+                       args [1] = target;
+                       args [2] = emit_get_rgctx_method (cfg, context_used, method, MONO_RGCTX_INFO_METHOD);
+                       mono_emit_jit_icall (cfg, mono_llvmonly_init_delegate_virtual, args);
+               } else {
+                       args [0] = obj;
+                       mono_emit_jit_icall (cfg, mono_llvmonly_init_delegate, args);
+               }
+
+               return obj;
+       }
+
        if (cfg->compile_aot) {
                MonoDelegateClassMethodPair *del_tramp;
 
@@ -11852,7 +11852,7 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                                if (managed_alloc)
                                        ins = mono_emit_method_call (cfg, managed_alloc, args, NULL);
                                else
-                                       ins = mono_emit_jit_icall (cfg, mono_array_new_specific, args);
+                                       ins = mono_emit_jit_icall (cfg, ves_icall_array_new_specific, args);
                        } else {
                                if (cfg->opt & MONO_OPT_SHARED) {
                                        /* Decompose now to avoid problems with references to the domainvar */