Re: [patch libffi]: Add thiscall-closure support for fixing regression PR/51500

2012-01-31 Thread Kai Tietz
Revised version of thiscall-trampoline code. ChangeLog 2012-01-31 Kai Tietz * src/prep_cif.c (ffi_prep_cif): Allow for X86_WIN32 also FFI_THISCALL. * src/x86/ffi.c (ffi_closure_THISCALL): Add prototype. (FFI_INIT_TRAMPOLINE_THISCALL): New trampoline code.

Re: [patch libffi]: Add thiscall-closure support for fixing regression PR/51500

2012-01-31 Thread Kai Tietz
2012/1/31 Uros Bizjak : > On Tue, Jan 31, 2012 at 10:51 AM, Kai Tietz wrote: >> Ok, this variant keeps 16-byte alignment for thiscall-closure. > > It doesn't. You have to account for the fact that caller pushed return > address to the stack, so %esp was already decreased by 4 behind your > back. T

Re: [patch libffi]: Add thiscall-closure support for fixing regression PR/51500

2012-01-31 Thread Uros Bizjak
On Tue, Jan 31, 2012 at 10:51 AM, Kai Tietz wrote: > Ok, this variant keeps 16-byte alignment for thiscall-closure. It doesn't. You have to account for the fact that caller pushed return address to the stack, so %esp was already decreased by 4 behind your back. To maintain alignment, you have to

Re: [patch libffi]: Add thiscall-closure support for fixing regression PR/51500

2012-01-31 Thread Kai Tietz
Ok, this variant keeps 16-byte alignment for thiscall-closure. ChangeLog 2012-01-31 Kai Tietz * src/prep_cif.c (ffi_prep_cif): Allow for X86_WIN32 also FFI_THISCALL. * src/x86/ffi.c (ffi_closure_THISCALL): Add prototype. (FFI_INIT_TRAMPOLINE_THISCALL): New tram

Re: [patch libffi]: Add thiscall-closure support for fixing regression PR/51500

2012-01-31 Thread Uros Bizjak
Hello! > this patch adds missing support of the X86_WIN32 calling-convention > for thiscall-closures. ?As thiscall-convention can be only used in C++ > for class-member calls, the assumption that first argument gets passed > in register is always valid. ?As it is either the "this" pointer, or > th