summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Wibbleswip/T17223-map-coercionSimon Peyton Jones2019-09-242-5/+6
|
* Make mapCoercion zap Refl coercionsSimon Peyton Jones2019-09-235-40/+110
| | | | | | | | | | | | | This is work in progress on issue #17223. The main idea is for `mapCoercion_maybe` to return a `MCoercion` that, in the Refl case, does not have to zonk (or even look at) the type. Insetad, the cast or wrapper simply disappears. There is a lack of comments at the moment. The SOURCE import of Coercion in Type.hs seems to import too much. Mabye moving mapCoercion to Coercion would help?
* gitlab-ci: Fix URL of Windows cabal-install tarballBen Gamari2019-09-231-1/+1
|
* rts: TraverseHeap: Add doc comment for getTraverseStackMaxSizeDaniel Gröber2019-09-221-0/+3
|
* rts: RetainerProfile: Explain retainVisitClosure return valuesDaniel Gröber2019-09-221-3/+3
| | | | [ci skip]
* rts: TraverseHeap: Move stackElement.cp back into nextPos unionDaniel Gröber2019-09-221-6/+7
| | | | | The 'cp' field really is only used when type==posTypeFresh so it's more space efficient to have it in the nextPos union.
* rts: TraverseHeap: Make pushStackElement argument constDaniel Gröber2019-09-221-4/+4
|
* rts: TraverseHeap: Make comment style consistentDaniel Gröber2019-09-222-60/+64
|
* rts: Split heap traversal from retainer profilerDaniel Gröber2019-09-223-1353/+1372
| | | | | This finally moves the newly generalised heap traversal code from the retainer profiler into it's own file.
* rts: RetainerProfile.c: Minimize #includesDaniel Gröber2019-09-221-8/+1
| | | | | A lot of these includes are presumably leftovers from when the retainer profiler still did it's own heap profiling.
* rts: RetainerProfile.c: Re-enable and fix warningsDaniel Gröber2019-09-224-12/+13
| | | | | | Turns out some genius disabled warnings for RetainerProfile.c in the build system. That would have been good to know about five silent type mismatch crashes ago.. :)
* rts: retainer: Improve Note [Profiling heap traversal visited bit]Daniel Gröber2019-09-221-20/+20
|
* rts: retainer: Make visit callback easier to implementDaniel Gröber2019-09-222-17/+25
| | | | | | | | | Currently it is necessary for user code to expend at least one extra bit in the closure header just to know whether visit() should return true or false, to indicate if children should be traversed. The generic traversal code already has this information in the visited bit so simply pass it to the visit callback.
* rts: retainer: Move mut_list reset to generic traversal codeDaniel Gröber2019-09-221-40/+33
|
* rts: retainer: Remove traverse-stack chunk supportDaniel Gröber2019-09-222-46/+7
| | | | | | | | | | | | | | | | | | There's simply no need anymore for this whole business. Instead of individually traversing roots in retainRoot() we just push them all onto the stack and traverse everything in one go. This feature was not really used anyways. There is an `ASSERT(isEmptyWorkStack(ts))` at the top of retainRoot() which means there really can't ever have been any chunks at the toplevel. The only place where this was probably used is in traversePushStack but only way back when we were still using explicit recursion on the C callstack. Since the code was changed to use an explicit traversal-stack these stack-chunks can never escape one call to traversePushStack anymore. See commit 5f1d949ab9 ("Remove explicit recursion in retainer profiling")
* rts: retainer: Move actual 'flip' bit flip to generic traversal codeDaniel Gröber2019-09-221-3/+5
|
* rts: retainer: Update obsolete docs for traverseMaybeInitClosureDataDaniel Gröber2019-09-221-14/+6
|
* rts: retainer: Abstract maxStackSize for generic traversalDaniel Gröber2019-09-222-3/+11
|
* rts: retainer: Move heap traversal declarations to new headerDaniel Gröber2019-09-223-96/+128
|
* rts: retainer: Use global STATIC_INLINE macroDaniel Gröber2019-09-221-25/+18
| | | | | STATIC_INLINE already does what the code wanted here, no need to duplicate the functionality here.
* rts: retainer: Remove outdated invariants on traversePushStackDaniel Gröber2019-09-221-8/+0
| | | | | | These invariants don't seem to make any sense in the current code. The text talks about c_child_r as if it were an StgClosure, for which RSET() would make sense, but it's a retainer aka 'CostCentreStack*'.
* rts: retainer: Cleanup comments and strings for traversal extractionDaniel Gröber2019-09-221-95/+137
| | | | | A lot of comments and strings are still talking about old names, fix that.
* rts: retainer: Reduce DEBUG_RETAINER ifdef noiseDaniel Gröber2019-09-224-69/+39
| | | | | | | | | | Keeping track of the maximum stack seems like a good idea in all configurations. The associated ASSERTs only materialize in debug mode but having the statistic is nice. To make the debug code less prone to bitrotting I introduce a function 'debug()' which doesn't actually print by default and is #define'd away only when the standard DEBUG define is off.
* rts: retainer: Rename heap traversal functions for extractionDaniel Gröber2019-09-223-105/+104
| | | | | This gets all remaining functions in-line with the new 'traverse' prefix and module name.
* rts: retainer: Remove obsolete debug codeDaniel Gröber2019-09-221-330/+1
| | | | | | | Commit dbef766ce7 ("Profiling cleanup.") made this debug code obsolete by removing the 'cost' function without a replacement. As best I can tell the retainer profiler used to do some heap census too and this debug code was mainly concerned with that.
* rts: RetainerSet: Remove obsolete fist/second-approach choiceDaniel Gröber2019-09-223-69/+2
| | | | | | | | | | | | | In the old code when DEBUG_RETAINER was set, FIRST_APPROACH is implied. However ProfHeap.c now depends on printRetainerSetShort which is only available with SECOND_APPROACH. This is because with FIRST_APPROACH retainerProfile() will free all retainer sets before returning so by the time ProfHeap calls dumpCensus the retainer set pointers are segfaulty. Since all of this debugging code obviously hasn't been compiled in ages anyways I'm taking the liberty of just removing it. Remember guys: Dead code is a liability not an asset :)
* rts: Add note reference to SET_PROF_HDR for profiling 'flip' bitDaniel Gröber2019-09-221-0/+2
|
* rts: retainer: simplify pop() control flowDaniel Gröber2019-09-221-33/+38
| | | | | | | | | | | | | | | | | | Instead of breaking out of the switch-in-while construct using `return` this uses `goto out` which makes it possible to share a lot of the out-variable assignment code in all the cases. I also replaced the nasty `while(true)` business by the real loop condition: `while(*c == NULL)`. All `break` calls inside the switch aready have either a check for NULL or an assignment of `c` to NULL so this should not change any behaviour. Using `goto out` also allowed me to remove another minor wart: In the MVAR_*/WEAK cases the popOff() call used to happen before reading the stackElement. This looked like a use-after-free hazard to me as the stack is allocated in blocks and depletion of a block could mean it getting freed and possibly overwritten by zero or garbage, depending on the block allocator's behaviour.
* rts: retainer: Pull retainer specific code into a callbackDaniel Gröber2019-09-221-125/+131
| | | | | | | This essentially turns the heap traversal code into a visitor. You add a bunch of roots to the work-stack and then the callback you give to traverseWorkStack() will be called with every reachable closure at least once.
* rts: GC: Remove redundant #include "RetainerProfiler.h"Daniel Gröber2019-09-221-4/+0
|
* rts: Generalise profiling heap traversal flip bit handlingDaniel Gröber2019-09-224-30/+63
| | | | | | | This commit starts renaming some flip bit related functions for the generalised heap traversal code and adds provitions for sharing the per-closure profiling header field currently used exclusively for retainer profiling with other heap traversal profiling modes.
* rts: retainer: Fix comment typo s/keeps/keep/Daniel Gröber2019-09-221-1/+1
|
* rts: retainer: Generalise per-stackElement dataDaniel Gröber2019-09-221-63/+75
| | | | | | | | | | | | | | | This essentially ammounts to s/retainer/stackData/, s/c_child_r/data/ and some temporary casting of c_child_r to stackData until refactoring of this module is completed by a subsequent commit. We also introduce a new union 'stackData' which will contain the actual extra data to be stored on the stack. The idea is to make the heap traversal logic of the retainer profiler ready for extraction into it's own module. So talking about "retainers" there doesn't really make sense anymore. Essentially the "retainers" we store in the stack are just data associated with the push()ed closures which we return when pop()ing it.
* rts: retainer: Move info.next.parent to stackElementDaniel Gröber2019-09-221-6/+5
| | | | | I don't see a point in having this live in 'info', just seems to make the code more complicated.
* rts: retainer: Turn global traversal state into a structDaniel Gröber2019-09-221-161/+170
| | | | | | | | | | Global state is ugly and hard to test. Since the profiling code isn't quite as performance critical as, say, GC we should prefer better code here. I would like to move the 'flip' bit into the struct too but that's complicated by the fact that the defines which use it directly are also called from ProfHeap where the traversalState is not easily available. Maybe in a future commit.
* rts: Fix outdated references to 'ldvTime'Daniel Gröber2019-09-221-2/+2
| | | | | This got renamed to 'era' in dbef766ce7 ("[project @ 2001-11-26 16:54:21 by simonmar] Profiling cleanup").
* rts: Remove bitrotten retainer debug codeDaniel Gröber2019-09-221-25/+9
| | | | | | | The `defined(DEBUG_RETAINER) == true` branch doesn't even compile anymore because 1) retainerSet was renamed to RetainerSet and 2) even if I fix that the context in Rts.h seems to have changed such that it's not in scope. If 3) I fix that 'flip' is still not in scope :) At that point I just gave up.
* rts: retainer: Remove cStackSize debug counterDaniel Gröber2019-09-223-26/+4
| | | | | This can only ever be one since 5f1d949ab9 ("Remove explicit recursion in retainer profiling"), so it's pointless.
* Fix haddocks for marker events in Debug.TraceAlp Mestanogullari2019-09-211-1/+1
|
* Get rid of PmFakewip/pmcheck-nofakeSebastian Graf2019-09-212-230/+49
| | | | | | | | | | | | | | | | | | | The pattern match oracle can now cope with the abundance of information that ViewPatterns, NPlusKPats, overloaded lists, etc. provide. No need to have PmFake anymore! Also got rid of a spurious call to `allCompleteMatches`, which we used to call *for every constructor* match. Naturally this blows up quadratically for programs like `ManyAlternatives`. ------------------------- Metric Decrease: ManyAlternatives Metric Increase: T11822 -------------------------
* Document MIN_PAYLOAD_SIZE and mark-compact GC mark bitsÖmer Sinan Ağacan2019-09-213-7/+49
| | | | | | | This updates the documentation of the MIN_PAYLOAD_SIZE constant and adds a new Note [Mark bits in mark-compact collector] explaning why the mark-compact collector uses two bits per objet and why we need MIN_PAYLOAD_SIZE.
* PredType for type constraints in the pattern match checker instead of EvVarSebastian Graf2019-09-215-99/+124
| | | | | | | | | | | | | | | | Using EvVars for capturing type constraints implied side-effects in DsM when we just wanted to *construct* type constraints. But giving names to type constraints is only necessary when passing Givens to the type checker, of which the majority of the pattern match checker should be unaware. Thus, we simply generate `newtype TyCt = TyCt PredType`, which are nicely stateless. But at the same time this means we have to allocate EvVars when we want to query the type oracle! So we keep the type oracle state as `newtype TyState = TySt (Bag EvVar)`, which nicely makes a distinction between new, unchecked `TyCt`s and the inert set in `TyState`.
* Fix bogus type of case expressionwip/T17056Simon Peyton Jones2019-09-2013-177/+397
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Issue #17056 revealed that we were sometimes building a case expression whose type field (in the Case constructor) was bogus. Consider a phantom type synonym type S a = Int and we want to form the case expression case x of K (a::*) -> (e :: S a) We must not make the type field of the Case constructor be (S a) because 'a' isn't in scope. We must instead expand the synonym. Changes in this patch: * Expand synonyms in the new function CoreUtils.mkSingleAltCase. * Use mkSingleAltCase in MkCore.wrapFloat, which was the proximate source of the bug (when called by exprIsConApp_maybe) * Use mkSingleAltCase elsewhere * Documentation CoreSyn new invariant (6) in Note [Case expression invariants] CoreSyn Note [Why does Case have a 'Type' field?] CoreUtils Note [Care with the type of a case expression] * I improved Core Lint's error reporting, which was pretty confusing in this case, because it didn't mention that the offending type was the return type of a case expression. * A little bit of cosmetic refactoring in CoreUtils
* Fix PmOracle.addVarCoreCt in-scope setSimon Peyton Jones2019-09-202-4/+10
| | | | | | | | PmOracle.addVarCoreCt was giving a bogus (empty) in-scope set to exprIsConApp_maybe, which resulted in a substitution-invariant failure (see MR !1647 discussion). This patch fixes it, by taking the free vars of the expression.
* Remove pointless partiality in `Parser.ajs`John Ericson2019-09-201-15/+16
|
* Pass -j to ghc-in-ghci CI jobMatthew Pickering2019-09-201-1/+1
|
* Remove trailing whitespaceMatthew Pickering2019-09-201-8/+8
|
* hadrian/ghci.sh: Enable building in parallelMatthew Pickering2019-09-202-1/+9
|
* testsuite: Add test for #17202Ben Gamari2019-09-202-0/+21
|
* Module hierarchy: Hs (#13009)Sylvain Henry2019-09-20136-377/+381
| | | | | | | Add GHC.Hs module hierarchy replacing hsSyn. Metric Increase: haddock.compiler