References to the Rts in unregisterised first build of ghc 6.4
Ian Lynagh
igloo at earth.li
Tue Jun 28 23:47:25 EDT 2005
On Tue, Jun 28, 2005 at 12:14:08PM +0100, Simon Marlow wrote:
> On 27 June 2005 17:53, Michiel Buddingh' wrote:
>
> > Commented out:
> >
> > #if alpha_TARGET_ARCH
> > checkFEDArgs arg_tys
> > = check (integral_args <= 32) err
> > where
> > integral_args = sum [ machRepByteWidth rep
> > | (rep,hint) <- map typeMachRepRep arg_tys,
> > hint /= FloatHint ]
> > err = ptext SLIT("On Alpha, I can only handle 4 non-floating-point
> > arguments
> > to foreign export dynamic")
> >
> > from TcForeign.lhs. typeMachRepRep was nowhere to be found (not in
> > ghc-6.4, or any earlier released version), and I wasn't able to
> > figure out what, exactly, it does. It seemed like an RTS thing, so I
> > decided to comment it out, and the build proceded. Not sure if that
> > was such a wise idea now.
>
> That looks like a sanity check that has bitrotted. You can ignore it
> until you need to get 'foreign import "wrapper"' working.
This works (or at least compiles!) on Linux/Alpha:
--- ghc6-6.4.orig/ghc/compiler/typecheck/TcForeign.lhs
+++ ghc6-6.4/ghc/compiler/typecheck/TcForeign.lhs
@@ -29,8 +29,8 @@
import ErrUtils ( Message )
import Id ( Id, mkLocalId, mkExportedLocalId )
#if alpha_TARGET_ARCH
-import PrimRep ( getPrimRepSize, isFloatingRep )
import Type ( typePrimRep )
+import SMRep ( argMachRep, primRepToCgRep, primRepHint )
#endif
import OccName ( mkForeignExportOcc )
import Name ( Name, NamedThing(..), mkExternalName )
@@ -52,7 +52,7 @@
import Bag ( consBag )
#if alpha_TARGET_ARCH
-import MachOp ( machRepByteWidth )
+import MachOp ( machRepByteWidth, MachHint(FloatHint) )
#endif
\end{code}
@@ -185,10 +185,10 @@
checkFEDArgs arg_tys
= check (integral_args <= 32) err
where
- integral_args = sum [ machRepByteWidth rep
- | (rep,hint) <- map typeMachRepRep arg_tys,
- hint /= FloatHint ]
- err = ptext SLIT("On Alpha, I can only handle 4 non-floating-point arguments to foreign export dynamic")
+ integral_args = sum [ (machRepByteWidth . argMachRep . primRepToCgRep) prim_rep
+ | prim_rep <- map typePrimRep arg_tys,
+ primRepHint prim_rep /= FloatHint ]
+ err = ptext SLIT("On Alpha, I can only handle 32 bytes of non-floating-point arguments to foreign export dynamic")
#else
checkFEDArgs arg_tys = returnM ()
#endif
Thanks
Ian
More information about the Glasgow-haskell-users
mailing list