snowleopard / hadrian

Hadrian: a new build system for the Glasgow Haskell Compiler. Now merged into the GHC tree!
https://gitlab.haskell.org/ghc/ghc/tree/master/hadrian
MIT License
209 stars 37 forks source link

Build more variants of profiled runtime systems (normal, threaded, debug, threaded debug, ...) ? #681

Closed alpmestan closed 6 years ago

alpmestan commented 6 years ago

I just saw https://phabricator.haskell.org/D5140 by @osa1 and I suspect we might have to do a similar thing in hadrian. Unless we're already doing this, @snowleopard @angerman ?

snowleopard commented 6 years ago

@alpmestan I don't think we do this. Here are the ways we currently build RTS by default:

https://github.com/snowleopard/hadrian/blob/master/src/Settings/Default.hs#L154-L164

-- | Default build ways for the RTS.
defaultRtsWays :: Ways
defaultRtsWays = do
    ways <- getLibraryWays
    mconcat
        [ pure [ logging, debug, threaded, threadedDebug, threadedLogging ]
        , (profiling `elem` ways) ? pure [threadedProfiling]
        {- , (dynamic `elem` ways) ?
          pure [ dynamic, debugDynamic, threadedDynamic, threadedDebugDynamic
               , loggingDynamic, threadedLoggingDynamic ] -}
        ]
alpmestan commented 6 years ago

Hmm, shouldn't we include the profiling way in that [threadedProfiling] list?

Now, for the issue at hand, we'll also want to add debugProfiling and threadedDebugProfiling I suppose?

snowleopard commented 6 years ago

@alpmestan Yes, I think so. Bear in mind that this list was initially shrunk to "whatever Hadrian can compile now", so it could easily mismatch the one from Make.

Perhaps, we should rename this issue to bringing Hadrian in sync with Make w.r.t. RTS ways.

alpmestan commented 6 years ago

Yes. Do you see any other change we should make besides the one I suggested in my previous comment?

snowleopard commented 6 years ago

No, I don't see any other change. I'm surprised we don't have profiling included into RTS ways now.

alpmestan commented 6 years ago

682 was about the hadrian side of things. Here is the GHC patch that goes with it, necessary to actually produce the new ways (_debug_p, _thr_debug_p): https://phabricator.haskell.org/D5142

With both patches, I get:

$ ls _tmp/stage1/lib/x86_64-linux-ghc-8.7.20180910/rts-1.0/libHSrts*
_tmp/stage1/lib/x86_64-linux-ghc-8.7.20180910/rts-1.0/libHSrts-1.0.a
_tmp/stage1/lib/x86_64-linux-ghc-8.7.20180910/rts-1.0/libHSrts-1.0_debug.a
_tmp/stage1/lib/x86_64-linux-ghc-8.7.20180910/rts-1.0/libHSrts-1.0_debug_p.a
_tmp/stage1/lib/x86_64-linux-ghc-8.7.20180910/rts-1.0/libHSrts-1.0_l.a
_tmp/stage1/lib/x86_64-linux-ghc-8.7.20180910/rts-1.0/libHSrts-1.0_p.a
_tmp/stage1/lib/x86_64-linux-ghc-8.7.20180910/rts-1.0/libHSrts-1.0_thr.a
_tmp/stage1/lib/x86_64-linux-ghc-8.7.20180910/rts-1.0/libHSrts-1.0_thr_debug.a
_tmp/stage1/lib/x86_64-linux-ghc-8.7.20180910/rts-1.0/libHSrts-1.0_thr_debug_p.a
_tmp/stage1/lib/x86_64-linux-ghc-8.7.20180910/rts-1.0/libHSrts-1.0_thr_l.a
_tmp/stage1/lib/x86_64-linux-ghc-8.7.20180910/rts-1.0/libHSrts-1.0_thr_p.a
snowleopard commented 6 years ago

@alpmestan Thank you! Please close this once your patch makes its way to GHC HEAD.

alpmestan commented 6 years ago

Merged.