raw foregin imports - new backend for jhc: ghc
John Meacham
john at repetae.net
Mon Nov 27 23:26:34 EST 2006
On Fri, Nov 17, 2006 at 05:12:23PM +0000, Simon Peyton-Jones wrote:
> The crash is definitely a bug. The user manual does not claim to allow unboxed tuples in the return type for a foreign call; so GHC should reject the program politely.
>
> You might ask "well, couldn't the above program be accepted?". Perhaps so... but why do you want it. You should find that if you say
> foreign import ccall unsafe getchar :: IO Int
> and then
> do { I# x <- getchar; ...}
> then no boxing occurs. So maybe this new feature isn't reqd. Let us know
okay, I was hoping that ghc would see that I am giving it the unboxed
version right out and not try to unbox/rebox things itself. I thought I
saw this in the standard libraries, but looking through it again, the
cases I was looking at were actually primitives and not foreign imports.
so this isn't a bug.
I will do the boxing myself, which is fine, it would be nice to run ghc
without its optimizer and still not get the superfluous boxing to get a
true test of just how our back-ends compare, but for that kind of
control perhaps I will need to spit out ghc external core anyway.
>
> | the other is
> |
> | where 'global_argc' is a C symbol.
> |
> | > foreign import ccall "&global_argc" argc :: Addr#
>
> What's the problem here? Your mail looks garbled.
yes. sorry about that. I started out asking one question, then decided
to give some background that led to another one.
> Concerning primitive types, Ian will respond in a few days. We're not sure we understand what you want!
At the moment, I don't think I need anything, I was just misreading
certain features. the ghc backend seems to be working fine with the
following caveats:
* all integral types (even Integer) are flattened to Int#.
* ghc -O on my generated programs crashes with the following:
ghc-6.6: panic! (the 'impossible' happened)
(GHC version 6.6 for i386-unknown-linux):
primRepHint:VoidRep
http://repetae.net/john/computer/jhc/stuff/HelloWorld_code.hs
has this behavior when compiled with ghc -O
on another note I have gotten these crashes also, but have been unable
to recreate them:
jhc: internal error: stg_ap_p_ret
(GHC version 6.6 for x86_64_unknown_linux)
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
ghc-6.6: panic! (the 'impossible' happened)
(GHC version 6.6 for i386-unknown-linux):
hptRules
FastMutInt [(Atom, False), (Binary, False), (C.FFI, False),
(Doc.DocLike, False), (Doc.PPrint, False), (FastMutInt, False),
(FrontEnd.SrcLoc, False), (FrontEnd.Tc.Kind, False),
(GenUtil, False), (HsSyn, False), (Name.Name, False),
(Name.Names, False), (Name.Prim, False), (Name.VConsts, False),
(PackedString, False), (Support.CanType, False),
(Support.Unparse, False), (Util.VarName, False)]
John
--
John Meacham - ⑆repetae.net⑆john⑈
More information about the Glasgow-haskell-users
mailing list