summaryrefslogtreecommitdiff
path: root/compiler/ghci/ByteCodeGen.lhs
Commit message (Collapse)AuthorAgeFilesLines
* Convert GHCi sources from .lhs to .hsRodlogic2014-10-291-1691/+0
| | | | | | | | | | | | | | Summary: Signed-off-by: Rodlogic <admin@rodlogic.net> Test Plan: Does it compile? Reviewers: hvr, austin Reviewed By: austin Subscribers: thomie, carter, simonmar Differential Revision: https://phabricator.haskell.org/D319
* Make Applicative a superclass of MonadAustin Seipp2014-09-091-0/+2
| | | | | | | | | | | | | | | | | | | | | 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
* ghci: detabify/unwhitespace ByteCodeGenAustin Seipp2014-07-201-15/+8
| | | | Signed-off-by: Austin Seipp <austin@well-typed.com>
* Add LANGUAGE pragmas to compiler/ source filesHerbert Valerio Riedel2014-05-151-1/+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.
* Add SmallArray# and SmallMutableArray# typesJohan Tibell2014-03-291-0/+5
| | | | | | | | | | | | | | | These array types are smaller than Array# and MutableArray# and are faster when the array size is small, as they don't have the overhead of a card table. Having no card table reduces the closure size with 2 words in the typical small array case and leads to less work when updating or GC:ing the array. Reduces both the runtime and memory allocation by 8.8% on my insert benchmark for the HashMap type in the unordered-containers package, which makes use of lots of small arrays. With tuned GC settings (i.e. `+RTS -A6M`) the runtime reduction is 15%. Fixes #8923.
* Fix the bytecode genreation for tagToEnum# (Trac #8383)Simon Peyton Jones2013-10-041-42/+83
| | | | | | | Reid Barton's diagnosis was right on the mark, though the fix wasn't quite right. See Note [Implementing tagToEnum#]. As usual I did some refactoring.
* Comments onlySimon Peyton Jones2013-10-041-0/+1
|
* Globally replace "hackage.haskell.org" with "ghc.haskell.org"Simon Marlow2013-10-011-1/+1
|
* Fix AMP warnings.Austin Seipp2013-09-111-0/+8
| | | | | Authored-by: David Luposchainsky <dluposchainsky@gmail.com> Signed-off-by: Austin Seipp <austin@well-typed.com>
* Make FastBytes a synonym for ByteStringIan Lynagh2012-12-131-4/+6
| | | | | | | | | | | A step on the way to getting rid of FastBytes slow nofib Compile times look like: -1 s.d. -2.4% +1 s.d. +3.4% Average +0.4% but looking at the times for the longer-running compilations I think the change is just noise.
* Replace all uses of ghcError with throwGhcException and purge ghcError.Erik de Castro Lopo2012-11-301-1/+1
|
* Remove the old codegenSimon Marlow2012-10-191-59/+70
| | | | | Except for CgUtils.fixStgRegisters that is used in the NCG and LLVM backends, and should probably be moved somewhere else.
* Move wORD_SIZE into platformConstantsIan Lynagh2012-09-161-46/+47
|
* Windows build fixIan Lynagh2012-09-161-6/+8
|
* Move wORD_SIZE_IN_BITS to DynFlagsIan Lynagh2012-09-141-15/+18
| | | | This frees wORD_SIZE up to be moved out of HaskellConstants
* Make -fscc-profiling a dynamic flagIan Lynagh2012-07-241-12/+19
| | | | All the flags that 'ways' imply are now dynamic
* Implement FastBytes, and use it for MachStrIan Lynagh2012-07-141-1/+1
| | | | | | | | | | | | | This is a first step on the way to refactoring the FastString type. FastBytes currently has no unique, mainly because there isn't currently a nice way to produce them in Binary. Also, we don't currently do the "Dictionary" thing with FastBytes in Binary. I'm not sure whether this is important. We can change both decisions later, but in the meantime this gets the refactoring underway.
* Use a derived Ord instance for DiscrIan Lynagh2012-06-221-12/+3
| | | | | | Our hand-written leAlt behaved differently when given a micture of constructors, but I think that either it won't make a difference or that this will be an improvement.
* Derive Eq DiscrIan Lynagh2012-06-221-9/+2
| | | | We had effectively hand-written the instance instead
* Remove some uses of sortLeIan Lynagh2012-06-221-1/+1
| | | | | | Technically the behaviour of sortWith has changed, as it used x `le` y = get_key x < get_key y (note "<" rather than "<="), but I assume that that was just a mistake.
* Merge branch 'master' of darcs.haskell.org:/srv/darcs//ghcIan Lynagh2012-06-131-33/+71
|\ | | | | | | | | Fix conflicts in: compiler/main/DynFlags.hs
| * Attempt to fix the bytecode generator for unboxed tuples, given the latest ↵Max Bolingbroke2012-06-091-33/+71
| | | | | | | | changes to unboxed tuple support
* | Remove lots of commented out 'in' keywordsIan Lynagh2012-06-131-5/+0
|/
* Support code generation for unboxed-tuple function argumentsunboxed-tuple-arguments2Max Bolingbroke2012-05-151-12/+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
* Handle cases with no alternatives in GHCiSimon Marlow2012-05-111-0/+3
| | | | Fixes cgrun045(ghci) amongst others
* Support large SLIDE instructions.Paolo Capriotti2012-04-161-44/+66
| | | | | | | | | | | | | The bytecode generator used to keep track of the stack depth with a 16-bit counter, which could overflow for very large BCOs, resulting in incorrect bytecode. This commit switches to a word-sized counter, and eagerly panics whenever an operand is too big, instead of truncating the result. This allows us to work around the 16-bit limitation in the case of SLIDE instructions, since we can simply factor it into multiple SLIDEs with smaller arguments.
* Implement "value" imports with the CAPIIan Lynagh2012-02-261-1/+3
| | | | | | This allows us to import values (i.e. non-functions) with the CAPI. This means we can access values even if (on some or all platforms) they are simple #defines.
* 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.
* Fix gratuitous code duplication in the byte code generatorSimon Marlow2011-11-021-16/+34
| | | | | | | | For a case expression with a default, we were re-emitting the code for the default branch each time it was referenced, which in a case with many branches could be many times, leading to an O(n^2) blowup. This shows up in ghcirun003, which now runs much faster than before.
* Overhaul of infrastructure for profiling, coverage (HPC) and breakpointsSimon Marlow2011-11-021-84/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | User visible changes ==================== Profilng -------- Flags renamed (the old ones are still accepted for now): OLD NEW --------- ------------ -auto-all -fprof-auto -auto -fprof-exported -caf-all -fprof-cafs New flags: -fprof-auto Annotates all bindings (not just top-level ones) with SCCs -fprof-top Annotates just top-level bindings with SCCs -fprof-exported Annotates just exported bindings with SCCs -fprof-no-count-entries Do not maintain entry counts when profiling (can make profiled code go faster; useful with heap profiling where entry counts are not used) Cost-centre stacks have a new semantics, which should in most cases result in more useful and intuitive profiles. If you find this not to be the case, please let me know. This is the area where I have been experimenting most, and the current solution is probably not the final version, however it does address all the outstanding bugs and seems to be better than GHC 7.2. Stack traces ------------ +RTS -xc now gives more information. If the exception originates from a CAF (as is common, because GHC tends to lift exceptions out to the top-level), then the RTS walks up the stack and reports the stack in the enclosing update frame(s). Result: +RTS -xc is much more useful now - but you still have to compile for profiling to get it. I've played around a little with adding 'head []' to GHC itself, and +RTS -xc does pinpoint the problem quite accurately. I plan to add more facilities for stack tracing (e.g. in GHCi) in the future. Coverage (HPC) -------------- * derived instances are now coloured yellow if they weren't used * likewise record field names * entry counts are more accurate (hpc --fun-entry-count) * tab width is now correct (markup was previously off in source with tabs) Internal changes ================ In Core, the Note constructor has been replaced by Tick (Tickish b) (Expr b) which is used to represent all the kinds of source annotation we support: profiling SCCs, HPC ticks, and GHCi breakpoints. Depending on the properties of the Tickish, different transformations apply to Tick. See CoreUtils.mkTick for details. Tickets ======= This commit closes the following tickets, test cases to follow: - Close #2552: not a bug, but the behaviour is now more intuitive (test is T2552) - Close #680 (test is T680) - Close #1531 (test is result001) - Close #949 (test is T949) - Close #2466: test case has bitrotted (doesn't compile against current version of vector-space package)
* Make a new type synonym CoreProgram = [CoreBind]Simon Peyton Jones2011-09-231-1/+1
| | | | | | | | | | | and comment its invariants in Note [CoreProgram] in CoreSyn I'm not totally convinced that CoreProgram is the right name (perhaps CoreTopBinds might better), but it is useful to have a clue that you are looking at the top-level bindings. This is only a matter of a type synonym change; no deep refactoring here.
* Improve the handling of Integer literalsIan Lynagh2011-09-171-1/+1
| | | | | | | | | LitInteger now carries around the id of mkInteger, which it uses to construct the core to build Integer literals. This way we don't have to build in info about lots of Ids. We also no longer have any special-casing for integer-simple, so there is less code involved.
* change how Integer's are handled in CoreIan Lynagh2011-09-131-0/+4
| | | | | | We now treat them as literals until CorePrep, when we finally convert them into the real Core representation. This makes it a lot simpler to implement built-in rules on them.
* refactoring and fixing the stage 2 compilationSimon Marlow2011-08-251-0/+1
|
* 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
* fix warningSimon Marlow2011-07-201-1/+0
|
* Support 64-bit literals in the byte code generator (fixes recent testSimon Marlow2011-07-201-1/+3
| | | | failures in print002 etc. on 32-bit platforms)
* Fix Trac #5268: missing case for bytecode generation involving coercionsSimon Peyton Jones2011-06-231-22/+18
|
* Merge ghc-new-co into master branchSimon Peyton Jones2011-05-091-15/+16
|\
| * Missing coercion case in byte code generationSimon Peyton Jones2011-05-061-3/+4
| |
| * A few more wibbles on ghc-new-coSimon Peyton Jones2011-05-021-0/+1
| |
| * This BIG PATCH contains most of the work for the New Coercion RepresentationSimon Peyton Jones2011-04-191-6/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Remove a use of cTargetOS, in favour of platformOSIan Lynagh2011-05-081-2/+2
| |
* | Whitespace only in ghci/ByteCodeGen.lhsIan Lynagh2011-05-081-363/+363
| |
* | Remove an explicit import listIan Lynagh2011-05-081-1/+1
| |
* | Remove commented out importsIan Lynagh2011-05-081-4/+0
|/
* Allow enumerations to have phantom arguments.simonpj@microsoft.com2010-12-151-2/+2
| | | | | The bytecode generator was being too eager. Fixes Trac #4528, or rather, a near variant.
* Remove unncessary fromIntegral callssimonpj@microsoft.com2010-11-161-1/+1
|
* Use takeUniqFromSupply in ByteCodeGenIan Lynagh2010-10-211-3/+3
|
* Interruptible FFI calls with pthread_kill and CancelSynchronousIO. v4Edward Z. Yang2010-09-191-2/+3
| | | | | | | | | | | | | | | | | | | | | | | This is patch that adds support for interruptible FFI calls in the form of a new foreign import keyword 'interruptible', which can be used instead of 'safe' or 'unsafe'. Interruptible FFI calls act like safe FFI calls, except that the worker thread they run on may be interrupted. Internally, it replaces BlockedOnCCall_NoUnblockEx with BlockedOnCCall_Interruptible, and changes the behavior of the RTS to not modify the TSO_ flags on the event of an FFI call from a thread that was interruptible. It also modifies the bytecode format for foreign call, adding an extra Word16 to indicate interruptibility. The semantics of interruption vary from platform to platform, but the intent is that any blocking system calls are aborted with an error code. This is most useful for making function calls to system library functions that support interrupting. There is no support for pre-Vista Windows. There is a partner testsuite patch which adds several tests for this functionality.