src/alpha/ffitarget.h - FFI_TRAMPOLINE_SIZE

John E. Malmberg wb8tyw@qsl.net
Thu Apr 16 03:22:00 GMT 2015


I do not have a Tru64 system to test this on.

Looking at the code in src/alpha/ffitarget.h and src/alpha/ffi.c, 
something does not look right.

FFI_TRAMPOLINE_SIZE is set to 24 in ffitarget.h

The typedef struct ffi_closure is then set up in ffi.h as:

typedef struct {
   char tramp{FFI_TRAMPOLINE_SIZE];
   ffi_cif * cif;
   void (*fun)...
   void *user_data
} ffi_closure

In ffi.c ffi_prep_closure_loc(), the code then does:

   tramp = (unsigned int *) &closure->tramp[0];
   ....

    *(void **) &tramp[4] = ffi_closure_osf;

But tramp only has 3 longword members per the previous declaration, so 
&tramp[4] is the address of the '*cif' member of the structure which is 
then updated:

    closure->cif = cif;

Am I understanding this correctly?

Regards,
-John






More information about the Libffi-discuss mailing list