summaryrefslogtreecommitdiff
path: root/compiler/codeGen/StgCmmClosure.hs
Commit message (Collapse)AuthorAgeFilesLines
* Add LANGUAGE pragmas to compiler/ source filesHerbert Valerio Riedel2014-05-151-2/+2
| | | | | | | | | | | | | | | | | | In some cases, the layout of the LANGUAGE/OPTIONS_GHC lines has been reorganized, while following the convention, to - place `{-# LANGUAGE #-}` pragmas at the top of the source file, before any `{-# OPTIONS_GHC #-}`-lines. - Moreover, if the list of language extensions fit into a single `{-# LANGUAGE ... -#}`-line (shorter than 80 characters), keep it on one line. Otherwise split into `{-# LANGUAGE ... -#}`-lines for each individual language extension. In both cases, try to keep the enumeration alphabetically ordered. (The latter layout is preferable as it's more diff-friendly) While at it, this also replaces obsolete `{-# OPTIONS ... #-}` pragma occurences by `{-# OPTIONS_GHC ... #-}` pragmas.
* Fix a bug in codegen for non-updatable selector thunks (#8817)Simon Marlow2014-02-271-23/+35
| | | | | | | To evaluate most non-updatable thunks, we can jump directly to the entry code if we know what it is. But not for a selector thunk: these might be updated by the garbage collector, so we have to enter the closure with an indirect jump through its info pointer.
* Remove the LFBlackHole constructorPatrick Palka2013-12-051-27/+0
| | | | After commit 55c703b8fdb0, this code is no longer used anywhere.
* Move isVoidRep, isGcPtrRep to TyCon to join primRepSizeW etcSimon Peyton Jones2013-11-221-9/+2
| | | | This is just a modest refactoring
* Add flag to control loopificationJan Stolarek2013-09-181-2/+3
| | | | | It is off by default, which is meant to be a workaround for #8275. Once #8275 is fixed we will enable this option by default.
* Optimize self-recursive tail callsJan Stolarek2013-08-291-32/+78
| | | | | | | | | | | | | | | | | | | | | | This patch implements loopification optimization. It was described in "Low-level code optimisations in the Glasgow Haskell Compiler" by Krzysztof Woś, but we use a different approach here. Krzysztof's approach was to perform optimization as a Cmm-to-Cmm pass. Our approach is to generate properly optimized tail calls in the code generator, which saves us the trouble of processing Cmm. This idea was proposed by Simon Marlow. Implementation details are explained in Note [Self-recursive tail calls]. Performance of most nofib benchmarks is not affected. There are some benchmarks that show 5-7% improvement, with an average improvement of 2.6%. It would require some further investigation to check if this is related to benchamrking noise or does this optimization really help make some class of programs faster. As a minor cleanup, this patch renames forkProc to forkLneBody. It also moves some data declarations from StgCmmMonad to StgCmmClosure, because they are needed there and it seems that StgCmmClosure is on top of the whole StgCmm* hierarchy.
* Whitespaces and comment formattingJan Stolarek2013-08-291-19/+18
|
* Trailing whitespaces, code formatting, detabifyJan Stolarek2013-08-201-250/+243
| | | | | A major cleanup of trailing whitespaces and tabs in codeGen/ directory. I also adjusted code formatting in some places.
* Fix typosGabor Greif2013-06-251-2/+2
|
* Make noteMustPointToIt true of all non-top-level thunksSimon Peyton Jones2013-06-251-23/+44
| | | | See Note [GC recovery]. To come: clean-up of StgCmmBind.cgRhs.
* Fix many ASSERT uses under Clang.Austin Seipp2013-06-181-1/+1
| | | | | | Clang doesn't like whitespace between macro and arguments. Signed-off-by: Austin Seipp <aseipp@pobox.com>
* ticky enhancementsNicolas Frisby2013-03-291-4/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * the new StgCmmArgRep module breaks a dependency cycle; I also untabified it, but made no real changes * updated the documentation in the wiki and change the user guide to point there * moved the allocation enters for ticky and CCS to after the heap check * I left LDV where it was, which was before the heap check at least once, since I have no idea what it is * standardized all (active?) ticky alloc totals to bytes * in order to avoid double counting StgCmmLayout.adjustHpBackwards no longer bumps ALLOC_HEAP_ctr * I resurrected the SLOW_CALL counters * the new module StgCmmArgRep breaks cyclic dependency between Layout and Ticky (which the SLOW_CALL counters cause) * renamed them SLOW_CALL_fast_<pattern> and VERY_SLOW_CALL * added ALLOC_RTS_ctr and _tot ticky counters * eg allocation by Storage.c:allocate or a BUILD_PAP in stg_ap_*_info * resurrected ticky counters for ALLOC_THK, ALLOC_PAP, and ALLOC_PRIM * added -ticky and -DTICKY_TICKY in ways.mk for debug ways * added a ticky counter for total LNE entries * new flags for ticky: -ticky-allocd -ticky-dyn-thunk -ticky-LNE * all off by default * -ticky-allocd: tracks allocation *of* closure in addition to allocation *by* that closure * -ticky-dyn-thunk tracks dynamic thunks as if they were functions * -ticky-LNE tracks LNEs as if they were functions * updated the ticky report format, including making the argument categories (more?) accurate again * the printed name for things in the report include the unique of their ticky parent as well as if they are not top-level
* Code-size optimisation for top-level indirections (#7308)Simon Marlow2012-11-191-0/+8
| | | | | | | | | | | | | | | Top-level indirections are often generated when there is a cast, e.g. foo :: T foo = bar `cast` (some coercion) For these we were generating a full-blown CAF, which is a fair chunk of code. This patch makes these indirections generate a single IND_STATIC closure (4 words) instead. This is exactly what the CAF would evaluate to eventually anyway, we're just shortcutting the whole process.
* Some alpha renamingIan Lynagh2012-10-161-5/+5
| | | | | Mostly d -> g (matching DynFlag -> GeneralFlag). Also renamed if* to when*, matching the Haskell if/when names
* Produce new-style Cmm from the Cmm parserSimon Marlow2012-10-081-14/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The main change here is that the Cmm parser now allows high-level cmm code with argument-passing and function calls. For example: foo ( gcptr a, bits32 b ) { if (b > 0) { // we can make tail calls passing arguments: jump stg_ap_0_fast(a); } return (x,y); } More details on the new cmm syntax are in Note [Syntax of .cmm files] in CmmParse.y. The old syntax is still more-or-less supported for those occasional code fragments that really need to explicitly manipulate the stack. However there are a couple of differences: it is now obligatory to give a list of live GlobalRegs on every jump, e.g. jump %ENTRY_CODE(Sp(0)) [R1]; Again, more details in Note [Syntax of .cmm files]. I have rewritten most of the .cmm files in the RTS into the new syntax, except for AutoApply.cmm which is generated by the genapply program: this file could be generated in the new syntax instead and would probably be better off for it, but I ran out of enthusiasm. Some other changes in this batch: - The PrimOp calling convention is gone, primops now use the ordinary NativeNodeCall convention. This means that primops and "foreign import prim" code must be written in high-level cmm, but they can now take more than 10 arguments. - CmmSink now does constant-folding (should fix #7219) - .cmm files now go through the cmmPipeline, and as a result we generate better code in many cases. All the object files generated for the RTS .cmm files are now smaller. Performance should be better too, but I haven't measured it yet. - RET_DYN frames are removed from the RTS, lots of code goes away - we now have some more canned GC points to cover unboxed-tuples with 2-4 pointers, which will reduce code size a little.
* Make StgWord a portable type tooIan Lynagh2012-09-181-4/+4
| | | | | StgWord is a newtyped Word64, as it needed to be something that has a UArray instance.
* Make StgHalfWord a portable typeIan Lynagh2012-09-181-9/+9
| | | | | It's now a newtyped Integer. Perhaps a newtyped Word32 would make more sense, though.
* Move tAG_BITS into platformConstantsIan Lynagh2012-09-161-16/+17
|
* Remove doingTickyProfilingIan Lynagh2012-09-031-1/+1
| | | | It's now just 'dopt Opt_Ticky'
* Make tablesNextToCode "dynamic"Ian Lynagh2012-08-061-30/+29
| | | | | This is a bit odd by itself, but it's a stepping stone on the way to putting "target unregisterised" into the settings file.
* New codegen: do not split proc-points when using the NCGSimon Marlow2012-07-301-2/+0
| | | | | | | | | Proc-point splitting is only required by backends that do not support having proc-points within a code block (that is, everything except the native backend, i.e. LLVM and C). Not doing proc-point splitting saves some compilation time, and might produce slightly better code in some cases.
* Make -fscc-profiling a dynamic flagIan Lynagh2012-07-241-23/+24
| | | | All the flags that 'ways' imply are now dynamic
* Merge remote-tracking branch 'origin/master' into newcgSimon Marlow2012-07-041-27/+41
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * origin/master: (756 commits) don't crash if argv[0] == NULL (#7037) -package P was loading all versions of P in GHCi (#7030) Add a Note, copying text from #2437 improve the --help docs a bit (#7008) Copy Data.HashTable's hashString into our Util module Build fix Build fixes Parse error: suggest brackets and indentation. Don't build the ghc DLL on Windows; works around trac #5987 On Windows, detect if DLLs have too many symbols; trac #5987 Add some more Integer rules; fixes #6111 Fix PA dfun construction with silent superclass args Add silent superclass parameters to the vectoriser Add silent superclass parameters (again) Mention Generic1 in the user's guide Make the GHC API a little more powerful. tweak llvm version warning message New version of the patch for #5461. Fix Word64ToInteger conversion rule. Implemented feature request on reconfigurable pretty-printing in GHCi (#5461) ... Conflicts: compiler/basicTypes/UniqSupply.lhs compiler/cmm/CmmBuildInfoTables.hs compiler/cmm/CmmLint.hs compiler/cmm/CmmOpt.hs compiler/cmm/CmmPipeline.hs compiler/cmm/CmmStackLayout.hs compiler/cmm/MkGraph.hs compiler/cmm/OldPprCmm.hs compiler/codeGen/CodeGen.lhs compiler/codeGen/StgCmm.hs compiler/codeGen/StgCmmBind.hs compiler/codeGen/StgCmmLayout.hs compiler/codeGen/StgCmmUtils.hs compiler/main/CodeOutput.lhs compiler/main/HscMain.hs compiler/nativeGen/AsmCodeGen.lhs compiler/simplStg/SimplStg.lhs
| * Make -fparallel a dynamic flagIan Lynagh2012-06-201-2/+2
| |
| * Remove some unnecessary platform argumentsIan Lynagh2012-06-131-11/+10
| |
| * Fix for earger blackholing of thunks with no free variables (#6146)Simon Marlow2012-06-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A thunk with no free variables was not getting blackholed when -feager-blackholing was on, but we were nevertheless pushing the stg_bh_upd_frame version of the update frame that expects to see a black hole. I fixed this twice for good measure: - we now call blackHoleOnEntry when pushing the update frame to check whether the closure was actually blackholed, and so that we use the same predicate in both places - we now black hole thunks even if they have no free variables. These only occur when optimisation is off, but presumably if you say -feager-blackholing then that's what you want to happen.
| * Merge remote-tracking branch 'origin/unboxed-tuple-arguments2'Paolo Capriotti2012-06-051-13/+20
| |\
| | * Support code generation for unboxed-tuple function argumentsunboxed-tuple-arguments2Max Bolingbroke2012-05-151-13/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is done by a 'unarisation' pre-pass at the STG level which translates away all (live) binders binding something of unboxed tuple type. This has the following knock-on effects: * The subkind hierarchy is vastly simplified (no UbxTupleKind or ArgKind) * Various relaxed type checks in typechecker, 'foreign import prim' etc * All case binders may be live at the Core level
| * | Change how macros like ASSERT are definedIan Lynagh2012-06-051-0/+1
| |/ | | | | | | | | By using Haskell's debugIsOn rather than CPP's "#ifdef DEBUG", we don't need to kludge things to keep the warning checker happy etc.
| * Add support for type-level "strings".Iavor S. Diatchki2012-01-241-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | These are types that look like "this" and "that". They are of kind `Symbol`, defined in module `GHC.TypeLits`. For each type-level symbol `X`, we have a singleton type, `TSymbol X`. The value of the singleton type can be named with the overloaded constant `tSymbol`. Here is an example: tSymbol :: TSymbol "Hello"
| * Mainly, rename LiteralTy to LitTySimon Peyton Jones2012-01-131-1/+1
| |
| * Extend GHC's type with a representation for type level literals.Iavor S. Diatchki2011-12-181-0/+6
| | | | | | | | | | Currently, we support only numeric literals but---hopefully---these modifications should make it fairly easy to add other ones, if necessary.
* | Fix an SRT-related bugSimon Marlow2012-02-141-13/+16
|/ | | | | | | | We were using the SRT information generated by the computeSRTs pass to decide whether to add a static link field to a constructor or not, and this broke when I disabled computeSRTs for the new code generator. So I've hacked it for now to only rely on the SRT information generated by CoreToStg.
* Use -fwarn-tabs when validatingIan Lynagh2011-11-041-0/+7
| | | | | We only use it for "compiler" sources, i.e. not for libraries. Many modules have a -fno-warn-tabs kludge for now.
* More CPP removal: pprDynamicLinkerAsmLabel in CLabelIan Lynagh2011-10-021-10/+11
| | | | And some knock-on changes
* Implement -XConstraintKindMax Bolingbroke2011-09-061-6/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Basically as documented in http://hackage.haskell.org/trac/ghc/wiki/KindFact, this patch adds a new kind Constraint such that: Show :: * -> Constraint (?x::Int) :: Constraint (Int ~ a) :: Constraint And you can write *any* type with kind Constraint to the left of (=>): even if that type is a type synonym, type variable, indexed type or so on. The following (somewhat related) changes are also made: 1. We now box equality evidence. This is required because we want to give (Int ~ a) the *lifted* kind Constraint 2. For similar reasons, implicit parameters can now only be of a lifted kind. (?x::Int#) => ty is now ruled out 3. Implicit parameter constraints are now allowed in superclasses and instance contexts (this just falls out as OK with the new constraint solver) Internally the following major changes were made: 1. There is now no PredTy in the Type data type. Instead GHC checks the kind of a type to figure out if it is a predicate 2. There is now no AClass TyThing: we represent classes as TyThings just as a ATyCon (classes had TyCons anyway) 3. What used to be (~) is now pretty-printed as (~#). The box constructor EqBox :: (a ~# b) -> (a ~ b) 4. The type LCoercion is used internally in the constraint solver and type checker to represent coercions with free variables of type (a ~ b) rather than (a ~# b)
* fix the eager-blackholing check, which I inadvertently broke inSimon Marlow2011-09-061-14/+3
| | | | | 1c2f89535394958f75cfb15c8c5e0433a20953ed (symptom was broken biographical profiling, see #5451).
* refactoring and fixing the stage 2 compilationSimon Marlow2011-08-251-138/+107
|
* Refactoring/renamingSimon Marlow2011-08-251-76/+78
|
* eliminate ConInfoSimon Marlow2011-08-251-67/+27
|
* Remove another use of mkConInfoSimon Marlow2011-08-251-24/+15
|
* Refactoring: reduce usage of mkConInfo, with a view to killing itSimon Marlow2011-08-251-25/+57
|
* avoid record selector error on closureProfSimon Marlow2011-08-251-1/+5
|
* More refactoring (CgRep)Simon Peyton Jones2011-08-251-11/+0
| | | | | | * Move CgRep (private to old codgen) from SMRep to ClosureInfo * Avoid using CgRep in new codegen * Move SMRep and Bitmap from codeGen/ to cmm/
* Snapshot of codegen refactoring to share with simonpjSimon Marlow2011-08-251-230/+95
|
* Add Type.tyConAppTyCon_maybe and tyConAppArgs_maybe, and use themSimon Peyton Jones2011-08-031-3/+3
| | | | | | These turn out to be a useful special case of splitTyConApp_maybe. A refactoring only; no change in behaviour
* Eliminate localiseLabelMax Bolingbroke2011-07-281-5/+4
|
* Eliminate infoLblToEntryLblMax Bolingbroke2011-07-281-15/+23
|
* There is only one flavour of LFBlackHole: make that explicitMax Bolingbroke2011-07-281-7/+6
|
* Put the info CLabel in CmmInfoTable rather than a localness flag, tidy up ↵Max Bolingbroke2011-07-281-8/+8
| | | | some info<->entry conversions