1. 30 Mar, 2015 1 commit
    • Joachim Breitner's avatar
      Refactor the story around switches (#10137) · de1160be
      Joachim Breitner authored
      This re-implements the code generation for case expressions at the Stg →
      Cmm level, both for data type cases as well as for integral literal
      cases. (Cases on float are still treated as before).
      
      The goal is to allow for fancier strategies in implementing them, for a
      cleaner separation of the strategy from the gritty details of Cmm, and
      to run this later than the Common Block Optimization, allowing for one
      way to attack #10124. The new module CmmSwitch contains a number of
      notes explaining this changes. For example, it creates larger
      consecutive jump tables than the previous code, if possible.
      
      nofib shows little significant overall improvement of runtime. The
      rather large wobbling comes from changes in the code block order
      (see #8082, not much we can do about it). But the decrease in code size
      alone makes this worthwhile.
      
      ```
              Program           Size    Allocs   Runtime   Elapsed  TotalMem
                  Min          -1.8%      0.0%     -6.1%     -6.1%     -2.9%
                  Max          -0.7%     +0.0%     +5.6%     +5.7%     +7.8%
       Geometric Mean          -1.4%     -0.0%     -0.3%     -0.3%     +0.0%
      ```
      
      Compilation time increases slightly:
      ```
              -1 s.d.                -----            -2.0%
              +1 s.d.                -----            +2.5%
              Average                -----            +0.3%
      ```
      
      The test case T783 regresses a lot, but it is the only one exhibiting
      any regression. The cause is the changed order of branches in an
      if-then-else tree, which makes the hoople data flow analysis traverse
      the blocks in a suboptimal order. Reverting that gets rid of this
      regression, but has a consistent, if only very small (+0.2%), negative
      effect on runtime. So I conclude that this test is an extreme outlier
      and no reason to change the code.
      
      Differential Revision: https://phabricator.haskell.org/D720
      de1160be
  2. 03 Mar, 2015 1 commit
    • thomie's avatar
      Pretty-print # on unboxed literals in core · 89458eba
      thomie authored
      Summary:
      Ticket #10104 dealt with showing the '#'s on types with unboxed fields. This
      commit pretty prints the '#'s on unboxed literals in core output.
      
      Test Plan: simplCore/should_compile/T8274
      
      Reviewers: jstolarek, simonpj, austin
      
      Reviewed By: simonpj, austin
      
      Subscribers: simonpj, thomie
      
      Differential Revision: https://phabricator.haskell.org/D678
      
      GHC Trac Issues: #8274
      89458eba
  3. 02 Mar, 2015 1 commit
  4. 03 Dec, 2014 1 commit
  5. 15 May, 2014 1 commit
    • Herbert Valerio Riedel's avatar
      Add LANGUAGE pragmas to compiler/ source files · 23892440
      Herbert Valerio Riedel authored
      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.
      23892440
  6. 14 Dec, 2012 2 commits
  7. 19 Sep, 2012 1 commit
  8. 17 Sep, 2012 1 commit
  9. 14 Jul, 2012 1 commit
    • Ian Lynagh's avatar
      Implement FastBytes, and use it for MachStr · 7ae1bec5
      Ian Lynagh authored
      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.
      7ae1bec5
  10. 18 Jun, 2012 1 commit
  11. 12 Jun, 2012 1 commit
  12. 06 Jun, 2012 1 commit
  13. 05 Jun, 2012 1 commit
  14. 09 Nov, 2011 2 commits
  15. 04 Nov, 2011 1 commit
  16. 24 Oct, 2011 1 commit
  17. 21 Oct, 2011 1 commit
    • Simon Peyton Jones's avatar
      Recover proper sharing for Integer literals · ca380cd1
      Simon Peyton Jones authored
      Trac #5549 showed a loss of performance for GHC 7.4.
      What was happening was that an integer literal was being
      allocated each time around a loop, rather than being
      floated to top level and shared.
      
      Two fixes
       * Make the float-out pass float literals that are non-trivial
       * Make the inliner *not* treat Integer literals as size-zero
      ca380cd1
  18. 27 Sep, 2011 1 commit
    • Ian Lynagh's avatar
      Reenable a couple of assertions · 4faae220
      Ian Lynagh authored
      The comment explaining why they were disabled seemed to be out-of-date.
      It claimed we need to be able to write (intToWord# 0xffff0000#) whereas
      we can just write 0xffff0000##.
      
      Validate goes through with
          GhcStage1HcOpts   += -O0 -DDEBUG
          GhcStage2HcOpts   += -O0 -DDEBUG
      4faae220
  19. 23 Sep, 2011 1 commit
  20. 17 Sep, 2011 1 commit
    • Ian Lynagh's avatar
      Improve the handling of Integer literals · 1e87c0a6
      Ian Lynagh authored
      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.
      1e87c0a6
  21. 13 Sep, 2011 1 commit
    • Ian Lynagh's avatar
      change how Integer's are handled in Core · fdac48f3
      Ian Lynagh authored
      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.
      fdac48f3
  22. 11 Sep, 2011 2 commits
  23. 25 Aug, 2011 1 commit
  24. 24 Sep, 2010 1 commit
  25. 23 Sep, 2010 1 commit
  26. 30 Mar, 2010 1 commit
  27. 14 Oct, 2009 1 commit
    • Simon Marlow's avatar
      Fixes for cross-compiling to a different word size · 79e9cfa3
      Simon Marlow authored
      This patch eliminates a couple of places where we were assuming that
      the host word size is the same as the target word size.
      
      Also a little refactoring: Constants now exports the types TargetInt
      and TargetWord corresponding to the Int/Word type on the target
      platform, and I moved the definitions of tARGET_INT_MAX and friends
      from Literal to Constants.
      
      Thanks to Barney Stratford <barney_stratford@fastmail.fm> for helping
      track down the problem and fix it.  We now know that GHC can
      successfully cross-compile from 32-bit to 64-bit.
      79e9cfa3
  28. 24 Jul, 2009 1 commit
  29. 03 Apr, 2009 1 commit
    • simonpj@microsoft.com's avatar
      Adjust inlining heursitics · b71760aa
      simonpj@microsoft.com authored
      This patch is the result of a long series of nofib-based experiments
      to improve GHC's inlining heuristics.
      
      In the end, I'm not sure how worthwhile it all was: I only got a 
         1% decrease in code size
         1% decrease in allocation
      and I don't trust the runtime statistics enough to quote.
      
      Still, in doing all this I tidied up the code quite a bit, and 
      I understand it much better now, so I'm going to commit it.
      
      The main changes are in CoreUnfold, which has lots of new comments.
      Other changes:
      
        - litSize moves from Literal to CoreUnfold
        - interestingArg moves from SimplUtils to CoreUnfold
        - the default unfolding threshold (in StaticFlags) 
            reduces from 8 to 6 (since the size calculation 
            has changed a bit)
      
      b71760aa
  30. 06 Feb, 2009 1 commit
    • Ian Lynagh's avatar
      When generating C, don't pretend functions are data · 497302c4
      Ian Lynagh authored
      We used to generated things like:
          extern StgWordArray (newCAF) __attribute__((aligned (8)));
          ((void (*)(void *))(W_)&newCAF)((void *)R1.w);
      (which is to say, pretend that newCAF is some data, then cast it to a
      function and call it).
      This goes wrong on at least IA64, where:
          A function pointer on the ia64 does not point to the first byte of
          code. Intsead, it points to a structure that describes the function.
          The first quadword in the structure is the address of the first byte
          of code
      so we end up dereferencing function pointers one time too many, and
      segfaulting.
      497302c4
  31. 31 Jul, 2008 1 commit
  32. 12 Apr, 2008 1 commit
  33. 26 Jan, 2008 1 commit
  34. 17 Jan, 2008 1 commit
    • Isaac Dupree's avatar
      lots of portability changes (#1405) · 206b4dec
      Isaac Dupree authored
      re-recording to avoid new conflicts was too hard, so I just put it
      all in one big patch :-(  (besides, some of the changes depended on
      each other.)  Here are what the component patches were:
      
      Fri Dec 28 11:02:55 EST 2007  Isaac Dupree <id@isaac.cedarswampstudios.org>
        * document BreakArray better
      
      Fri Dec 28 11:39:22 EST 2007  Isaac Dupree <id@isaac.cedarswampstudios.org>
        * properly ifdef BreakArray for GHCI
      
      Fri Jan  4 13:50:41 EST 2008  Isaac Dupree <id@isaac.cedarswampstudios.org>
        * change ifs on __GLASGOW_HASKELL__ to account for... (#1405)
        for it not being defined. I assume it being undefined implies
        a compiler with relatively modern libraries but without most
        unportable glasgow extensions.
      
      Fri Jan  4 14:21:21 EST 2008  Isaac Dupree <id@isaac.cedarswampstudios.org>
        * MyEither-->EitherString to allow Haskell98 instance
      
      Fri Jan  4 16:13:29 EST 2008  Isaac Dupree <id@isaac.cedarswampstudios.org>
        * re-portabilize Pretty, and corresponding changes
      
      Fri Jan  4 17:19:55 EST 2008  Isaac Dupree <id@isaac.cedarswampstudios.org>
        * Augment FastTypes to be much more complete
      
      Fri Jan  4 20:14:19 EST 2008  Isaac Dupree <id@isaac.cedarswampstudios.org>
        * use FastFunctions, cleanup FastString slightly
      
      Fri Jan  4 21:00:22 EST 2008  Isaac Dupree <id@isaac.cedarswampstudios.org>
        * Massive de-"#", mostly Int# --> FastInt (#1405)
      
      Fri Jan  4 21:02:49 EST 2008  Isaac Dupree <id@isaac.cedarswampstudios.org>
        * miscellaneous unnecessary-extension-removal
      
      Sat Jan  5 19:30:13 EST 2008  Isaac Dupree <id@isaac.cedarswampstudios.org>
        * add FastFunctions
      206b4dec
  35. 04 Sep, 2007 1 commit
  36. 03 Sep, 2007 1 commit
  37. 01 Sep, 2007 1 commit