| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
| |
|
|
|
|
| |
equivalence classes
|
| |
|
| |
|
|
|
|
|
|
| |
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!
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
The Stg Lint failure reported in Trac #3789 were bogus.
This patch fixes STG Lint, which must have been unused
for ages.
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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%
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
Modules that need it import it themselves instead.
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
- 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
|
|
|
|
|
|
| |
- made LneM a newtype instead of a type synonym
- use do, return and standard monad functions
- removed custom versions of monad functions
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
| |
This required moving PackageId from PackageConfig to Module
|
| |
|
| |
|
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|