[x86] Remove some incorrect code from method prologs which clobbers the return value.
authorZoltan Varga <vargaz@gmail.com>
Thu, 16 Mar 2017 22:56:49 +0000 (18:56 -0400)
committerZoltan Varga <vargaz@gmail.com>
Thu, 16 Mar 2017 22:56:54 +0000 (18:56 -0400)
mono/mini/mini-x86.c

index b85c2242c69e8fc7fb8e2b4ddfce4cb25bdcd6ab..83558ea6a091ec3a4d052a3da12ef5670deacbca 100644 (file)
@@ -5262,24 +5262,18 @@ mono_arch_emit_epilog (MonoCompile *cfg)
                /* check if we need to restore protection of the stack after a stack overflow */
                if (!cfg->compile_aot && mono_arch_have_fast_tls () && mono_tls_get_tls_offset (TLS_KEY_JIT_TLS) != -1) {
                        code = mono_x86_emit_tls_get (code, X86_ECX, mono_tls_get_tls_offset (TLS_KEY_JIT_TLS));
-               } else {
-                       gpointer func = mono_tls_get_tls_getter (TLS_KEY_JIT_TLS, TRUE);
-                       /* FIXME use tls only from IR level */
-                       x86_xchg_reg_reg (code, X86_EAX, X86_ECX, 4);
-                       code = emit_call (cfg, code, MONO_PATCH_INFO_INTERNAL_METHOD, func);
-                       x86_xchg_reg_reg (code, X86_EAX, X86_ECX, 4);
-               }
 
-               /* we load the value in a separate instruction: this mechanism may be
-                * used later as a safer way to do thread interruption
-                */
-               x86_mov_reg_membase (code, X86_ECX, X86_ECX, MONO_STRUCT_OFFSET (MonoJitTlsData, restore_stack_prot), 4);
-               x86_alu_reg_imm (code, X86_CMP, X86_ECX, 0);
-               patch = code;
-               x86_branch8 (code, X86_CC_Z, 0, FALSE);
-               /* note that the call trampoline will preserve eax/edx */
-               x86_call_reg (code, X86_ECX);
-               x86_patch (patch, code);
+                       /* we load the value in a separate instruction: this mechanism may be
+                        * used later as a safer way to do thread interruption
+                        */
+                       x86_mov_reg_membase (code, X86_ECX, X86_ECX, MONO_STRUCT_OFFSET (MonoJitTlsData, restore_stack_prot), 4);
+                       x86_alu_reg_imm (code, X86_CMP, X86_ECX, 0);
+                       patch = code;
+                       x86_branch8 (code, X86_CC_Z, 0, FALSE);
+                       /* note that the call trampoline will preserve eax/edx */
+                       x86_call_reg (code, X86_ECX);
+                       x86_patch (patch, code);
+               }
 
                /* restore caller saved regs */
                if (cfg->used_int_regs & (1 << X86_EBX)) {