summaryrefslogtreecommitdiff
path: root/compiler/cmm/CmmLayoutStack.hs
Commit message (Collapse)AuthorAgeFilesLines
* Fix Trac #9815Simon Peyton Jones2014-11-211-3/+3
| | | | | | | | | | | Dot-dot record-wildcard notation is simply illegal for constructors without any named fields, but that was neither documented nor checked. This patch does so - Make the check in RnPat - Add test T9815 - Fix CmmLayoutStack which was using the illegal form (!) - Document in user manual
* Per-thread allocation counters and limitsSimon Marlow2014-11-121-3/+6
| | | | | | | | This reverts commit f0fcc41d755876a1b02d1c7c79f57515059f6417. New changes: now works on 32-bit platforms too. I added some basic support for 64-bit subtraction and comparison operations to the x86 NCG.
* Make Applicative a superclass of MonadAustin Seipp2014-09-091-0/+4
| | | | | | | | | | | | | | | | | | | | | Summary: This includes pretty much all the changes needed to make `Applicative` a superclass of `Monad` finally. There's mostly reshuffling in the interests of avoid orphans and boot files, but luckily we can resolve all of them, pretty much. The only catch was that Alternative/MonadPlus also had to go into Prelude to avoid this. As a result, we must update the hsc2hs and haddock submodules. Signed-off-by: Austin Seipp <austin@well-typed.com> Test Plan: Build things, they might not explode horribly. Reviewers: hvr, simonmar Subscribers: simonmar Differential Revision: https://phabricator.haskell.org/D13
* Fix reference to noteSimon Marlow2014-08-011-1/+1
|
* Add LANGUAGE pragmas to compiler/ source filesHerbert Valerio Riedel2014-05-151-1/+1
| | | | | | | | | | | | | | | | | | 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.
* Revert "Per-thread allocation counters and limits"Simon Marlow2014-05-041-6/+3
| | | | | | | | Problems were found on 32-bit platforms, I'll commit again when I have a fix. This reverts the following commits: 54b31f744848da872c7c6366dea840748e01b5cf b0534f78a73f972e279eed4447a5687bd6a8308e
* Per-thread allocation counters and limitsSimon Marlow2014-05-021-3/+6
| | | | | | | | | | | | | | | | | | | | | | | This tracks the amount of memory allocation by each thread in a counter stored in the TSO. Optionally, when the counter drops below zero (it counts down), the thread can be sent an asynchronous exception: AllocationLimitExceeded. When this happens, given a small additional limit so that it can handle the exception. See documentation in GHC.Conc for more details. Allocation limits are similar to timeouts, but - timeouts use real time, not CPU time. Allocation limits do not count anything while the thread is blocked or in foreign code. - timeouts don't re-trigger if the thread catches the exception, allocation limits do. - timeouts can catch non-allocating loops, if you use -fno-omit-yields. This doesn't work for allocation limits. I couldn't measure any impact on benchmarks with these changes, even for nofib/smp.
* Nuke dead codeJan Stolarek2014-02-011-24/+5
| | | | | | | | | | | | | * CmmRewriteAddignments module was replaced by CmmSink a long time ago. That module is now available at https://ghc.haskell.org/trac/ghc/wiki/Commentary/Compiler/Hoopl/Examples wiki page. * removeDeadAssignments function was not used and it was also moved to the above page. * I also nuked some commented out debugging code that was not used for 1,5 year.
* Typo in commentGabor Greif2014-01-161-1/+1
|
* Documentation on the stack layout algorithmSimon Marlow2014-01-161-5/+94
|
* More comments about stack layoutSimon Peyton Jones2013-10-181-5/+16
|
* Clarify comments and liberalise stack-check optimisation slightlySimon Peyton Jones2013-10-181-9/+10
| | | | | | The only substantive change here is to change "==" into ">=" in the Note [Always false stack check] code. This is semantically correct, but won't have any practical impact.
* Optimise stack checks that are always falseJan Stolarek2013-10-171-12/+12
| | | | | Fix a bug introduced in 94125c97e49987e91fa54da6c86bc6d17417f5cf. See Note [Always false stack check]
* Generate (old + 0) instead of Sp in stack checksJan Stolarek2013-10-161-10/+2
| | | | | | | | | | | | | | | | | | | | When compiling a function we can determine how much stack space it will use. We therefore need to perform only a single stack check at the beginning of a function to see if we have enough stack space. Instead of referring directly to Sp - as we used to do in the past - the code generator uses (old + 0) in the stack check. Stack layout phase turns (old + 0) into Sp. The idea here is that, while we need to perform only one stack check for each function, we could in theory place more stack checks later in the function. They would be redundant, but not incorrect (in a sense that they should not change program behaviour). We need to make sure however that a stack check inserted after incrementing the stack pointer checks for a respectively smaller stack space. This would not be the case if the code generator produced direct references to Sp. By referencing (old + 0) we make sure that we always check for a correct amount of stack: when converting (old + 0) to Sp the stack layout phase takes into account changes already made to stack pointer. The idea for this change came from observations made while debugging #8275.
* Improve sinking passJan Stolarek2013-09-121-10/+11
| | | | | | | | | | | | | | | | | | | | This commit does two things: * Allows duplicating of global registers and literals by inlining them. Previously we would only inline global register or literal if it was used only once. * Changes method of determining conflicts between a node and an assignment. New method has two advantages. It relies on DefinerOfRegs and UserOfRegs typeclasses, so if a set of registers defined or used by a node should ever change, `conflicts` function will use the changed definition. This definition also catches more cases than the previous one (namely CmmCall and CmmForeignCall) which is a step towards making it possible to run sinking pass before stack layout (currently this doesn't work). This patch also adds a lot of comments that are result of about two-week long investigation of how sinking pass works and why it does what it does.
* Fix a bug in stack layout with safe foreign calls (#8083)Simon Marlow2013-07-241-7/+8
| | | | | | | We weren't properly tracking the number of stack arguments in the continuation of a foreign call. It happened to work when the continuation was not a join point, but when it was a join point we were using the wrong amount of stack fixup.
* In CMM, only allow foreign calls to labels, not arbitrary expressionsIan Lynagh2013-04-241-2/+2
| | | | | | | | | I'm not sure if we want to make this change permanently, but for now it fixes the unreg build. I've also removed some redundant special-case code that generated prototypes for foreign functions. The standard pprTempAndExternDecls now generates them.
* Tidy up: move info-table related stuff to CmmInfoSimon Marlow2013-01-231-1/+1
| | | | Prep for #709
* Attach global register liveness info to Cmm procedures.Geoffrey Mainland2012-10-301-2/+2
| | | | | | | All Cmm procedures now include the set of global registers that are live on procedure entry, i.e., the global registers used to pass arguments to the procedure. Only global registers that are use to pass arguments are included in this list.
* Generalize register sets and liveness calculations.Geoffrey Mainland2012-10-301-6/+6
| | | | | | We would like to calculate register liveness for global registers as well as local registers, so this patch generalizes the existing infrastructure to set the stage.
* Add a type signature needed when using GADTsSimon Peyton Jones2012-10-121-0/+1
|
* Produce new-style Cmm from the Cmm parserSimon Marlow2012-10-081-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Misc tidyupSimon Marlow2012-09-241-3/+3
|
* add a missing entryCodeSimon Marlow2012-09-201-1/+3
|
* Move wORD_SIZE into platformConstantsIan Lynagh2012-09-161-41/+43
|
* Pass DynFlags down to wordWidthIan Lynagh2012-09-121-11/+11
|
* Pass DynFlags down to gcWordIan Lynagh2012-09-121-2/+2
|
* Pass DynFlags down to bWordIan Lynagh2012-09-121-30/+33
| | | | | | I've switched to passing DynFlags rather than Platform, as (a) it's simpler to not have to extract targetPlatform in so many places, and (b) it may be useful to have DynFlags around in future.
* Cleanup: add mkIntExpr and zeroExpr utilsSimon Marlow2012-08-311-3/+3
|
* small cleanupSimon Marlow2012-08-071-5/+2
|
* Define callerSaves for all platformsIan Lynagh2012-08-071-1/+1
| | | | | | | | This means that we now generate the same code whatever platform we are on, which should help avoid changes on one platform breaking the build on another. It's also another step towards full cross-compilation.
* Add "Unregisterised" as a field in the settings fileIan Lynagh2012-08-071-1/+1
| | | | | | To explicitly choose whether you want an unregisterised build you now need to use the "--enable-unregisterised"/"--disable-unregisterised" configure flags.
* Continue by jumping to the top-of-stack after a safe foreign callSimon Marlow2012-08-061-5/+7
|
* No need to do removeDeadAssignments, just do cmmLiveness insteadSimon Marlow2012-08-021-1/+7
|
* optimise away some unnecessary stack checksSimon Marlow2012-07-301-1/+19
|
* New codegen: do not split proc-points when using the NCGSimon Marlow2012-07-301-7/+6
| | | | | | | | | 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.
* Fixes for the stack layout algorithm to handle join pointsSimon Marlow2012-07-301-38/+51
|
* Make -fscc-profiling a dynamic flagIan Lynagh2012-07-241-7/+8
| | | | All the flags that 'ways' imply are now dynamic
* GHC 7.4 is now required for building HEADIan Lynagh2012-07-201-3/+0
|
* Move sinking into a separate module, and add a simple inlining passSimon Marlow2012-07-171-85/+14
|
* Fix build with GHC 7.0Ian Lynagh2012-07-131-0/+3
|
* Support the 2-result primops in the new code generatorSimon Marlow2012-07-111-1/+1
|
* Track liveness of GlobalRegs in the new code generatorSimon Marlow2012-07-091-6/+7
| | | | | | This gives the register allocator access to R1.., F1.., D1.. etc. for the new code generator, and is a cheap way to eliminate all the extra "x = R1" assignments that we get from copyIn.
* Remove "fuel", adapt to Hoopl changes, fix warningsSimon Marlow2012-07-051-7/+7
|
* Fix merge-related problemsSimon Marlow2012-07-041-1/+4
|
* Add an experimental sinking passSimon Marlow2012-07-031-2/+72
|
* refactoring and commentsSimon Marlow2012-03-151-26/+34
|
* Remove the old stack layout algorithmsSimon Marlow2012-03-151-2/+2
| | | | | | | | Also, do removeDeadAssignments instead of cmmLiveness before stack allocation, because the former also does liveness analysis, and we can do just one liveness analysis instead of two. The stack layout algorithm doesn't introduce any dead assignments, so this doesn't affect the generated code.
* Add type signature necessary for GHC 7.0.4Max Bolingbroke2012-03-091-1/+2
|
* An optimisation to reduce code size in a common caseSimon Marlow2012-03-081-121/+182
|