[Ecls-list] DFFI issues

Juan Jose Garcia-Ripoll jjgarcia at users.sourceforge.net
Tue Apr 8 08:32:36 UTC 2008

On Tue, Apr 8, 2008 at 4:08 AM, Waldek Hebisch <hebisch at math.uni.wroc.pl> wrote:
 >  I took a quick look at src/c/arch/ffi_x86_64.d file.
 >  The 'ecl_fficall_execute' function looks like asking for breakage.
 >  Namely, this function contains asm statements which modify registers and
 >  apparently assume that C part will preserve values stored in
 >  registers.  Worse, the asm statement modifies stack pointer
 >  and counts that following C code will work.  AFAICS a small change
 >  to C compiler may break this code -- I would say that this function
 >  should be written in assembler.  As alternative, a "known working"
 >  assembler output could be used for normal build (such output
 >  would be updated only when C part changes).

 Things work and it is based more or less on what gcc righ now
 guarantees. CLISP's fficall, for instance, is coded this way, and
 Ecl's own apply() function was, as well. Of course it would be nice to
 have everything in assembler, but there is not even a portable way to
 write an assembler file these days. asm() statements inside C
 functions should be enough for doing the job. Regarding the C part
 after that, it can also be coded in assembler, but it is not on my
 priority list right now -- remember that the dynamic ffi is optional,
 the static one works and is more portable.


 Facultad de Fisicas, Universidad Complutense,
 Ciudad Universitaria s/n Madrid 28040 (Spain)

More information about the ecl-devel mailing list