cvs commit: fptools/ghc/compiler/typecheck TcForeign.lhs

Simon Marlow simonmar@microsoft.com
Tue, 11 Sep 2001 13:19:42 +0100


> ken@glass.cse.ogi.edu wrote,
>=20
> > ken         2001/09/06 14:08:17 PDT
> >=20
> >   Modified files:
> >     ghc/compiler/typecheck TcForeign.lhs=20
> >   Log:
> >   Fix the code to *really* do the following:
> >  =20
> >   On the Alpha we can only handle <=3D 4 integer arguments=20
> with foreign export
> >   dynamic.  Following the example of the corresponding=20
> Sparc hack, we detect
> >   when we're being asked to do something we can't and refuse.
>=20
> Hmm, not a very good state of affairs if you ask me.  Any
> idea how to lift this restriction?  Unless we can implement
> f.e.d. (or actually "foreign import wrapper" as it is called
> nowadays) properly on all architectures it doesn't make
> sense to make it part of the FFI definition.

Yes, it can be done.  You have to pass the StablePtr using a register or
some other method that doesn't involve using the C stack, so you can
avoid needing to do any stack shuffling.  I think Ken suggested this a
while back;  Julian + I discussed it and agreed it was the right thing
to do.

It would involve doing a bit of inline assembly in the f.e.d. stub, and
currently these things are plain ISO C.  That's probably not a big
issue.  It would certainly simplify the overally implementation of
f.e.d., though.

Cheers,
	Simon