First set of licensing changes
[mono.git] / mono / mini / mini-llvm.c
index 83d9ba44dd725c7c84285a0cd56c839318a47944..c07a6f56e08c5a5190985b8a73b4cafa009c4674 100644 (file)
@@ -3,6 +3,7 @@
  *
  * Copyright 2009-2011 Novell Inc (http://www.novell.com)
  * Copyright 2011 Xamarin Inc (http://www.xamarin.com)
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
  */
 
 #include "mini.h"
@@ -24,8 +25,6 @@
 #define __STDC_CONSTANT_MACROS
 #endif
 
-#include "llvm-c/Core.h"
-#include "llvm-c/ExecutionEngine.h"
 #include "llvm-c/BitWriter.h"
 #include "llvm-c/Analysis.h"
 
@@ -3214,6 +3213,12 @@ process_call (EmitContext *ctx, MonoBasicBlock *bb, LLVMBuilderRef *builder_ref,
                                }
                                callee = LLVMBuildLoad (builder, tramp_var, "");
 #else
+                               target =
+                                       mono_create_jit_trampoline (mono_domain_get (),
+                                                                                               call->method, &error);
+                               if (!mono_error_ok (&error))
+                                       mono_error_raise_exception (&error); /* FIXME: Don't raise here */
+
                                callee = LLVMAddFunction (ctx->lmodule, name, llvm_sig);
                                g_free (name);
 
@@ -6316,7 +6321,7 @@ process_bb (EmitContext *ctx, MonoBasicBlock *bb)
                                        LLVMTypeRef icall_sig = LLVMFunctionType (LLVMVoidType (), NULL, 0, FALSE);
                                        callee = emit_jit_callee (ctx, "llvm_resume_unwind_trampoline", icall_sig, target);
 #else
-                                       callee = LLVMGetNamedFunction (lmodule, "llvm_resume_unwind_trampoline");
+                                       callee = LLVMGetNamedFunction (ctx->lmodule, "llvm_resume_unwind_trampoline");
 #endif
                                }
                                LLVMBuildCall (builder, callee, NULL, 0, "");