Merge remote-tracking branch 'mfoliveira/ppc64el-v2'
[mono.git] / mono / mini / mini.c
index eed5fc02235e98c045fe4ae764be473ae81b00bb..b642073e91ff5d3f86b0febabd82fbe90d58a08f 100755 (executable)
@@ -53,6 +53,7 @@
 #include <mono/utils/mono-math.h>
 #include <mono/utils/mono-compiler.h>
 #include <mono/utils/mono-counters.h>
+#include <mono/utils/mono-error-internals.h>
 #include <mono/utils/mono-logger-internal.h>
 #include <mono/utils/mono-mmap.h>
 #include <mono/utils/mono-path.h>
@@ -710,10 +711,11 @@ G_GNUC_UNUSED gboolean
 mono_debug_count (void)
 {
        static int count = 0;
-       count ++;
        static gboolean inited;
        static const char *value;
 
+       count ++;
+
        if (!inited) {
                value = g_getenv ("COUNT");
                inited = TRUE;
@@ -4123,6 +4125,8 @@ mono_codegen (MonoCompile *cfg)
 
        cfg->code_len = code - cfg->native_code;
        cfg->prolog_end = cfg->code_len;
+       cfg->cfa_reg = cfg->cur_cfa_reg;
+       cfg->cfa_offset = cfg->cur_cfa_offset;
 
        mono_debug_open_method (cfg);
 
@@ -4137,6 +4141,7 @@ mono_codegen (MonoCompile *cfg)
                if (bb == cfg->bb_exit) {
                        cfg->epilog_begin = cfg->code_len;
                        mono_arch_emit_epilog (cfg);
+                       cfg->epilog_end = cfg->code_len;
                }
        }
 
@@ -4645,7 +4650,7 @@ create_jit_info (MonoCompile *cfg, MonoMethod *method_to_compile)
 
                        info = mono_jit_info_get_arch_eh_info (jinfo);
                        g_assert (info);
-                       info->epilog_size = cfg->code_size - cfg->epilog_begin;
+                       info->epilog_size = cfg->code_len - cfg->epilog_begin;
                }
                jinfo->unwind_info = unwind_desc;
                g_free (unwind_info);
@@ -5007,6 +5012,7 @@ mini_method_compile (MonoMethod *method, guint32 opts, MonoDomain *domain, JitFl
 
        if (cfg->gen_seq_points)
                cfg->seq_points = g_ptr_array_new ();
+       mono_error_init (&cfg->error);
 
        if (cfg->compile_aot && !try_generic_shared && (method->is_generic || method->klass->generic_container || method_is_gshared)) {
                cfg->exception_type = MONO_EXCEPTION_GENERIC_SHARING_FAILED;
@@ -5428,7 +5434,7 @@ mini_method_compile (MonoMethod *method, guint32 opts, MonoDomain *domain, JitFl
        */
 
 //#define DEBUGSSA "logic_run"
-#define DEBUGSSA_CLASS "Tests"
+//#define DEBUGSSA_CLASS "Tests"
 #ifdef DEBUGSSA
 
        if (!cfg->disable_ssa) {
@@ -6097,6 +6103,10 @@ mono_jit_compile_method_inner (MonoMethod *method, MonoDomain *target_domain, in
        case MONO_EXCEPTION_OUT_OF_MEMORY:
                ex = mono_domain_get ()->out_of_memory_ex;
                break;
+       case MONO_EXCEPTION_MONO_ERROR:
+               g_assert (!mono_error_ok (&cfg->error));
+               ex = mono_error_convert_to_exception (&cfg->error);
+               break;
        default:
                g_assert_not_reached ();
        }
@@ -6835,7 +6845,7 @@ MONO_SIG_HANDLER_FUNC (, mono_sigsegv_signal_handler)
        if (fault_addr == NULL) {
                MonoContext mctx;
 
-               mono_arch_sigctx_to_monoctx (ctx, &mctx);
+               mono_sigctx_to_monoctx (ctx, &mctx);
 
                fault_addr = MONO_CONTEXT_GET_SP (&mctx);
        }