enable_llvm=$enable_llvm_default
fi
+if test "x$enable_loadedllvm" = "xyes"; then
+ AC_MSG_WARN("Loadable LLVM is no longer supported. Enabling default LLVM support instead.")
+ enable_llvm=yes
+fi
+
enable_llvm_msvc_only="no"
if test "x$enable_llvm" = "xyes"; then
if test "x$host_win32" = "xyes"; then
;;
esac
fi
- if test "x$enable_loadedllvm" = "xyes"; then
- AC_MSG_WARN("Loadable LLVM currently not supported on Windows. Disabling feature.")
- enable_loadedllvm=no
- fi
fi
fi
AM_CONDITIONAL(ENABLE_LLVM, [test x$enable_llvm = xyes && test x$enable_llvm_msvc_only != xyes])
-AM_CONDITIONAL(LOADED_LLVM, [test x$enable_loadedllvm = xyes && test x$enable_llvm_msvc_only != xyes])
-if test "x$enable_loadedllvm" = "xyes"; then
- if test "x$enable_llvm_msvc_only" != "xyes"; then
- AC_DEFINE(MONO_LLVM_LOADED, 1, [The LLVM back end is dynamically loaded])
- fi
-fi
-
if test "x$enable_llvm" = "xyes"; then
enable_llvm_runtime=yes
fi
Engine: $jit_status
BigArrays: $enable_big_arrays
DTrace: $enable_dtrace
- LLVM Back End: $enable_llvm (dynamically loaded: $enable_loadedllvm, built in-tree: $internal_llvm, assertions: $enable_llvm_asserts, msvc only: $enable_llvm_msvc_only)
+ LLVM Back End: $enable_llvm (built in-tree: $internal_llvm, assertions: $enable_llvm_asserts, msvc only: $enable_llvm_msvc_only)
Spectre: $spectre_mitigation_status
Mono.Native: $mono_native_text
}
#endif /* HOST_WIN32 */
-#if MONO_LLVM_LOADED
-
-static
-MonoJitICallInfos mono_jit_icall_info;
-
-MonoJitICallInfos*
-mono_get_jit_icall_info (void)
-{
- return &mono_jit_icall_info;
-}
-
-#else
-
MonoJitICallInfos mono_jit_icall_info;
-#endif
-
MonoObjectHandle
ves_icall_System_Array_GetValueImpl (MonoArrayHandle array, guint32 pos, MonoError *error)
{
MonoJitICallInfo array [MONO_JIT_ICALL_count];
} MonoJitICallInfos;
-// Indirect mono_jit_icall_info access through a function or macro due to loaded LLVM.
-//
-#if MONO_LLVM_LOADED
-
-MONO_LLVM_INTERNAL MonoJitICallInfos*
-mono_get_jit_icall_info (void);
-
-#else
-
extern MonoJitICallInfos mono_jit_icall_info;
#define mono_get_jit_icall_info() (&mono_jit_icall_info)
-#endif
-
// Convert MonoJitICallInfo* to an int or enum.
//
#define mono_jit_icall_info_index(x) ((x) - mono_get_jit_icall_info ()->array)
endif()
if (ENABLE_LLVM)
-if (LOADED_LLVM)
-set (llvm_sources
- mini-llvm-loaded.c)
-else ()
set (llvm_sources
mini-llvm.c
- mini-llvm-loaded.c
mini-llvm-cpp.cpp
llvm-jit.cpp)
endif()
-endif()
if (ENABLE_LLVM)
set (llvm_runtime_sources
endif
libmain_a_CFLAGS = $(AM_CFLAGS) @CXX_ADD_CFLAGS@
-if LOADED_LLVM
-lib_LTLIBRARIES += libmono-llvm.la
-libmono_llvm_la_SOURCES = mini-llvm.c mini-llvm-cpp.cpp llvm-jit.cpp
-libmono_llvm_la_LIBADD = $(glib_libs) $(LLVM_LIBS) $(LLVM_LDFLAGS)
-libmono_llvm_la_CFLAGS = $(AM_CFLAGS) @CXX_ADD_CFLAGS@
-
-if HOST_DARWIN
-libmono_llvm_la_LDFLAGS=-Wl,-undefined -Wl,suppress -Wl,-flat_namespace
-endif
-endif
-
# we need this to prevent automake from generating a default mono_SOURCES = mono.c
mono_SOURCES =
MONO_SGEN_LIB=libmonosgen-2.0.la
endif
-if LOADED_LLVM
-LLVMMONOF=
-else
LLVMMONOF=$(LLVM_LIBS) $(LLVM_LDFLAGS)
-endif
mono_boehm_LDADD = \
libmain_a-main.$(OBJEXT) \
mini-posix.c
if ENABLE_LLVM
-if LOADED_LLVM
-llvm_sources = \
- mini-llvm-loaded.c
-else
llvm_sources = \
mini-llvm.c \
- mini-llvm-loaded.c \
mini-llvm-cpp.cpp \
llvm-jit.cpp
endif
-endif
interp_sources = \
interp/interp.h \
void
mono_llvm_cpp_throw_exception (void)
{
-#ifdef MONO_LLVM_LOADED
- g_assert_not_reached ();
-#else
gint32 *ex = NULL;
/* The generated code catches an int32* */
throw ex;
-#endif
}
void
+++ /dev/null
-/**
- * \file
- * Handle the differences between the llvm backend beeing embedded
- * or loaded at runtime.
- */
-
-#include "mini.h"
-#include "mini-llvm.h"
-
-#ifdef MONO_LLVM_LOADED
-
-typedef struct {
- void (*init)(gboolean);
- void (*cleanup)(void);
- void (*emit_method)(MonoCompile *cfg);
- void (*emit_call)(MonoCompile *cfg, MonoCallInst *call);
- void (*create_aot_module)(MonoAssembly *assembly, const char *global_prefix, int initial_got_size, LLVMModuleFlags flags);
- void (*fixup_aot_module)(void);
- void (*emit_aot_module)(const char *filename, const char *cu_name);
- void (*check_method_supported)(MonoCompile *cfg);
- void (*emit_aot_file_info)(MonoAotFileInfo *info, gboolean has_jitted_code);
- void (*emit_aot_data)(const char *symbol, guint8 *data, int data_len);
- void (*free_domain_info)(MonoDomain *domain);
- void (*create_vars)(MonoCompile *cfg);
- MonoCPUFeatures (*get_cpu_features)(void);
-} LoadedBackend;
-
-static LoadedBackend backend;
-
-void
-mono_llvm_init (gboolean enable_jit)
-{
- backend.init (enable_jit);
-}
-
-void
-mono_llvm_cleanup (void)
-{
- backend.cleanup ();
-}
-
-void
-mono_llvm_emit_method (MonoCompile *cfg)
-{
- backend.emit_method (cfg);
-}
-
-void
-mono_llvm_emit_call (MonoCompile *cfg, MonoCallInst *call)
-{
- backend.emit_call (cfg, call);
-}
-
-void
-mono_llvm_create_aot_module (MonoAssembly *assembly, const char *global_prefix, int initial_got_size, LLVMModuleFlags flags)
-{
- backend.create_aot_module (assembly, global_prefix, initial_got_size, flags);
-}
-
-void
-mono_llvm_emit_aot_module (const char *filename, const char *cu_name)
-{
- backend.emit_aot_module (filename, cu_name);
-}
-
-void
-mono_llvm_fixup_aot_module (void)
-{
- backend.fixup_aot_module ();
-}
-
-void
-mono_llvm_check_method_supported (MonoCompile *cfg)
-{
- backend.check_method_supported (cfg);
-}
-
-void
-mono_llvm_free_domain_info (MonoDomain *domain)
-{
- /* This is called even when llvm is not enabled */
- if (backend.free_domain_info)
- backend.free_domain_info (domain);
-}
-
-void
-mono_llvm_emit_aot_file_info (MonoAotFileInfo *info, gboolean has_jitted_code)
-{
- backend.emit_aot_file_info (info, has_jitted_code);
-}
-
-void
-mono_llvm_emit_aot_data (const char *symbol, guint8 *data, int data_len)
-{
- backend.emit_aot_data (symbol, data, data_len);
-}
-
-void
-mono_llvm_create_vars (MonoCompile *cfg)
-{
- backend.create_vars (cfg);
-}
-
-int
-mono_llvm_load (const char* bpath)
-{
- char *err = NULL;
- MonoDl *llvm_lib = mono_dl_open_runtime_lib ("mono-llvm", MONO_DL_LAZY, &err);
-
- if (!llvm_lib) {
- g_warning ("llvm load failed: %s\n", err);
- g_free (err);
- return FALSE;
- }
-
- err = mono_dl_symbol (llvm_lib, "mono_llvm_init", (void**)&backend.init);
- if (err) goto symbol_error;
- err = mono_dl_symbol (llvm_lib, "mono_llvm_cleanup", (void**)&backend.cleanup);
- if (err) goto symbol_error;
- err = mono_dl_symbol (llvm_lib, "mono_llvm_emit_method", (void**)&backend.emit_method);
- if (err) goto symbol_error;
- err = mono_dl_symbol (llvm_lib, "mono_llvm_emit_call", (void**)&backend.emit_call);
- if (err) goto symbol_error;
- err = mono_dl_symbol (llvm_lib, "mono_llvm_create_aot_module", (void**)&backend.create_aot_module);
- if (err) goto symbol_error;
- err = mono_dl_symbol (llvm_lib, "mono_llvm_emit_aot_module", (void**)&backend.emit_aot_module);
- if (err) goto symbol_error;
- err = mono_dl_symbol (llvm_lib, "mono_llvm_fixup_aot_module", (void**)&backend.fixup_aot_module);
- if (err) goto symbol_error;
- err = mono_dl_symbol (llvm_lib, "mono_llvm_check_method_supported", (void**)&backend.check_method_supported);
- if (err) goto symbol_error;
- err = mono_dl_symbol (llvm_lib, "mono_llvm_free_domain_info", (void**)&backend.free_domain_info);
- if (err) goto symbol_error;
- err = mono_dl_symbol (llvm_lib, "mono_llvm_emit_aot_file_info", (void**)&backend.emit_aot_file_info);
- if (err) goto symbol_error;
- err = mono_dl_symbol (llvm_lib, "mono_llvm_emit_aot_data", (void**)&backend.emit_aot_data);
- if (err) goto symbol_error;
- err = mono_dl_symbol (llvm_lib, "mono_llvm_create_vars", (void**)&backend.create_vars);
- if (err) goto symbol_error;
- err = mono_dl_symbol (llvm_lib, "mono_llvm_get_cpu_features", (void**)&backend.get_cpu_features);
- if (err) goto symbol_error;
- return TRUE;
-symbol_error:
- g_warning ("llvm symbol load failed: %s\n", err);
- g_free (err);
- return FALSE;
-}
-
-MonoCPUFeatures mono_llvm_get_cpu_features (void)
-{
- return backend.get_cpu_features ();
-}
-
-#else
-
-int
-mono_llvm_load (const char* bpath)
-{
- return TRUE;
-}
-
-#endif /* MONO_LLVM_LOADED */
-
}
ctx->has_safepoints = requires_safepoint;
-#ifndef MONO_LLVM_LOADED
if (!cfg->llvm_only && mono_threads_are_safepoints_enabled () && requires_safepoint) {
if (!cfg->compile_aot && cfg->method->wrapper_type != MONO_WRAPPER_ALLOC) {
LLVMSetGC (method, "coreclr");
LLVMSetGC (method, "coreclr");
}
}
-#endif
LLVMSetLinkage (method, LLVMPrivateLinkage);
mono_llvm_add_func_attr (method, LLVM_ATTR_UW_TABLE);
LLVM_MODULE_FLAG_INTERP = (1 << 4)
} LLVMModuleFlags;
-/* KEEP THIS IN SYNCH WITH mini-llvm-loaded.c */
MONO_LLVM_INTERNAL void mono_llvm_init (gboolean enable_jit);
MONO_LLVM_INTERNAL void mono_llvm_cleanup (void);
MONO_LLVM_INTERNAL void mono_llvm_emit_method (MonoCompile *cfg);
MONO_LLVM_INTERNAL void mono_llvm_check_method_supported (MonoCompile *cfg);
MONO_LLVM_INTERNAL void mono_llvm_free_domain_info (MonoDomain *domain);
MONO_API void mono_personality (void);
-int mono_llvm_load (const char* bpath);
MONO_LLVM_INTERNAL void mono_llvm_create_vars (MonoCompile *cfg);
MONO_LLVM_INTERNAL void mono_llvm_fixup_aot_module (void);
static gboolean
llvm_init_inner (void)
{
- if (!mono_llvm_load (NULL))
- return FALSE;
-
mono_llvm_init (!mono_compile_aot);
return TRUE;
}
#endif
#ifdef ENABLE_LLVM
- if (mono_use_llvm) {
- if (!mono_llvm_load (NULL)) {
- mono_use_llvm = FALSE;
- fprintf (stderr, "Mono Warning: llvm support could not be loaded.\n");
- }
- }
if (mono_use_llvm)
mono_llvm_init (!mono_compile_aot);
#endif
register_icall (mono_llvm_clear_exception, NULL, TRUE);
register_icall (mono_llvm_load_exception, mono_icall_sig_object, TRUE);
register_icall (mono_llvm_throw_corlib_exception, mono_icall_sig_void_int, TRUE);
-#if defined(ENABLE_LLVM) && !defined(MONO_LLVM_LOADED) && defined(HAVE_UNWIND_H)
+#if defined(ENABLE_LLVM) && defined(HAVE_UNWIND_H)
register_icall (mono_llvm_set_unhandled_exception_handler, NULL, TRUE);
// FIXME: This is broken
g_assert (mini_safepoints_enabled ());
-#ifndef MONO_LLVM_LOADED
if (COMPILE_LLVM (cfg)) {
if (!cfg->llvm_only) {
/* We rely on LLVM's safepoints insertion capabilities. */
return;
}
}
-#endif
if (cfg->method->wrapper_type == MONO_WRAPPER_MANAGED_TO_NATIVE) {
WrapperInfo *info = mono_marshal_get_wrapper_info (cfg->method);
#if !defined(MONO_CROSS_COMPILE)
if (!cfg->compile_aot || cfg->use_current_cpu) {
// detect current CPU features if we are in JIT mode or AOT with use_current_cpu flag.
-#if defined(ENABLE_LLVM) && !defined(MONO_LLVM_LOADED)
+#if defined(ENABLE_LLVM)
features = mono_llvm_get_cpu_features (); // llvm has a nice built-in API to detect features
#elif defined(TARGET_AMD64)
features = mono_arch_get_cpu_features ();
/* GDB puts a breakpoint in this function. */
void MONO_NEVER_INLINE __jit_debug_register_code(void);
-#if !defined(MONO_LLVM_LOADED) && defined(ENABLE_LLVM) && !defined(MONO_CROSS_COMPILE)
+#if defined(ENABLE_LLVM) && !defined(MONO_CROSS_COMPILE)
/* LLVM already defines these */
MCS = $(MCS_NO_LIB)
-if LOADED_LLVM
-LLVMMONOF=
-else
LLVMMONOF=$(LLVM_LIBS) $(LLVM_LDFLAGS)
-endif
glib_libs = $(top_builddir)/mono/eglib/libeglib.la
test-embed.exe: $(top_srcdir)/samples/embed/test.cs
$(MCS) -r:$(CLASS)/System.dll -r:$(CLASS)/System.Xml.dll -r:$(CLASS)/System.Core.dll -out:$@ $<
-
+
test-embed-invoke-cs.exe: $(top_srcdir)/samples/embed/invoke.cs
$(MCS) -r:$(CLASS)/System.dll -r:$(CLASS)/System.Xml.dll -r:$(CLASS)/System.Core.dll -out:$@ $<
#define MONO_RESTORE_WARNING
#endif
-// If MONO_LLVM_INTERNAL changes, update mono_debug_method_lookup_location declaration.
-#if !defined(_MSC_VER) && !defined(HOST_SOLARIS) && !defined(_WIN32) && !defined(__CYGWIN__) && !defined(MONOTOUCH) && HAVE_VISIBILITY_HIDDEN && MONO_LLVM_LOADED
-
-// Normally use this.
-#define MONO_LLVM_INTERNAL MONO_API
-
-// Use these for extern data.
-#define MONO_LLVM_INTERNAL_NO_EXTERN_C MONO_API_NO_EXTERN_C
-#define MONO_LLVM_INTERNAL_EXTERN_C_BEGIN G_BEGIN_DECLS
-#define MONO_LLVM_INTERNAL_EXTERN_C_END G_END_DECLS
-
-#else
#define MONO_LLVM_INTERNAL /* nothing */
#define MONO_LLVM_INTERNAL_NO_EXTERN_C /* nothing */
#define MONO_LLVM_INTERNAL_EXTERN_C_BEGIN /* nothing */
#define MONO_LLVM_INTERNAL_EXTERN_C_END /* nothing */
-#endif
/* Used to mark internal functions used by the profiler modules */
#define MONO_PROFILER_API MONO_API
<ExcludeLLVMFromWindowsBuild Condition="'$(MONO_ENABLE_LLVM)'=='' Or '$(MONO_ENABLE_LLVM)'!='true'">true</ExcludeLLVMFromWindowsBuild>
</PropertyGroup>
<ItemGroup Label="llvm_sources">
- <ClCompile Include="$(MonoSourceLocation)\mono\mini\mini-llvm-loaded.c">
- <ExcludedFromBuild>$(ExcludeLLVMFromWindowsBuild)</ExcludedFromBuild>
- <_MonoLLVMSourceFile>true</_MonoLLVMSourceFile>
- </ClCompile>
<ClCompile Include="$(MonoSourceLocation)\mono\mini\mini-llvm.c">
<ExcludedFromBuild>$(ExcludeLLVMFromWindowsBuild)</ExcludedFromBuild>
<_MonoLLVMSourceFile>true</_MonoLLVMSourceFile>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="llvm_sources">
- <ClCompile Include="$(MonoSourceLocation)\mono\mini\mini-llvm-loaded.c">
- <Filter>Source Files$(MonoMiniFilterSubFolder)\llvm</Filter>
- </ClCompile>
<ClCompile Include="$(MonoSourceLocation)\mono\mini\mini-llvm.c">
<Filter>Source Files$(MonoMiniFilterSubFolder)\llvm</Filter>
</ClCompile>