vcomp: single-threaded implementation of _vcomp_fork (try 6)

Joerg-Cyril.Hoehle at Joerg-Cyril.Hoehle at
Wed Oct 24 05:26:24 CDT 2012


Alexandre Julliard wrote:
> +void WINAPIV _vcomp_fork(BOOL ifval, int nargs, void *wrapper, ...)
> +    __ms_va_list valist;

>it's ugly to use varargs only as a hack to get a pointer to the first

Would taking the address of &wrapper (as in asm("...","r=&wrapper") or
any C code like "void* stack = &wrapper") suffice to tell the x64
compiler to save register parameters into their allocated stack

My belief was that this is specifically the magic performed when the
compiler sees a [__ms_]va_list.

You seem to imply that va_list is superfluous and that
taking the address of any parameter (not necessarily &wrapper
but &ifval or &nargs too) would achieve the same effect: all 4 registers
rcx, rdx, r8 and r9 get saved to the stack such that the & abstraction
works even when the user performs pointer arithmetic.  This is the effect
that Dan Kegel needs for vcomp.

In such a case he would use &wrapper, bypass va_list and correct the
stack-relative offsets in the x86 and x64 assembly code by one pointer unit.

 Jörg Höhle

More information about the wine-devel mailing list