This is the mail archive of the
libffi-discuss@sourceware.org
mailing list for the libffi project.
Re: [patch] port libffi to x86/msvc
- From: Dan Witte <dwitte at mozilla dot com>
- To: Timothy Wall <twalljava at dev dot java dot net>
- Cc: libffi-discuss at sourceware dot org
- Date: Wed, 13 Jan 2010 20:17:33 -0800 (PST)
- Subject: Re: [patch] port libffi to x86/msvc
> I haven't looked at the patch yet, but ffi_call_SYSV and
> ffi_call_STDCALL are not identical, since stdcall must pop its own
> args from the stack. I think I originally wrote it to share code
> between two functions, with only a little bit on the ends for stdcall,
>
> but someone added some debug/stack metadata that required the two
> functions be distinct, thus the duplicated code.
Hmm. Both functions save 'esp' on entry, and restore it on exit, so whether the caller or callee pops the args doesn't matter, and both functions can be identical. Is this correct?
(Looking at history, in an older libffi release, they were different and the SYSV variant adjusted 'esp' appropriately after the foreign call. But this was dropped when 'esp' was saved & restored.)
I have no idea what the eh_frame stuff is doing, so if the two functions need to be distinct for that reason, I can produce a new patch. Presumably the functions can still be merged for MSVC, just not for gcc. Should I do that?
Thanks,
Dan.