2010-02-15 Zoltan Varga <vargaz@gmail.com>
[mono.git] / mono / mini / mini-amd64.c
index 68a5a3deb0ddeb270a12e7d401089bd94b446c00..3b2033a7287b0ae8d27c6524afc1d25bc998436e 100644 (file)
@@ -747,10 +747,6 @@ get_call_info (MonoGenericSharingContext *gsctx, MonoMemPool *mp, MonoMethodSign
                        add_general (&gr, &stack_size, &cinfo->sig_cookie);
                }
 
-               if (sig->params [i]->byref) {
-                       add_general (&gr, &stack_size, ainfo);
-                       continue;
-               }
                ptype = mini_type_get_underlying_type (gsctx, sig->params [i]);
                switch (ptype->type) {
                case MONO_TYPE_BOOLEAN:
@@ -2174,17 +2170,15 @@ mono_arch_emit_setret (MonoCompile *cfg, MonoMethod *method, MonoInst *val)
 {
        MonoType *ret = mini_type_get_underlying_type (NULL, mono_method_signature (method)->ret);
 
-       if (!ret->byref) {
-               if (ret->type == MONO_TYPE_R4) {
-                       if (COMPILE_LLVM (cfg))
-                               MONO_EMIT_NEW_UNALU (cfg, OP_FMOVE, cfg->ret->dreg, val->dreg);
-                       else
-                               MONO_EMIT_NEW_UNALU (cfg, OP_AMD64_SET_XMMREG_R4, cfg->ret->dreg, val->dreg);
-                       return;
-               } else if (ret->type == MONO_TYPE_R8) {
+       if (ret->type == MONO_TYPE_R4) {
+               if (COMPILE_LLVM (cfg))
                        MONO_EMIT_NEW_UNALU (cfg, OP_FMOVE, cfg->ret->dreg, val->dreg);
-                       return;
-               }
+               else
+                       MONO_EMIT_NEW_UNALU (cfg, OP_AMD64_SET_XMMREG_R4, cfg->ret->dreg, val->dreg);
+               return;
+       } else if (ret->type == MONO_TYPE_R8) {
+               MONO_EMIT_NEW_UNALU (cfg, OP_FMOVE, cfg->ret->dreg, val->dreg);
+               return;
        }
                        
        MONO_EMIT_NEW_UNALU (cfg, OP_MOVE, cfg->ret->dreg, val->dreg);
@@ -5858,7 +5852,11 @@ mono_arch_emit_prolog (MonoCompile *cfg)
                /* 
                 * The ip field is not set, the exception handling code will obtain it from the stack location pointed to by the sp field.
                 */
-               /* sp is saved right before calls */
+               /* 
+                * sp is saved right before calls but we need to save it here too so
+                * async stack walks would work.
+                */
+               amd64_mov_membase_reg (code, cfg->frame_reg, cfg->arch.lmf_offset + G_STRUCT_OFFSET (MonoLMF, rsp), AMD64_RSP, 8);
                /* Skip method (only needed for trampoline LMF frames) */
                /* Save callee saved regs */
                for (i = 0; i < MONO_MAX_IREGS; ++i) {