summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* 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
* users guide: Fix link to let generalization blog postBen Gamari2019-09-191-1/+2
| | | | Fixes #17200.
* ErrUtils: split withTiming into withTiming and withTimingSilentAlp Mestanogullari2019-09-197-36/+89
| | | | | | | | | | | | | | | | | | | 'withTiming' becomes a function that, when passed '-vN' (N >= 2) or '-ddump-timings', will print timing (and possibly allocations) related information. When additionally built with '-eventlog' and executed with '+RTS -l', 'withTiming' will also emit both 'traceMarker' and 'traceEvent' events to the eventlog. 'withTimingSilent' on the other hand will never print any timing information, under any circumstance, and will only emit 'traceEvent' events to the eventlog. As pointed out in !1672, 'traceMarker' is better suited for things that we might want to visualize in tools like eventlog2html, while 'traceEvent' is better suited for internal events that occur a lot more often and that we don't necessarily want to visualize. This addresses #17138 by using 'withTimingSilent' for all the codegen bits that are expressed as a bunch of small computations over streams of codegen ASTs.
* testsuite: Add testcase for #17206Ben Gamari2019-09-193-0/+19
|
* Add a regression test for #11822Sebastian Graf2019-09-193-4/+54
| | | | | The particular test is already fixed, but the issue seems to have multiple different test cases lumped together.
* Extract PmTypes module from PmExpr and PmOracleSebastian Graf2019-09-198-270/+264
| | | | | | | | | | | Apparently ghc-lib-parser's API blew up because the newly induced cyclic dependency between TcRnTypes and PmOracle pulled in the other half of GHC into the relevant strongly-connected component. This patch arranges it so that PmTypes exposes mostly data type definitions and type class instances to be used within PmOracle, without importing the any of the possibly offending modules DsMonad, TcSimplify and FamInst.
* CoreUtils: Use mightBeUnliftedType in exprIsTopLevelBindableBen Gamari2019-09-192-2/+6
| | | | Also add reference from isUnliftedType to mightBeUnliftedType.
* Test #17077.Richard Eisenberg2019-09-193-0/+14
|
* Use level numbers for generalisationRichard Eisenberg2019-09-1912-247/+208
| | | | | | | | This fixes #15809, and is covered in Note [Use level numbers for quantification] in TcMType. This patch removes the "global tyvars" from the environment, a nice little win.
* Refactor kindGeneralize and friendsRichard Eisenberg2019-09-199-224/+280
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit should have no change in behavior.(*) The observation was that Note [Recipe for checking a signature] says that every metavariable in a type-checked type must either (A) be generalized (B) be promoted (C) be zapped. Yet the code paths for doing these were all somewhat separate. This led to some steps being skipped. This commit shores this all up. The key innovation is TcHsType.kindGeneralizeSome, with appropriate commentary. This commit also sets the stage for #15809, by turning the WARNing about bad level-numbers in generalisation into an ASSERTion. The actual fix for #15809 will be in a separate commit. Other changes: * zonkPromoteType is now replaced by kindGeneralizeNone. This might have a small performance degradation, because zonkPromoteType zonked and promoted all at once. The new code path promotes first, and then zonks. * A call to kindGeneralizeNone was added in tcHsPartialSigType. I think this was a lurking bug, because it did not follow Note [Recipe for checking a signature]. I did not try to come up with an example showing the bug. This is the (*) above. Because of this change, there is an error message regression in partial-sigs/should_fail/T14040a. This problem isn't really a direct result of this refactoring, but is a symptom of something deeper. See #16775, which addresses the deeper problem. * I added a short-cut to quantifyTyVars, in case there's nothing to quantify. * There was a horribly-outdated Note that wasn't referred to. Gone now. * While poking around with T14040a, I discovered a small mistake in the Coercion.simplifyArgsWorker. Easy to fix, happily. * See new Note [Free vars in coercion hole] in TcMType. Previously, we were doing the wrong thing when looking at a coercion hole in the gather-candidates algorithm. Fixed now, with lengthy explanation. Metric Decrease: T14683
* Simplify: Lazy pattern matchBen Gamari2019-09-191-1/+5
|
* Add a missing update of sc_hole_ty (#16312)Simon Peyton Jones2019-09-193-1/+20
| | | | | | | | | | | In simplCast I totally failed to keep the sc_hole_ty field of ApplyToTy (see Note [The hole type in ApplyToTy]) up to date. When a cast goes by, of course the hole type changes. Amazingly this has not bitten us before, but #16312 finally triggered it. Fortunately the fix is simple. Fixes #16312.
* Deduplicate `HaskellMachRegs.h` and `RtsMachRegs.h` headersJohn Ericson2019-09-176-74/+7
| | | | | | | Until 0472f0f6a92395d478e9644c0dbd12948518099f there was a meaningful host vs target distinction (though it wasn't used right, in genapply). After that, they did not differ in meaningful ways, so it's best to just only keep one.
* Improve error message for out-of-scope variables + VTASimon Peyton Jones2019-09-176-13/+55
| | | | | | | | | | As #13834 and #17150 report, we get a TERRIBLE error message when you have an out of scope variable applied in a visible type application: (outOfScope @Int True) This very simple patch improves matters. See TcExpr Note [VTA for out-of-scope functions]
* Comments onlySimon Peyton Jones2019-09-171-2/+2
|
* Fix #13571 by adding an extension flag checkRichard Eisenberg2019-09-179-3/+38
| | | | Test case: indexed-types/should_fail/T13571
* eventlog: Add biographical and retainer profiling tracesMatthew Pickering2019-09-1710-5/+83
| | | | | | | | | | This patch adds a new eventlog event which indicates the start of a biographical profiler sample. These are different to normal events as they also include the timestamp of when the census took place. This is because the LDV profiler only emits samples at the end of the run. Now all the different profiling modes emit consumable events to the eventlog.
* Encode shape information in `PmOracle`Sebastian Graf2019-09-1673-2582/+3885
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, we had an elaborate mechanism for selecting the warnings to generate in the presence of different `COMPLETE` matching groups that, albeit finely-tuned, produced wrong results from an end user's perspective in some cases (#13363). The underlying issue is that at the point where the `ConVar` case has to commit to a particular `COMPLETE` group, there's not enough information to do so and the status quo was to just enumerate all possible complete sets nondeterministically. The `getResult` function would then pick the outcome according to metrics defined in accordance to the user's guide. But crucially, it lacked knowledge about the order in which affected clauses appear, leading to the surprising behavior in #13363. In !1010 we taught the term oracle to reason about literal values a variable can certainly not take on. This MR extends that idea to `ConLike`s and thereby fixes #13363: Instead of committing to a particular `COMPLETE` group in the `ConVar` case, we now split off the matching constructor incrementally and record the newly covered case as a refutable shape in the oracle. Whenever the set of refutable shapes covers any `COMPLETE` set, the oracle recognises vacuosity of the uncovered set. This patch goes a step further: Since at this point the information in value abstractions is merely a cut down representation of what the oracle knows, value abstractions degenerate to a single `Id`, the semantics of which is determined by the oracle state `Delta`. Value vectors become lists of `[Id]` given meaning to by a single `Delta`, value set abstractions (of which the uncovered set is an instance) correspond to a union of `Delta`s which instantiate the same `[Id]` (akin to models of formula). Fixes #11528 #13021, #13363, #13965, #14059, #14253, #14851, #15753, #17096, #17149 ------------------------- Metric Decrease: ManyAlternatives T11195 -------------------------
* Allow validation with Hadrian built with Stack [skip ci]Sylvain Henry2019-09-161-3/+18
|
* Fix Hadrian build with Stack (#17189)Sylvain Henry2019-09-151-7/+1
| | | | Broken by 2b37a79d61e9b3787873dc9f7458ef2bde4809b0
* Rename GHC.StgToCmm.Con -> GHC.StgToCmm.DataConBen Gamari2019-09-155-6/+6
| | | | | | | | | Incredibly, Windows disallows the manipulation of any file matching Con(\..*)?. The `GHC.StgToCmm.Con` was introduced in the renamings in 447864a9, breaking the Windows build. Work around this by renaming it to `GHC.StgToCmm.DataCon` Fixes #17187.
* Fix CONLIKE typotaylorfausak2019-09-141-1/+1
|
* Add predicates for testing if IOError is ResourceVanished.Andrew Martin2019-09-132-0/+29
| | | | | This adds isResourceVanished, resourceVanishedErrorType, and isResourceVanishedErrorType to System.IO.Error, resolving #14730.
* Remove empty NCG.hJohn Ericson2019-09-1315-27/+0
|