#endif
/* Version number of the AOT file format */
-#define MONO_AOT_FILE_VERSION 121
+#define MONO_AOT_FILE_VERSION 124
//TODO: This is x86/amd64 specific.
#define mono_simd_shuffle_mask(a,b,c,d) ((a) | ((b) << 2) | ((c) << 4) | ((d) << 6))
MONO_AOT_FILE_FLAG_FULL_AOT = 2,
MONO_AOT_FILE_FLAG_DEBUG = 4,
MONO_AOT_FILE_FLAG_LLVM_THUMB = 8,
+ MONO_AOT_FILE_FLAG_LLVM_ONLY = 16,
} MonoAotFileFlags;
/* This structure is stored in the AOT file */
gpointer llvm_got;
/* Mono EH Frame created by llc when using LLVM */
gpointer mono_eh_frame;
+ /* Points to the get_method () function in the LLVM image or NULL */
+ gpointer llvm_get_method;
+ /* Points to the get_unbox_tramp () function in the LLVM image or NULL */
+ gpointer llvm_get_unbox_tramp;
gpointer jit_code_start;
gpointer jit_code_end;
gpointer method_addresses;
guint32 double_align, long_align, generic_tramp_num;
/* The page size used by trampoline pages */
guint32 tramp_page_size;
-
+ /*
+ * The number of GOT entries which need to be preinitialized when the
+ * module is loaded.
+ */
+ guint32 nshared_got_entries;
/* Arrays */
/* Number of trampolines */
guint32 num_trampolines [MONO_AOT_TRAMP_NUM];
{
MonoClass *klass;
MonoMethod *method;
- gboolean virtual;
+ gboolean is_virtual;
} MonoDelegateClassMethodPair;
/* Per-domain information maintained by the JIT */
MonoCodeManager *code_mp;
} MonoJitDynamicMethodInfo;
+/* An extension of MonoGenericParamFull used in generic sharing */
+typedef struct {
+ MonoGenericParamFull param;
+ MonoGenericParam *parent;
+} MonoGSharedGenericParam;
+
#define domain_jit_info(domain) ((MonoJitDomainInfo*)((domain)->runtime_info))
/* Contains a list of ips which needs to be patched when a method is compiled */
extern int mono_exc_esp_offset;
extern gboolean mono_compile_aot;
extern gboolean mono_aot_only;
+extern gboolean mono_llvm_only;
extern MonoAotMode mono_aot_mode;
extern MonoMethodDesc *mono_inject_async_exc_method;
extern int mono_inject_async_exc_pos;
guint has_call_handler : 1;
/* Whenever this bblock starts a try block */
guint try_start : 1;
+
+#ifdef ENABLE_LLVM
+ /* The offset of the CIL instruction in this bblock which ends a try block */
+ intptr_t try_end;
+#endif
+
/*
* If this is set, extend the try range started by this bblock by an arch specific
* number of bytes to encompass the end of the previous bblock (e.g. a Monitor.Enter
gconstpointer fptr;
guint stack_usage;
guint stack_align_amount;
- guint virtual : 1;
+ guint is_virtual : 1;
guint tail_call : 1;
/* If this is TRUE, 'fptr' points to a MonoJumpInfo instead of an address. */
guint fptr_is_patch : 1;
* Stores if we need to run a chained exception in Windows.
*/
gboolean mono_win_chained_exception_needs_run;
+
+ /*
+ * The current exception in flight
+ */
+ guint32 thrown_exc;
} MonoJitTlsData;
/*
/* Whenever to compile with LLVM */
JIT_FLAG_LLVM = (1 << 3),
/* Whenever to disable direct calls to direct calls to icall functions */
- JIT_FLAG_NO_DIRECT_ICALLS = (1 << 4)
+ JIT_FLAG_NO_DIRECT_ICALLS = (1 << 4),
+ /* Emit explicit null checks */
+ JIT_FLAG_EXPLICIT_NULL_CHECKS = (1 << 5),
+ /* Whenever to compile in llvm-only mode */
+ JIT_FLAG_LLVM_ONLY = (1 << 6),
} JitFlags;
/* Bit-fields in the MonoBasicBlock.region */
guint gshared : 1;
guint gsharedvt : 1;
guint r4fp : 1;
+ guint llvm_only : 1;
+ guint need_got_var : 1;
+ guint have_card_table_wb : 1;
+ guint have_op_generic_class_init : 1;
+ guint emulate_mul_div : 1;
+ guint emulate_div : 1;
+ guint emulate_long_shift_opts : 1;
+ guint have_objc_get_selector : 1;
+ guint have_generalized_imt_thunk : 1;
+ guint have_tls_get : 1;
+ guint have_liverange_ops: 1;
+ guint gshared_supported : 1;
+ guint use_fpstack : 1;
int r4_stack_type;
gpointer debug_info;
guint32 lmf_offset;
*/
gboolean gen_sdb_seq_points;
gboolean gen_seq_points_compact_data;
+ /*
+ * Setting single_imm_size should guarantee that each time managed code is compiled
+ * the same instructions and registers are used, regardless of the size of used values.
+ */
+ gboolean single_imm_size;
gboolean explicit_null_checks;
/*
* Fill stack frames with 0x2a in method prologs. This helps with the
* Check for pinvoke calling convention mismatches.
*/
gboolean check_pinvoke_callconv;
+ /*
+ * Translate Debugger.Break () into a native breakpoint signal
+ */
+ gboolean native_debugger_break;
} MonoDebugOptions;
enum {
void mono_add_var_location (MonoCompile *cfg, MonoInst *var, gboolean is_reg, int reg, int offset, int from, int to);
MonoInst* mono_emit_jit_icall (MonoCompile *cfg, gconstpointer func, MonoInst **args);
MonoInst* mono_emit_jit_icall_by_info (MonoCompile *cfg, MonoJitICallInfo *info, MonoInst **args);
-MonoInst* mono_emit_method_call (MonoCompile *cfg, MonoMethod *method, MonoInst **args, MonoInst *this);
+MonoInst* mono_emit_method_call (MonoCompile *cfg, MonoMethod *method, MonoInst **args, MonoInst *this_ins);
void mono_create_helper_signatures (void);
gboolean mini_class_is_system_array (MonoClass *klass);
guint32 mono_aot_method_hash (MonoMethod *method);
MonoMethod* mono_aot_get_array_helper_from_wrapper (MonoMethod *method);
guint32 mono_aot_get_got_offset (MonoJumpInfo *ji) MONO_LLVM_INTERNAL;
+gboolean mono_aot_is_shared_got_offset (int offset) MONO_LLVM_INTERNAL;
char* mono_aot_get_method_name (MonoCompile *cfg) MONO_LLVM_INTERNAL;
gboolean mono_aot_is_direct_callable (MonoJumpInfo *patch_info) MONO_LLVM_INTERNAL;
void mono_aot_mark_unused_llvm_plt_entry(MonoJumpInfo *patch_info) MONO_LLVM_INTERNAL;
void mono_aot_register_jit_icall (const char *name, gpointer addr);
void* mono_aot_readonly_field_override (MonoClassField *field);
guint32 mono_aot_find_method_index (MonoMethod *method);
+void mono_aot_init_llvm_method (gpointer aot_module, guint32 method_index);
+void mono_aot_init_gshared_method_this (gpointer aot_module, guint32 method_index, MonoObject *this_ins);
+void mono_aot_init_gshared_method_rgctx (gpointer aot_module, guint32 method_index, MonoMethodRuntimeGenericContext *rgctx);
/* This is an exported function */
MONO_API void mono_aot_register_globals (gpointer *globals);
void mono_llvm_cleanup (void) MONO_LLVM_INTERNAL;
void mono_llvm_emit_method (MonoCompile *cfg) MONO_LLVM_INTERNAL;
void mono_llvm_emit_call (MonoCompile *cfg, MonoCallInst *call) MONO_LLVM_INTERNAL;
-void mono_llvm_create_aot_module (MonoAssembly *assembly, const char *global_prefix, gboolean emit_dwarf, gboolean static_link) MONO_LLVM_INTERNAL;
+void mono_llvm_create_aot_module (MonoAssembly *assembly, const char *global_prefix, gboolean emit_dwarf, gboolean static_link, gboolean llvm_only) MONO_LLVM_INTERNAL;
void mono_llvm_emit_aot_module (const char *filename, const char *cu_name) MONO_LLVM_INTERNAL;
void mono_llvm_emit_aot_file_info (MonoAotFileInfo *info, gboolean has_jitted_code) MONO_LLVM_INTERNAL;
void mono_llvm_emit_aot_data (const char *symbol, guint8 *data, int data_len) MONO_LLVM_INTERNAL;
void mono_llvm_free_domain_info (MonoDomain *domain) MONO_LLVM_INTERNAL;
MONO_API void mono_personality (void);
int mono_llvm_load (const char* bpath);
+void mono_llvm_rethrow_exception (MonoObject *ex);
+void mono_llvm_throw_exception (MonoObject *ex);
+void mono_llvm_throw_corlib_exception (guint32 ex_token_index);
+void mono_llvm_resume_exception (void);
+gint32 mono_llvm_match_exception (MonoJitInfo *jinfo, guint32 region_start, guint32 region_end);
+void mono_llvm_clear_exception (void);
+MonoObject *mono_llvm_load_exception (void);
+void mono_llvm_reset_exception (void);
+void mono_llvm_raise_exception (MonoException *e);
gboolean mini_llvm_init (void);
MonoReflectionMethod **method,
gint32 *iloffset, gint32 *native_offset,
MonoString **file, gint32 *line, gint32 *column);
-MonoString *ves_icall_System_Exception_get_trace (MonoException *exc);
void mono_set_cast_details (MonoClass *from, MonoClass *to);
/* Installs a function which is called when the runtime encounters an unhandled exception.
mono_set_partial_sharing_supported (gboolean supported);
gboolean
-mono_class_generic_sharing_enabled (MonoClass *class);
+mono_class_generic_sharing_enabled (MonoClass *klass);
gpointer
mono_class_fill_runtime_generic_context (MonoVTable *class_vtable, guint32 slot);
mono_generic_context_check_used (MonoGenericContext *context);
int
-mono_class_check_context_used (MonoClass *class);
+mono_class_check_context_used (MonoClass *klass);
gboolean
mono_generic_context_is_sharable (MonoGenericContext *context, gboolean allow_type_vars);
void mono_generic_sharing_init (void);
void mono_generic_sharing_cleanup (void);
-MonoClass* mini_class_get_container_class (MonoClass *class);
-MonoGenericContext* mini_class_get_context (MonoClass *class);
+MonoClass* mini_class_get_container_class (MonoClass *klass);
+MonoGenericContext* mini_class_get_context (MonoClass *klass);
MonoType* mini_get_underlying_type (MonoType *type) MONO_LLVM_INTERNAL;
MonoType* mini_type_get_underlying_type (MonoType *type);
MonoMethod* mini_get_shared_method (MonoMethod *method);
MonoMethod* mini_get_shared_method_to_register (MonoMethod *method);
MonoMethod* mini_get_shared_method_full (MonoMethod *method, gboolean all_vt, gboolean is_gsharedvt);
+MonoType* mini_get_shared_gparam (MonoType *t, MonoType *constraint);
int mini_get_rgctx_entry_slot (MonoJumpInfoRgctxEntry *entry);
int mini_type_stack_size (MonoType *t, int *align);