[runtime] Added MONO_DEBUG=single-imm-size.
[mono.git] / mono / mini / mini-runtime.c
index 264a99cdc6934ca8c05d5d60694acc8829dddc0f..27bc1fb5b2a59b661c9d3fd18dbe882b2a80717f 100644 (file)
@@ -588,7 +588,7 @@ mono_icall_get_wrapper_full (MonoJitICallInfo* callinfo, gboolean do_compile)
        MonoMethod *wrapper;
        gconstpointer trampoline;
        MonoDomain *domain = mono_get_root_domain ();
-       gboolean check_exc = check_for_pending_exc;
+       gboolean check_exc = TRUE;
 
        if (callinfo->wrapper) {
                return callinfo->wrapper;
@@ -653,7 +653,7 @@ mono_dynamic_code_hash_lookup (MonoDomain *domain, MonoMethod *method)
 static void
 register_opcode_emulation (int opcode, const char *name, const char *sigstr, gpointer func, const char *symbol, gboolean no_throw)
 {
-       return mini_register_opcode_emulation (opcode, name, sigstr, func, symbol, no_throw);
+       mini_register_opcode_emulation (opcode, name, sigstr, func, symbol, no_throw);
 }
 
 /*
@@ -1030,6 +1030,7 @@ int
 mini_get_tls_offset (MonoTlsKey key)
 {
        int offset;
+       g_assert (MONO_ARCH_HAVE_TLS_GET);
 
        switch (key) {
        case TLS_KEY_THREAD:
@@ -1173,7 +1174,6 @@ mono_patch_info_hash (gconstpointer data)
        case MONO_PATCH_INFO_CLASS:
        case MONO_PATCH_INFO_IID:
        case MONO_PATCH_INFO_ADJUSTED_IID:
-       case MONO_PATCH_INFO_CLASS_INIT:
        case MONO_PATCH_INFO_METHODCONST:
        case MONO_PATCH_INFO_METHOD:
        case MONO_PATCH_INFO_METHOD_JUMP:
@@ -1458,13 +1458,6 @@ mono_resolve_patch_target (MonoMethod *method, MonoDomain *domain, guint8 *code,
                target = mono_class_vtable (domain, patch_info->data.klass);
                g_assert (target);
                break;
-       case MONO_PATCH_INFO_CLASS_INIT: {
-               MonoVTable *vtable = mono_class_vtable (domain, patch_info->data.klass);
-
-               g_assert (vtable);
-               target = mono_create_class_init_trampoline (vtable);
-               break;
-       }
        case MONO_PATCH_INFO_DELEGATE_TRAMPOLINE: {
                MonoDelegateClassMethodPair *del_tramp = patch_info->data.del_tramp;
 
@@ -2174,10 +2167,11 @@ mono_jit_runtime_invoke (MonoMethod *method, void *obj, void **params, MonoObjec
                                        return NULL;
                                } else {
                                        mono_raise_exception (jit_ex);
+                                       /* coverity[unreachable] */
                                }
                        }
 
-                       info->compiled_method = mini_add_method_trampoline (NULL, callee, info->compiled_method, mono_method_needs_static_rgctx_invoke (callee, FALSE), FALSE);
+                       info->compiled_method = mini_add_method_trampoline (callee, info->compiled_method, mono_method_needs_static_rgctx_invoke (callee, TRUE), FALSE);
                } else {
                        info->compiled_method = NULL;
                }
@@ -2665,6 +2659,8 @@ mini_parse_debug_options (void)
                        debug_options.gen_sdb_seq_points = TRUE;
                else if (!strcmp (arg, "gen-compact-seq-points"))
                        debug_options.gen_seq_points_compact_data = TRUE;
+               else if (!strcmp (arg, "single-imm-size"))
+                       debug_options.single_imm_size = TRUE;
                else if (!strcmp (arg, "init-stacks"))
                        debug_options.init_stacks = TRUE;
                else if (!strcmp (arg, "casts"))
@@ -2673,6 +2669,8 @@ mini_parse_debug_options (void)
                        debug_options.soft_breakpoints = TRUE;
                else if (!strcmp (arg, "check-pinvoke-callconv"))
                        debug_options.check_pinvoke_callconv = TRUE;
+               else if (!strcmp (arg, "arm-use-fallback-tls"))
+                       debug_options.arm_use_fallback_tls = TRUE;
                else if (!strcmp (arg, "debug-domain-unload"))
                        mono_enable_debug_domain_unload (TRUE);
                else if (!strcmp (arg, "partial-sharing"))
@@ -2681,7 +2679,7 @@ mini_parse_debug_options (void)
                        mono_align_small_structs = TRUE;
                else {
                        fprintf (stderr, "Invalid option for the MONO_DEBUG env variable: %s\n", arg);
-                       fprintf (stderr, "Available options: 'handle-sigint', 'keep-delegates', 'reverse-pinvoke-exceptions', 'collect-pagefault-stats', 'break-on-unverified', 'no-gdb-backtrace', 'dont-free-domains', 'suspend-on-sigsegv', 'suspend-on-exception', 'suspend-on-unhandled', 'dyn-runtime-invoke', 'gdb', 'explicit-null-checks', 'init-stacks', 'check-pinvoke-callconv', 'debug-domain-unload', 'partial-sharing', 'align-small-structs'\n");
+                       fprintf (stderr, "Available options: 'handle-sigint', 'keep-delegates', 'reverse-pinvoke-exceptions', 'collect-pagefault-stats', 'break-on-unverified', 'no-gdb-backtrace', 'dont-free-domains', 'suspend-on-sigsegv', 'suspend-on-exception', 'suspend-on-unhandled', 'dyn-runtime-invoke', 'gdb', 'explicit-null-checks', 'init-stacks', 'check-pinvoke-callconv', 'arm-use-fallback-tls', 'debug-domain-unload', 'partial-sharing', 'align-small-structs'\n");
                        exit (1);
                }
        }
@@ -2784,7 +2782,6 @@ mini_create_jit_domain_info (MonoDomain *domain)
 {
        MonoJitDomainInfo *info = g_new0 (MonoJitDomainInfo, 1);
 
-       info->class_init_trampoline_hash = g_hash_table_new (mono_aligned_addr_hash, NULL);
        info->jump_trampoline_hash = g_hash_table_new (mono_aligned_addr_hash, NULL);
        info->jit_trampoline_hash = g_hash_table_new (mono_aligned_addr_hash, NULL);
        info->delegate_trampoline_hash = g_hash_table_new (class_method_pair_hash, class_method_pair_equal);
@@ -2848,7 +2845,6 @@ mini_free_jit_domain_info (MonoDomain *domain)
        }
        if (info->method_code_hash)
                g_hash_table_destroy (info->method_code_hash);
-       g_hash_table_destroy (info->class_init_trampoline_hash);
        g_hash_table_destroy (info->jump_trampoline_hash);
        g_hash_table_destroy (info->jit_trampoline_hash);
        g_hash_table_destroy (info->delegate_trampoline_hash);
@@ -3030,11 +3026,6 @@ mini_init (const char *filename, const char *runtime_version)
 #endif
        mono_threads_install_cleanup (mini_thread_cleanup);
 
-#ifdef MONO_ARCH_HAVE_NOTIFY_PENDING_EXC
-       check_for_pending_exc = FALSE;
-       mono_threads_install_notify_pending_exc ((MonoThreadNotifyPendingExcFunc)mono_arch_notify_pending_exc);
-#endif
-
 #define JIT_TRAMPOLINES_WORK
 #ifdef JIT_TRAMPOLINES_WORK
        mono_install_compile_method (mono_jit_compile_method);
@@ -3229,16 +3220,19 @@ register_icalls (void)
 #endif
 
        register_opcode_emulation (OP_FCONV_TO_U8, "__emul_fconv_to_u8", "ulong double", mono_fconv_u8, "mono_fconv_u8", FALSE);
+       register_opcode_emulation (OP_RCONV_TO_U8, "__emul_rconv_to_u8", "ulong float", mono_rconv_u8, "mono_rconv_u8", FALSE);
        register_opcode_emulation (OP_FCONV_TO_U4, "__emul_fconv_to_u4", "uint32 double", mono_fconv_u4, "mono_fconv_u4", FALSE);
        register_opcode_emulation (OP_FCONV_TO_OVF_I8, "__emul_fconv_to_ovf_i8", "long double", mono_fconv_ovf_i8, "mono_fconv_ovf_i8", FALSE);
        register_opcode_emulation (OP_FCONV_TO_OVF_U8, "__emul_fconv_to_ovf_u8", "ulong double", mono_fconv_ovf_u8, "mono_fconv_ovf_u8", FALSE);
        register_opcode_emulation (OP_RCONV_TO_OVF_I8, "__emul_rconv_to_ovf_i8", "long float", mono_rconv_ovf_i8, "mono_rconv_ovf_i8", FALSE);
        register_opcode_emulation (OP_RCONV_TO_OVF_U8, "__emul_rconv_to_ovf_u8", "ulong float", mono_rconv_ovf_u8, "mono_rconv_ovf_u8", FALSE);
 
+
 #ifdef MONO_ARCH_EMULATE_FCONV_TO_I8
        register_opcode_emulation (OP_FCONV_TO_I8, "__emul_fconv_to_i8", "long double", mono_fconv_i8, "mono_fconv_i8", FALSE);
        register_opcode_emulation (OP_RCONV_TO_I8, "__emul_rconv_to_i8", "long float", mono_rconv_i8, "mono_rconv_i8", FALSE);
 #endif
+
 #ifdef MONO_ARCH_EMULATE_CONV_R8_UN
        register_opcode_emulation (OP_ICONV_TO_R_UN, "__emul_iconv_to_r_un", "double int32", mono_conv_to_r8_un, "mono_conv_to_r8_un", FALSE);
 #endif
@@ -3359,8 +3353,6 @@ register_icalls (void)
        register_icall (mono_fill_method_rgctx, "mono_method_fill_rgctx", "ptr ptr int", FALSE);
 
        register_icall (mono_debugger_agent_user_break, "mono_debugger_agent_user_break", "void", FALSE);
-       register_dyn_icall (mono_create_specific_trampoline (NULL, MONO_TRAMPOLINE_GENERIC_CLASS_INIT, mono_get_root_domain (), NULL),
-                                               "specific_trampoline_generic_class_init", "void", TRUE);
 
 #ifdef TARGET_IOS
        register_icall (pthread_getspecific, "pthread_getspecific", "ptr ptr", TRUE);
@@ -3451,6 +3443,7 @@ mini_cleanup (MonoDomain *domain)
 
 #ifndef MONO_CROSS_COMPILE
        mono_domain_free (domain, TRUE);
+       mono_gc_mutex_cleanup ();
 #endif
 
 #ifdef ENABLE_LLVM