1. 18 Oct, 2013 2 commits
  2. 16 Oct, 2013 1 commit
    • Jan Stolarek's avatar
      Generate (old + 0) instead of Sp in stack checks · 94125c97
      Jan Stolarek authored
      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.
      94125c97
  3. 11 Oct, 2013 1 commit
  4. 04 Oct, 2013 1 commit
  5. 02 Oct, 2013 1 commit
  6. 01 Oct, 2013 1 commit
  7. 23 Sep, 2013 6 commits
  8. 18 Sep, 2013 1 commit
  9. 15 Sep, 2013 1 commit
    • Duncan Coutts's avatar
      New primops for byte range copies ByteArray# <-> Addr# · f11289f6
      Duncan Coutts authored
      We have primops for copying ranges of bytes between ByteArray#s:
       * ByteArray# -> MutableByteArray#
       * MutableByteArray# -> MutableByteArray#
      This extends it with three further cases:
       * Addr# -> MutableByteArray#
       * ByteArray# -> Addr#
       * MutableByteArray# -> Addr#
      One use case for these is copying between ForeignPtr-based
      representations and in-heap arrays (like Text, UArray etc).
      
      The implementation is essentially the same as for the existing
      primops, and shares the memcpy stuff in the code generators.
      
      Defficiencies / future directions: none of these primops (existing
      or the new ones) let one take advantage of knowing that ByteArray#s
      are word-aligned in memory. Though it is unclear that any of the
      code generators would make use of this information unless the size
      to copy is also known at compile time.
      Signed-off-by: default avatarAustin Seipp <austin@well-typed.com>
      f11289f6
  10. 11 Sep, 2013 1 commit
  11. 02 Sep, 2013 1 commit
  12. 29 Aug, 2013 2 commits
    • Jan Stolarek's avatar
      Optimize self-recursive tail calls · d61c3ac1
      Jan Stolarek authored
      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.
      d61c3ac1
    • Jan Stolarek's avatar
      Whitespaces and comment formatting · 1d1ab12d
      Jan Stolarek authored
      1d1ab12d
  13. 27 Aug, 2013 2 commits
    • Simon Peyton Jones's avatar
      Comments only, relating to #8166 fix · ef017944
      Simon Peyton Jones authored
      ef017944
    • thoughtpolice's avatar
      Properly externalise codegen identifiers (#8166) · 776cfe28
      thoughtpolice authored
      388e14e2 unfortunately broke a subtle invariant in the code generator:
      when generating code for an application, names may need to be
      externalised, in case you're building against something external with
      was built with -split-objs.
      
      We were never externalising the ids of the applied functions. This means
      if the libraries are split and we call into them, then the compiler
      won't may not generate correct ids when making references to functions
      in the library (causing linker failure).
      
      I'm not entirely sure how this didn't break everything, but it certainly
      caused several failures for a bunch of people. I had to fiddle with my
      tree a little to make this occur.
      
      This should fix #8166.
      Signed-off-by: thoughtpolice's avatarAustin Seipp <aseipp@pobox.com>
      776cfe28
  14. 22 Aug, 2013 1 commit
  15. 21 Aug, 2013 1 commit
    • Jan Stolarek's avatar
      Detabify · b38af652
      Jan Stolarek authored
      I missed that file yesterday when I was cleaning up codeGen/ directory.
      b38af652
  16. 20 Aug, 2013 5 commits
    • Jan Stolarek's avatar
      Comments only · d0b8c46d
      Jan Stolarek authored
      d0b8c46d
    • Jan Stolarek's avatar
      Merge cgTailCall and cgLneJump into one function · 388e14e2
      Jan Stolarek authored
      Previosly logic of these functions was sth like this:
      
        cgIdApp x = case x of
                      A -> cgLneJump x
                      _ -> cgTailCall x
      
        cgTailCall x = case x of
                         B -> ...
                         C -> ...
                         _ -> ...
      
      After merging there is no nesting of cases:
      
        cgIdApp x = case x of
                      A -> -- body of cgLneJump
                      B -> ...
                      C -> ...
                      _ -> ...
      388e14e2
    • Jan Stolarek's avatar
      Remove unused module · 6b032db4
      Jan Stolarek authored
      This commit removes module StgCmmGran which has only no-op functions.
      According to comments in the module, it was used by GpH, but GpH
      project seems to be dead for a couple of years now.
      6b032db4
    • Jan Stolarek's avatar
      Cleanup StgCmm pass · e5374a1b
      Jan Stolarek authored
      This cleanup includes:
        * removing dead code. This includes forkStatics function,
          which was in fact one big noop, and global bindings in
          CgInfoDownwards,
        * converting functions that used FCode monad only to
          access DynFlags into functions that take DynFlags
          as a parameter and don't work in a monad,
        * addBindC function is now smarter. It extracts Id from
          CgIdInfo passed to it in the same way addBindsC does.
          Previously this was done at every call site, which was
          redundant.
      e5374a1b
    • Jan Stolarek's avatar
      Trailing whitespaces, code formatting, detabify · 3f279f37
      Jan Stolarek authored
      A major cleanup of trailing whitespaces and tabs in codeGen/
      directory. I also adjusted code formatting in some places.
      3f279f37
  17. 19 Aug, 2013 1 commit
  18. 14 Aug, 2013 1 commit
    • Jan Stolarek's avatar
      Comparison primops return Int# (Fixes #6135) · 6579a6c7
      Jan Stolarek authored
      This patch modifies all comparison primops for Char#, Int#, Word#, Double#,
      Float# and Addr# to return Int# instead of Bool. A value of 1# represents True
      and 0# represents False. For a more detailed description of motivation for this
      change, discussion of implementation details and benchmarking results please
      visit the wiki page: http://hackage.haskell.org/trac/ghc/wiki/PrimBool
      
      There's also some cleanup: whitespace fixes in files that were extensively edited
      in this patch and constant folding rules for Integer div and mod operators (which
      for some reason have been left out up till now).
      6579a6c7
  19. 24 Jul, 2013 1 commit
    • Simon Marlow's avatar
      Fix a bug in stack layout with safe foreign calls (#8083) · c2348859
      Simon Marlow authored
      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.
      c2348859
  20. 22 Jul, 2013 1 commit
  21. 17 Jul, 2013 1 commit
  22. 06 Jul, 2013 1 commit
  23. 02 Jul, 2013 1 commit
  24. 25 Jun, 2013 2 commits
  25. 22 Jun, 2013 1 commit
  26. 19 Jun, 2013 1 commit
  27. 18 Jun, 2013 1 commit