summaryrefslogtreecommitdiff
path: root/compiler/stgSyn
Commit message (Collapse)AuthorAgeFilesLines
* The final batch of changes for the new coercion representationSimon Peyton Jones2011-05-121-2/+3
| | | | | | | | | | | | | | | | | | | | | | * Fix bugs in the packing and unpacking of data constructors with equality predicates in their types * Remove PredCo altogether; instead, coercions between predicated types (like (Eq a, [a]~b) => blah) are treated as if they were precisely their underlying representation type Eq a -> ((~) [a] b) -> blah in this case * Similarly, Type.coreView no longer treats equality predciates specially. * Implement the cast-of-coercion optimisation in Simplify.simplCoercionF Numerous other small bug-fixes and refactorings. Annoyingly, OptCoercion had Windows line endings, and this patch switches to Unix, so it looks as if every line has changed.
* This BIG PATCH contains most of the work for the New Coercion RepresentationSimon Peyton Jones2011-04-192-5/+29
| | | | | | | | | | | | | | See the paper "Practical aspects of evidence based compilation in System FC" * Coercion becomes a data type, distinct from Type * Coercions become value-level things, rather than type-level things, (although the value is zero bits wide, like the State token) A consequence is that a coerion abstraction increases the arity by 1 (just like a dictionary abstraction) * There is a new constructor in CoreExpr, namely Coercion, to inject coercions into terms
* Add a comment on why some seq's are doneIan Lynagh2010-10-211-0/+2
|
* Midstream changes to deal with spontaneous solving and flatten skolem ↵dimitris@microsoft.com2010-10-191-1/+1
| | | | equivalence classes
* Evaluate the results in coreToStgAppIan Lynagh2010-10-191-5/+7
|
* Retab CoreToStg, and remove trailing whitespaceIan Lynagh2010-10-191-418/+418
|
* Avoid ASSERT black holesimonpj@microsoft.com2010-09-231-1/+5
| | | | | | When this ASSERT tripped in CoreToStg it tried to print out too much, which tripped the asssertion again. Result: an infinite loop with no output at all. Hard to debug!
* Fix an ASSERT failure with profilingsimonpj@microsoft.com2010-09-222-33/+36
| | | | | | | | | | | | | | | | | | | | | | The problem arose with this kind of thing x = (,) (scc "blah" Nothing) Then 'x' is marked NoCafRefs by CoreTidy, becuase it has arity 1, and doesn't mention any caffy things. That in turns means that CorePrep must not float out the sat binding to give sat = scc "blah" Nothing x = (,) sat Rather we must generate x = \eta. let sat = scc "blah" Nothing in (,) sat eta URGH! This Caf stuff is such a mess.
* Super-monster patch implementing the new typechecker -- at lastsimonpj@microsoft.com2010-09-131-2/+2
| | | | | | | | | This major patch implements the new OutsideIn constraint solving algorithm in the typecheker, following our JFP paper "Modular type inference with local assumptions". Done with major help from Dimitrios Vytiniotis and Brent Yorgey.
* Fix bugs in STG Lintsimonpj@microsoft.com2010-01-041-18/+13
| | | | | | The Stg Lint failure reported in Trac #3789 were bogus. This patch fixes STG Lint, which must have been unused for ages.
* Refactor PackageTarget back into StaticTargetBen.Lippmeier@anu.edu.au2010-01-041-1/+1
|
* Tag ForeignCalls with the package they correspond toBen.Lippmeier@anu.edu.au2010-01-021-5/+10
|
* Add Outputable.blankLine and use itsimonpj@microsoft.com2009-10-291-1/+1
|
* Fix Trac #959: a long-standing bug in instantiating otherwise-unbound type ↵simonpj@microsoft.com2009-10-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | variables DO NOT MERGE TO GHC 6.12 branch (Reason: interface file format change.) The typechecker needs to instantiate otherwise-unconstraint type variables to an appropriately-kinded constant type, but we didn't have a supply of arbitrarily-kinded tycons for this purpose. Now we do. The details are described in Note [Any types] in TysPrim. The fundamental change is that there is a new sort of TyCon, namely AnyTyCon, defined in TyCon. Ter's a small change to interface-file binary format, because the new AnyTyCons have to be serialised. I tided up the handling of uniques a bit too, so that mkUnique is not exported, so that we can see all the different name spaces in one module.
* Remove unused importsIan Lynagh2009-07-071-1/+1
|
* Support for -fwarn-unused-do-bind and -fwarn-wrong-do-bind, as per #3263Max Bolingbroke2009-07-011-1/+1
|
* Add PrimCall to the STG layer and update Core -> STG translationDuncan Coutts2009-06-092-1/+11
| | | | | | | | | | It adds a third case to StgOp which already hold StgPrimOp and StgFCallOp. The code generation for the new StgPrimCallOp case is almost exactly the same as for out-of-line primops. They now share the tailCallPrim function. In the Core -> STG translation we map foreign calls using the "prim" calling convention to the StgPrimCallOp case. This is because in Core we represent prim calls using the ForeignCall stuff. At the STG level however the prim calls are really much more like primops than foreign calls.
* Rewrite CorePrep and improve eta expansionsimonpj@microsoft.com2009-01-131-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch does two main things a) Rewrite most of CorePrep to be much easier to understand (I hope!). The invariants established by CorePrep are now written out, and the code is more perspicuous. It is surpringly hard to get right, and the old code had become quite incomprehensible. b) Rewrite the eta-expander so that it does a bit of simplifying on-the-fly, and thereby guarantees to maintain the CorePrep invariants. This make it much easier to use from CorePrep, and is a generally good thing anyway. A couple of pieces of re-structuring: * I moved the eta-expander and arity analysis stuff into a new module coreSyn/CoreArity. Max will find that the type CoreArity.EtaInfo looks strangely familiar. * I moved a bunch of comments from Simplify to OccurAnal; that's why it looks as though there's a lot of lines changed in those modules. On the way I fixed various things - Function arguments are eta expanded f (map g) ===> let s = \x. map g x in f s - Trac #2368 The result is a modest performance gain, I think mainly due to the first of these changes: -------------------------------------------------------------------------------- Program Size Allocs Runtime Elapsed -------------------------------------------------------------------------------- Min -1.0% -17.4% -19.1% -46.4% Max +0.3% +0.5% +5.4% +53.8% Geometric Mean -0.1% -0.3% -7.0% -10.2%
* Make record selectors into ordinary functionssimonpj@microsoft.com2009-01-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This biggish patch addresses Trac #2670. The main effect is to make record selectors into ordinary functions, whose unfoldings appear in interface files, in contrast to their previous existence as magic "implicit Ids". This means that the usual machinery of optimisation, analysis, and inlining applies to them, which was failing before when the selector was somewhat complicated. (Which it can be when strictness annotations, unboxing annotations, and GADTs are involved.) The change involves the following points * Changes in Var.lhs to the representation of Var. Now a LocalId can have an IdDetails as well as a GlobalId. In particular, the information that an Id is a record selector is kept in the IdDetails. While compiling the current module, the record selector *must* be a LocalId, so that it participates properly in compilation (free variables etc). This led me to change the (hidden) representation of Var, so that there is now only one constructor for Id, not two. * The IdDetails is persisted into interface files, so that an importing module can see which Ids are records selectors. * In TcTyClDecls, we generate the record-selector bindings in renamed, but not typechecked form. In this way, we can get the typechecker to add all the types and so on, which is jolly helpful especially when GADTs or type families are involved. Just like derived instance declarations. This is the big new chunk of 180 lines of code (much of which is commentary). A call to the same function, mkAuxBinds, is needed in TcInstDcls for associated types. * The typechecker therefore has to pin the correct IdDetails on to the record selector, when it typechecks it. There was a neat way to do this, by adding a new sort of signature to HsBinds.Sig, namely IdSig. This contains an Id (with the correct Name, Type, and IdDetails); the type checker uses it as the binder for the final binding. This worked out rather easily. * Record selectors are no longer "implicit ids", which entails changes to IfaceSyn.ifaceDeclSubBndrs HscTypes.implicitTyThings TidyPgm.getImplicitBinds (These three functions must agree.) * MkId.mkRecordSelectorId is deleted entirely, some 300+ lines (incl comments) of very error prone code. Happy days. * A TyCon no longer contains the list of record selectors: algTcSelIds is gone The renamer is unaffected, including the way that import and export of record selectors is handled. Other small things * IfaceSyn.ifaceDeclSubBndrs had a fragile test for whether a data constructor had a wrapper. I've replaced that with an explicit flag in the interface file. More robust I hope. * I renamed isIdVar to isId, which touched a few otherwise-unrelated files.
* Add assertion for arity match (checks Trac #2844)simonpj@microsoft.com2008-12-081-15/+39
| | | | | | | | | | The exported arity of a function must match the arity for the STG function. Trac #2844 was a pretty obscure manifestation of the failure of this invariant. This patch doesn't cure the bug; rather it adds an assertion to CoreToStg to check the invariant so we should get an earlier and less obscure warning if this fails in future.
* Make CoreToStg a little more robust to eta expansionsimonpj@microsoft.com2008-12-051-0/+7
|
* Split the Id related functions out from Var into Id, document Var and some of IdMax Bolingbroke2008-07-312-3/+2
|
* Make StgLint warning-freeIan Lynagh2008-05-041-12/+13
|
* Make CoreToStg warning-freeIan Lynagh2008-05-041-47/+39
|
* Fix buildIan Lynagh2008-04-221-0/+2
|
* (F)SLIT -> (f)sLit in CoreToStgIan Lynagh2008-04-121-3/+3
|
* (F)SLIT -> (f)sLit in StgLintIan Lynagh2008-04-121-23/+21
|
* (F)SLIT -> (f)sLit in StSynIan Lynagh2008-04-121-35/+33
|
* Remove static flag opt_RuntimeTypes (has not been used in years)simonpj@microsoft.com2008-04-222-28/+16
|
* Ensure that arity is accurate in back endsimonpj@microsoft.com2008-04-101-1/+1
| | | | | | | | | | | | | | | | | | | | | See Note [exprArity invariant] in CoreUtils. In code generated by Happy I was seeing this after TidyPgm and CorePrep f :: Any f {arity 1} = id `cast` unsafe-co So f claimed to have arity 1 (because exprArity looked inside), but did not have any top-level lambdas (because its type is Any). This triggered a slightly-obscure ASSERT failure in CoreToStg This patch - makes exprArity trim the arity if the type is not a function - adds a stronger ASSERT in TidyPgm It's not the only way to solve this problem (see Note [exprArity invariant]) but it's enough for now.
* Don't import FastString in HsVersions.hIan Lynagh2008-03-293-0/+3
| | | | Modules that need it import it themselves instead.
* Remove an #ifdef DEBUGIan Lynagh2008-03-291-5/+2
|
* Fix most of the warnings in StgLintIan Lynagh2008-02-201-9/+9
|
* WhitespaceIan Lynagh2008-02-201-109/+110
|
* Fixed warnings in stgSyn/StgSynTwan van Laarhoven2008-01-261-20/+23
|
* Monadify stgSyn/StgLintTwan van Laarhoven2008-01-171-162/+128
| | | | | | | | - made LintM a newtype instead of a type synonym - use do, return and standard monad functions - use MaybeT where `thenMaybeL` was used - removed custom versions of monad functions
* Monadify stgSyn/CoreToStgTwan van Laarhoven2008-01-171-161/+137
| | | | | | - made LneM a newtype instead of a type synonym - use do, return and standard monad functions - removed custom versions of monad functions
* Fix Trac #1981: seq on a type-family-typed expressionsimonpj@microsoft.com2007-12-211-9/+15
| | | | | | | | | | We were crashing when we saw case x of DEFAULT -> rhs where x had a type-family type. This patch fixes it. MERGE to the 6.8 branch.
* Eliminate over-zealous warning in CoreToStgsimonpj@microsoft.com2007-10-161-2/+8
|
* refactoring only: use the parameterised InstalledPackageInfoSimon Marlow2007-10-032-3/+2
| | | | This required moving PackageId from PackageConfig to Module
* Make various assertions work when !DEBUGIan Lynagh2007-09-081-4/+0
|
* Fix CodingStyle#Warnings URLsIan Lynagh2007-09-043-3/+3
|
* Use OPTIONS rather than OPTIONS_GHC for pragmasIan Lynagh2007-09-033-6/+6
| | | | | | | Older GHCs can't parse OPTIONS_GHC. This also changes the URL referenced for the -w options from WorkingConventions#Warnings to CodingStyle#Warnings for the compiler modules.
* Add {-# OPTIONS_GHC -w #-} and some blurb to all compiler modulesIan Lynagh2007-09-013-0/+21
|
* Comments only: explain why StgConApp is still usefulsimonpj@microsoft.com2007-08-051-0/+2
|
* Warning fix for unused and redundant importsMichael D. Adams2007-05-101-1/+0
|
* FIX print020: conversion of case expressions of type 'Any' was wrongSimon Marlow2007-05-071-2/+3
| | | | | | | All primitive types were getting PrimAlts, where actually case expressions on 'Any' should get a PolyAlt. The result was that seq on Any compiled into a no-op, which caused :force to go into an infinite loop.
* TickBox representation changeandy@galois.com2006-11-291-10/+4
| | | | | | | | | | | | | | | | | | | | | | | | | This changes the internal representation of TickBoxes, from Note (TickBox "module" n) <expr> into case tick<module,n> of _ -> <expr> tick has type :: #State #World, when the module and tick numbe are stored inside IdInfo. Binary tick boxes change from Note (BinaryTickBox "module" t f) <expr> into btick<module,t,f> <expr> btick has type :: Bool -> Bool, with the module and tick number stored inside IdInfo.
* Comment out deeply suspicious (and unused) function insertStableSymbolsimonpj@microsoft.com2006-11-071-0/+15
| | | | | | | | | | | The function insertStableSymbol looks utterly wrong, because it coerces a value of type 'a' to an Addr#! That was in turn making the code generator get confused (now improved), but since insertStableSymbol isn't used at all, I'm just commenting it out. Meanwhile, this patch also enhances CoreToStg to report the most egregious cases where an unsafe coerce is going to confuse the code generator.
* Layout and comments onlysimonpj@microsoft.com2006-11-072-5/+5
|