- call = (MonoCallInst*)ins;
- if (ins->flags & MONO_INST_HAS_METHOD)
- code = emit_call (cfg, code, MONO_PATCH_INFO_METHOD, call->method);
- else
- code = emit_call (cfg, code, MONO_PATCH_INFO_ABS, call->fptr);
- ins->flags |= MONO_INST_GC_CALLSITE;
- ins->backend.pc_offset = code - cfg->native_code;
- if (call->stack_usage && !CALLCONV_IS_STDCALL (call->signature)) {
- /* a pop is one byte, while an add reg, imm is 3. So if there are 4 or 8
- * bytes to pop, we want to use pops. GCC does this (note it won't happen
- * for P4 or i686 because gcc will avoid using pop push at all. But we aren't
- * smart enough to do that optimization yet
- *
- * It turns out that on my P4, doing two pops for 8 bytes on the stack makes
- * mcs botstrap slow down. However, doing 1 pop for 4 bytes creates a small,
- * (most likely from locality benefits). People with other processors should
- * check on theirs to see what happens.
- */
- if (call->stack_usage == 4) {
- /* we want to use registers that won't get used soon, so use
- * ecx, as eax will get allocated first. edx is used by long calls,
- * so we can't use that.
- */
-
- x86_pop_reg (code, X86_ECX);
- } else {
- x86_alu_reg_imm (code, X86_ADD, X86_ESP, call->stack_usage);
- }
- }
- code = emit_move_return_value (cfg, ins, code);
- break;