summaryrefslogtreecommitdiff
path: root/ghc/compiler/codeGen
Commit message (Collapse)AuthorAgeFilesLines
* [project @ 1999-11-02 15:05:38 by simonmar]simonmar1999-11-023-10/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit adds in the current state of our SMP support. Notably, this allows the new way 's' to be built, providing support for running multiple Haskell threads simultaneously on top of any pthreads implementation, the idea being to take advantage of commodity SMP boxes. Don't expect to get much of a speedup yet; due to the excessive locking required to synchronise access to mutable heap objects, you'll see a slowdown in most cases, even on a UP machine. The best I've seen is a 1.6-1.7 speedup on an example that did no locking (two optimised nfibs in parallel). - new RTS -N flag specifies how many pthreads to start. - new driver -smp flag, tells the driver to use way 's'. - new compiler -fsmp option (not for user comsumption) tells the compiler not to generate direct jumps to thunk entry code. - largely rewritten scheduler - _ccall_GC is now done by handing back a "token" to the RTS before executing the ccall; it should now be possible to execute blocking ccalls in the current thread while allowing the RTS to continue running Haskell threads as normal. - you can only call thread-safe C libraries from a way 's' build, of course. Pthread support is still incomplete, and weird things (including deadlocks) are likely to happen.
* [project @ 1999-11-01 17:09:54 by simonpj]simonpj1999-11-013-10/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A regrettably-gigantic commit that puts in place what Simon PJ has been up to for the last month or so, on and off. The basic idea was to restore unfoldings to *occurrences* of variables without introducing a space leak. I wanted to make sure things improved relative to 4.04, and that proved depressingly hard. On the way I discovered several quite serious bugs in the simplifier. Here's a summary of what's gone on. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * No commas between for-alls in RULES. This makes the for-alls have the same syntax as in types. * Arrange that simplConArgs works in one less pass than before. This exposed a bug: a bogus call to completeBeta. * Add a top-level flag in CoreUnfolding, used in callSiteInline * Extend w/w to use etaExpandArity, so it does eta/coerce expansion * Implement inline phases. The meaning of the inline pragmas is described in CoreUnfold.lhs. You can say things like {#- INLINE 2 build #-} to mean "inline build in phase 2" * Don't float anything out of an INLINE. Don't float things to top level unless they also escape a value lambda. [see comments with SetLevels.lvlMFE Without at least one of these changes, I found that {-# INLINE concat #-} concat = __inline (/\a -> foldr (++) []) was getting floated to concat = __inline( /\a -> lvl a ) lvl = ...inlined version of foldr... Subsequently I found that not floating constants out of an INLINE gave really bad code like __inline (let x = e in \y -> ...) so I now let things float out of INLINE * Implement the "reverse-mapping" idea for CSE; actually it turned out to be easier to implement it in SetLevels, and may benefit full laziness too. * It's a good idea to inline inRange. Consider index (l,h) i = case inRange (l,h) i of True -> l+i False -> error inRange itself isn't strict in h, but if it't inlined then 'index' *does* become strict in h. Interesting! * Big change to the way unfoldings and occurrence info is propagated in the simplifier The plan is described in Subst.lhs with the Subst type Occurrence info is now in a separate IdInfo field than user pragmas * I found that (coerce T (coerce S (\x.e))) y didn't simplify in one round. First we get to (\x.e) y and only then do the beta. Solution: cancel the coerces in the continuation * Amazingly, CoreUnfold wasn't counting the cost of a function an application. * Disable rules in initial simplifier run. Otherwise full laziness doesn't get a chance to lift out a MFE before a rule (e.g. fusion) zaps it. queens is a case in point * Improve float-out stuff significantly. The big change is that if we have \x -> ... /\a -> ...let p = ..a.. in let q = ...p... where p's rhs doesn't x, we abstract a from p, so that we can get p past x. (We did that before.) But we also substitute (p a) for p in q, and then we can do the same thing for q. (We didn't do that, so q got stuck.) This is much better. It involves doing a substitution "as we go" in SetLevels, though.
* [project @ 1999-10-25 13:20:57 by sof]sof1999-10-251-1/+9
| | | | | | | FFI wibble: * disallow the use of {Mutable}ByteArrays in 'safe' foreign imports. * ensure that ForeignObjs live across a _ccall_GC_.
* [project @ 1999-10-13 16:39:10 by simonmar]simonmar1999-10-135-48/+108
| | | | | | | Crude allocation-counting extension to ticky-ticky profiling. Allocations are counted against the closest lexically enclosing function closure, so you need to map the output back to the STG code.
* [project @ 1999-09-14 12:16:36 by simonmar]simonmar1999-09-141-0/+4
| | | | | | | | A couple of fixes and cleanups to ticky-ticky profiling: - remove UPD_EXISTING (doesn't make sense) - add UPD_CON_IN_PLACE, now that we have in-place updates - clean up the output a little.
* [project @ 1999-07-14 14:40:20 by simonpj]simonpj1999-07-141-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Main things: * Add splitProductType_maybe to DataCon.lhs, with type splitProductType_maybe :: Type -- A product type, perhaps -> Maybe (TyCon, -- The type constructor [Type], -- Type args of the tycon DataCon, -- The data constructor [Type]) -- Its *representation* arg types Then use it in many places (e.g. worker-wrapper places) instead of a pile of junk * Clean up various uses of dataConArgTys, which were plain wrong because they weren't passed the existential type arguments. Most of these calls are eliminated by using splitProductType_maybe above. I hope I correctly squashed the others. This fixes a bug that Meurig's programs showed up. module FailGHC (killSustainer) where import Weak import IOExts data Sustainer = forall a . Sustainer (IORef (Maybe a)) (IO ()) killSustainer :: Sustainer -> IO () killSustainer (Sustainer _ act) = act The above program used to kill the compiler. * A fairly concerted attack on the Dreaded Space Leak. - Add Type.seqType, CoreSyn.seqExpr, CoreSyn.seqRules - Add some seq'ing when building Ids and IdInfos These reduce the space usage a lot - Add CoreSyn.coreBindsSize, which is pretty strict in the program, and call it when we have -dshow-passes. - Do not put the inlining in an Id that is being plugged into the result-expression of the simplifier. This cures a the 'wedge' in the space profile for reasons I don't understand fully Together, these things reduce the max space usage when compiling PrelNum from 17M to about 7Mbytes. I think there are now *too many* seqs, and they waste work, but I don't have time to find which ones. Furthermore, we aren't done. For some reason, some of the stuff allocated by the simplifier makes it through all during code generation and I don't see why. There's a should-be-unnecessary call to coreBindsSize in Main.main which zaps some, but not all of this space. -dshow-passes reduces space usage a bit, but I don't think it should really. All the measurements were made on a compiler compiled with profiling by GHC 3.03. I hope they carry over to other builds! * One trivial thing: changed all variables 'label' to 'lbl', becuase the former is a keyword with -fglagow-exts in GHC 3.03 (which I was compiling with). Something similar in StringBuffer.
* [project @ 1999-07-14 13:23:51 by simonmar]simonmar1999-07-141-1/+1
| | | | Update to match CgUsages.hi-boot-5
* [project @ 1999-06-28 16:29:45 by simonpj]simonpj1999-06-282-6/+6
| | | | | | | | | | | | | | * Add Type.repType * Re-express splitRepTyConApp_maybe using repType * Use the new repType in Core2Stg The bug was that we ended up with a binding like let x = /\a -> 3# +# y in ... and this should turn into an STG case, but the big lambda fooled the core-to-STG pass
* [project @ 1999-06-28 10:04:18 by simonmar]simonmar1999-06-281-22/+27
| | | | | Jump to the join point when returning a new constructor to a bind default. Fixes: recent panic in mkStaticAlgReturnCode.
* [project @ 1999-06-24 13:04:13 by simonmar]simonmar1999-06-248-63/+126
| | | | | | - Implement update-in-place in certain very specialised circumstances - Clean up abstract C a bit - Speed up pretty-printing absC a bit.
* [project @ 1999-06-22 07:59:54 by simonpj]simonpj1999-06-222-4/+7
| | | | Many small tuning changes
* [project @ 1999-06-09 14:28:37 by simonmar]simonmar1999-06-097-81/+83
| | | | | Move some code around to reduce the linkage between CgMonad and CgBindery, and make the .hi-boot-5 file compatible with both 4.02 and 4.03.
* [project @ 1999-06-09 14:27:38 by simonmar]simonmar1999-06-091-3/+1
| | | | Remove debugging trace that sneaked in.
* [project @ 1999-06-09 10:42:14 by simonmar]simonmar1999-06-091-1/+1
| | | | | Use ClosureInfo.hi-boot instead of ClosureInfo.hi (which might not be built yet).
* [project @ 1999-06-08 16:06:04 by simonmar]simonmar1999-06-081-41/+15
| | | | Update the comment for buildLivenessMask to match reality.
* [project @ 1999-06-08 15:56:44 by simonmar]simonmar1999-06-089-133/+151
| | | | | | | Allow reserving of stack slots for non-pointer data (eg. cost centres). This means the previous hacks to keep the stack bitmaps correct in the presence of cost centres are now unnecessary, and case-of-case expressions will be compiled properly with profiling on.
* [project @ 1999-06-07 16:53:08 by simonmar]simonmar1999-06-071-3/+3
| | | | Existential constructors NEVER WORKED! You were JUST IMAGINING IT!
* [project @ 1999-05-28 19:24:26 by simonpj]simonpj1999-05-281-4/+11
| | | | | | | Enable rules for simplification of SeqOp Fix a related bug in WwLib that made it look as if the binder in a case expression was being demanded, when it wasn't.
* [project @ 1999-05-26 14:12:07 by simonmar]simonmar1999-05-263-3/+6
| | | | Several bugfixes (from SLPJ's tree).
* [project @ 1999-05-18 15:03:33 by simonpj]simonpj1999-05-188-119/+97
| | | | RULES-NOTES
* [project @ 1999-05-13 17:30:50 by simonm]simonm1999-05-137-39/+57
| | | | | | | | | | | | | Support for "unregisterised" builds. An unregisterised build doesn't use the assembly mangler, doesn't do tail jumping (uses the mini-interpreter), and doesn't use global register variables. Plenty of cleanups and bugfixes in the process. Add way 'u' to GhcLibWays to get unregisterised libs & RTS. [ note: not *quite* working fully yet... there's still a bug or two lurking ]
* [project @ 1999-05-11 16:44:02 by keithw]keithw1999-05-112-58/+88
| | | | | | | | | | | | | | | (this is number 7 of 9 commits to be applied together) The code generator now incorporates the update avoidance optimisation: a thunk of __o type is now made SingleEntry rather than Updatable. We want to verify that SingleEntry thunks are indeed entered at most once. In order to do this, -ticky turns on eager blackholing. Ordinary thunks will be dealt with by the RTS, but CAFs are blackholed by the code generator. We blackhole with new blackholes: SE_CAF_BLACKHOLE. We will enter one of these if we attempt to enter a SingleEntry thunk twice.
* [project @ 1999-05-07 13:44:00 by simonm]simonm1999-05-071-9/+11
| | | | | | Fix bug in tagToEnum#: if the amode of the tag overlapped with node, bogus code would be generated. Now load the tag into a temporary before doing the table lookup.
* [project @ 1999-04-27 12:34:49 by simonm]simonm1999-04-271-98/+62
| | | | | | | | | | | | | | | | | - Fix the tagToEnum# support in the code generator - Make isDeadBinder work on case binders - Fix compiling of case x `op` y of z { True -> ... z ... False -> ... z ... - Clean up CgCase a little. - Don't generate specialised tag2con functions for derived Enum/Ix instances; use tagToEnum# instead.
* [project @ 1999-04-26 16:06:27 by simonm]simonm1999-04-261-3/+9
| | | | | | | | | | | | | | - New Wired-in Id: getTag# :: a -> Int# for a data type, returns the tag of the constructor. for a function, returns a spurious number probably. dataToTag# is the name of the underlying primitive which pulls out the tag (its argument is assumed to be evaluated). - Generate constructor tables for enumerated types, so we can do tagToEnum#. - Remove hacks in CoreToStg for dataToTag#.
* [project @ 1999-04-23 13:53:28 by simonm]simonm1999-04-233-37/+64
| | | | | | | | | | | | | | Support for dataToTag# :: a -> Int# (if a is a data type) and (partial) support for tagToEnum# :: Int# -> a (if a is an enumerated type) The con2tag functions generated by derived Eq,Ord and Enum instances are now replaced by dataToTag# for data types with a large number of constructors.
* [project @ 1999-04-23 09:51:24 by simonm]simonm1999-04-231-6/+1
| | | | | Remove hack to force setting the CCCS when we enter a function closure defined inside a lambda. We use a more general solution now.
* [project @ 1999-04-08 15:46:12 by simonm]simonm1999-04-081-20/+24
| | | | | | | | | | | | Profiling fixes: Function closures which are inside a lambda now *set* the CCCS, instead of possibly appending to it. In Simplify.lhs: allow inlining imported functions when profiling. What we really want to do is allow any top-level binding to be inlined, but there doesn't seem to be an easy way to tell whether a binding is top-level or not.
* [project @ 1999-03-26 10:29:02 by simonm]simonm1999-03-261-3/+6
| | | | More profiling fixes.
* [project @ 1999-03-25 13:13:51 by simonm]simonm1999-03-251-3/+3
| | | | | | | | | | | Profiling fixes. - top-level CAF CCSs now *append* themselves to the current CCS when called. - remove DICT stuff. - fixes to the auto-scc annotating in the desugarer.
* [project @ 1999-03-22 16:58:19 by simonm]simonm1999-03-222-11/+15
| | | | Fix cost centres on PAPs.
* [project @ 1999-03-22 16:57:10 by simonm]simonm1999-03-222-4/+6
| | | | Previous commit broke let-no-escape. Fix it up again.
* [project @ 1999-03-22 12:59:32 by simonm]simonm1999-03-221-22/+27
| | | | Fix cost centre restores for unboxed tuple alternatives.
* [project @ 1999-03-11 11:32:22 by simonm]simonm1999-03-115-79/+114
| | | | | Save a few bytes by ommitting the static link field on closures with an empty SRT.
* [project @ 1999-03-08 17:05:41 by simonm]simonm1999-03-081-2/+2
| | | | Fix bug in mkRegLiveness causing bogus heap checks to be generated on the Sparc.
* [project @ 1999-03-04 17:52:08 by simonm]simonm1999-03-041-7/+13
| | | | | | Top-level non-updatable thunks get closure type FUN_STATIC, not THUNK_STATIC. (helps the garbage collector decide where the static link field should be).
* [project @ 1999-03-02 16:09:28 by simonm]simonm1999-03-021-6/+5
| | | | Add missing default case to mkRegLiveness.
* [project @ 1999-03-02 14:34:33 by sof]sof1999-03-024-69/+36
| | | | | | | | | | | | | - import list tweaks - moved the code that decides that a StgCon really shouldn't be mapped to a static constructor but an updateable thunk if it contains lit-lits from the codegen into the CoreToStg translation. Added an extra case to this code to deal with StgCon's that contain references to values that reside in a DLL, where we also have to opt for an updateable thunk instead of a static constructor. Only applies when compiling on/for Win32 platforms.
* [project @ 1999-03-01 17:41:21 by simonm]simonm1999-03-011-16/+61
| | | | Some native codegen updates.
* [project @ 1999-01-27 16:54:18 by simonpj]simonpj1999-01-271-4/+7
| | | | Undo bogus fix to CgCase.lhs
* [project @ 1999-01-27 14:51:14 by simonpj]simonpj1999-01-272-11/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Finally! This commits the ongoing saga of Simon's hygiene sweep FUNCTIONALITY ~~~~~~~~~~~~~ a) The 'unused variable' warnings from the renamer work. b) Better error messages here and there, esp type checker c) Fixities for Haskell 98 (maybe I'd done that before) d) Lazy reporting of name clashes for Haskell 98 (ditto) HYGIENE ~~~~~~~ a) type OccName has its own module. OccNames are represented by a single FastString, not three as in the last round. This string is held in Z-encoded form; a decoding function decodes for printing in user error messages. There's a nice tight encoding for (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) b) type Module is a proper ADT, in module OccName c) type RdrName is a proper ADT, in its own module d) type Name has a new, somwhat tidier, representation e) much grunting in the renamer to get Provenances right. This makes error messages look better (no spurious qualifiers)
* [project @ 1999-01-26 16:16:19 by simonm]simonm1999-01-263-26/+57
| | | | | - Add specialised closure types (CONSTR_p_n, THUNK_p_n, FUN_p_n) - Add -T<n> RTS flag to specify the number of steps in younger generations.
* [project @ 1999-01-22 10:45:21 by simonm]simonm1999-01-221-9/+12
| | | | Fix more uses of [n..m]
* [project @ 1999-01-22 10:10:41 by simonm]simonm1999-01-221-4/+5
| | | | Fix two uses of [ e1 .. e2 ] in light of the new Haskell 98 semantics.
* [project @ 1999-01-21 10:31:41 by simonm]simonm1999-01-214-34/+17
| | | | | Resurrect ticky-ticky profiling. Not quite polished yet, but it compiles and produces some reasonable-looking stats.
* [project @ 1999-01-18 14:31:50 by sof]sof1999-01-181-7/+6
| | | | long long support: cleared up Real vs. virtual regs. confusion (I hope!)
* [project @ 1999-01-15 15:57:33 by simonm]simonm1999-01-151-3/+3
| | | | Haskell 98 updates.
* [project @ 1999-01-14 17:58:41 by sof]sof1999-01-141-11/+26
| | | | | | | | | | | | | | | | | | | | | | | | Assorted minor Haskell 98 changes: * Maximal munch rule for "--" comments * _ as lower-case letter, "_" is a reserved id. Prefixing unused variable names in patterns with '_' causes the renamer not to report such names as being unused. * allow empty decls * comprehensions are now list comprehensions, not monadic. * use Monad.fail to signal pattern matching errors within do expressions. * remove record punning. * empty contexts are now legal (go wild!) * allow records with no fields * allow newtypes with a labelled field * default default is now (Integer, Double) * turn off defaulting mechanism for args & res to a _ccall_. * allow LHSs of the form (a -.- b) x = ... * Main.main can now have type (IO a) * nuked Void (and its use in the compiler sources.) * deriving machinery for Enum now also generate 'succ' and 'pred' method bindings.
* [project @ 1999-01-06 15:55:03 by simonm]simonm1999-01-061-2/+3
| | | | Sort unboxed slots - part of the fix for large bitmaps.
* [project @ 1999-01-06 11:35:27 by simonm]simonm1999-01-061-2/+2
| | | | trim import