2009-05-26 Atsushi Enomoto <atsushi@ximian.com>
[mono.git] / mono / mini / mini-x86.c
index e226cf4b7315d4bc497a1807759ecd9d0e37dc04..e8239ff80f79a0ba985129bde20dc2e29da42fde 100644 (file)
@@ -1233,26 +1233,15 @@ mono_arch_emit_call (MonoCompile *cfg, MonoCallInst *call)
        }
 
        if (sig->ret && MONO_TYPE_ISSTRUCT (sig->ret)) {
-               MonoInst *vtarg;
-
                if (cinfo->ret.storage == ArgValuetypeInReg) {
-                       if (cinfo->ret.pair_storage [0] == ArgInIReg && cinfo->ret.pair_storage [1] == ArgNone) {
-                               /*
-                                * Tell the JIT to use a more efficient calling convention: call using
-                                * OP_CALL, compute the result location after the call, and save the 
-                                * result there.
-                                */
-                               call->vret_in_reg = TRUE;
-                       } else {
-                               /*
-                                * The valuetype is in EAX:EDX after the call, needs to be copied to
-                                * the stack. Save the address here, so the call instruction can
-                                * access it.
-                                */
-                               MONO_INST_NEW (cfg, vtarg, OP_X86_PUSH);
-                               vtarg->sreg1 = call->vret_var->dreg;
-                               MONO_ADD_INS (cfg->cbb, vtarg);
-                       }
+                       /*
+                        * Tell the JIT to use a more efficient calling convention: call using
+                        * OP_CALL, compute the result location after the call, and save the 
+                        * result there.
+                        */
+                       call->vret_in_reg = TRUE;
+                       if (call->vret_var)
+                               NULLIFY_INS (call->vret_var);
                }
        }
 
@@ -1962,9 +1951,6 @@ mono_emit_stack_alloc (guchar *code, MonoInst* tree)
 static guint8*
 emit_move_return_value (MonoCompile *cfg, MonoInst *ins, guint8 *code)
 {
-       CallInfo *cinfo;
-       int quad;
-
        /* Move return value to the target register */
        switch (ins->opcode) {
        case OP_CALL:
@@ -1973,31 +1959,6 @@ emit_move_return_value (MonoCompile *cfg, MonoInst *ins, guint8 *code)
                if (ins->dreg != X86_EAX)
                        x86_mov_reg_reg (code, ins->dreg, X86_EAX, 4);
                break;
-       case OP_VCALL:
-       case OP_VCALL_REG:
-       case OP_VCALL_MEMBASE:
-       case OP_VCALL2:
-       case OP_VCALL2_REG:
-       case OP_VCALL2_MEMBASE:
-               cinfo = get_call_info (cfg->generic_sharing_context, cfg->mempool, ((MonoCallInst*)ins)->signature, FALSE);
-               if (cinfo->ret.storage == ArgValuetypeInReg) {
-                       /* Pop the destination address from the stack */
-                       x86_pop_reg (code, X86_ECX);
-                       
-                       for (quad = 0; quad < 2; quad ++) {
-                               switch (cinfo->ret.pair_storage [quad]) {
-                               case ArgInIReg:
-                                       g_assert (cinfo->ret.pair_regs [quad] != X86_ECX);
-                                       x86_mov_membase_reg (code, X86_ECX, (quad * sizeof (gpointer)), cinfo->ret.pair_regs [quad], sizeof (gpointer));
-                                       break;
-                               case ArgNone:
-                                       break;
-                               default:
-                                       g_assert_not_reached ();
-                               }
-                       }
-               }
-               break;
        default:
                break;
        }
@@ -3202,6 +3163,10 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
 
                        x86_patch (br, code);
 
+                       /* Change precision */
+                       x86_fst_membase (code, X86_ESP, 0, TRUE, TRUE);
+                       x86_fld_membase (code, X86_ESP, 0, TRUE);
+
                        x86_alu_reg_imm (code, X86_ADD, X86_ESP, 8);
 
                        break;