1. 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.
  2. 14 Apr, 2013 1 commit
  3. 06 Apr, 2013 1 commit
  4. 05 Mar, 2013 1 commit
  5. 12 Nov, 2012 1 commit
    • Simon Marlow's avatar
      Remove OldCmm, convert backends to consume new Cmm · d92bd17f
      Simon Marlow authored
      This removes the OldCmm data type and the CmmCvt pass that converts
      new Cmm to OldCmm.  The backends (NCGs, LLVM and C) have all been
      converted to consume new Cmm.
      The main difference between the two data types is that conditional
      branches in new Cmm have both true/false successors, whereas in OldCmm
      the false case was a fallthrough.  To generate slightly better code we
      occasionally need to invert a conditional to ensure that the
      branch-not-taken becomes a fallthrough; this was previously done in
      CmmCvt, and it is now done in CmmContFlowOpt.
      We could go further and use the Hoopl Block representation for native
      code, which would mean that we could use Hoopl's postorderDfs and
      analyses for native code, but for now I've left it as is, using the
      old ListGraph representation for native code.
  6. 30 Oct, 2012 1 commit
  7. 08 Oct, 2012 1 commit
    • Simon Marlow's avatar
      Produce new-style Cmm from the Cmm parser · a7c0387d
      Simon Marlow authored
      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.
  8. 31 Aug, 2012 1 commit
    • Simon Marlow's avatar
      Fix a bug in foldExpDeep · 6dd55e8a
      Simon Marlow authored
      This caused the CAF analysis to occasionally miss a CAF sometimes,
      resulting in a very hard to diagnose crash.
  9. 06 Aug, 2012 1 commit
  10. 20 Jul, 2012 1 commit
  11. 09 Jul, 2012 1 commit
  12. 05 Jul, 2012 2 commits
  13. 15 Mar, 2012 2 commits
  14. 13 Feb, 2012 1 commit
  15. 08 Feb, 2012 1 commit
    • Simon Marlow's avatar
      New stack layout algorithm · 76999b60
      Simon Marlow authored
       - improvements to code generation: push slow-call continuations
         on the stack instead of generating explicit continuations
       - remove unused CmmInfo wrapper type (replace with CmmInfoTable)
       - squash Area and AreaId together, remove now-unused RegSlot
       - comment out old unused stack-allocation code that no longer
         compiles after removal of RegSlot
  16. 03 Feb, 2012 1 commit
  17. 30 Jan, 2012 1 commit
  18. 25 Jan, 2012 1 commit
  19. 23 Jan, 2012 1 commit
  20. 18 Jan, 2012 1 commit
  21. 19 Dec, 2011 1 commit
  22. 04 Nov, 2011 1 commit
  23. 25 Aug, 2011 1 commit
  24. 19 Aug, 2011 1 commit
  25. 28 Jun, 2011 1 commit
  26. 17 Jun, 2011 1 commit
    • Edward Z. Yang's avatar
      Port MachOp folding to new code generator. · b8e0ce7b
      Edward Z. Yang authored
          * Rewrote cmmMachOpFold to cmmMachOpFoldM, which returns
            Nothing if no folding took place.
          * Wrote some generic mapping functions which take functions
            of form 'a -> Maybe a' and are smart about sharing.
          * Split up optimizations from PIC and PPC work in the native
            codegen, so they'll be easier to turn off later
            (they are not currently being turned off, however.)
          * Whitespace fixes!
      ToDo: Turn off MachOp folding when new codegenerator is being used.
      Signed-off-by: Edward Z. Yang's avatarEdward Z. Yang <ezyang@mit.edu>
  27. 13 Jun, 2011 1 commit
  28. 15 May, 2011 2 commits
  29. 09 May, 2011 1 commit
  30. 11 Apr, 2011 1 commit
    • Edward Z. Yang's avatar
      Unsafe foreign calls (fat machine instructions) do not kill all registers. · 8a0ab97b
      Edward Z. Yang authored
      The new code generator was doing some interesting spilling across
      unsafe foreign calls:
           _c1ao::I32 = Hp - 4;
           I32[Sp - 20] = _c1ao::I32;
           foreign "ccall"
             newCAF((BaseReg, PtrHint), (R1, PtrHint))[_unsafe_call_];
           _c1ao::I32 = I32[Sp - 20];
      This is fairly unnecessary, and resulted from over-conservative
      liveness analysis from CmmLive.  We can see that the old code
      generator only saved volatile registers across unsafe foreign calls:
      spilling variables was done by saveVolatileVarsAndRegs, which was
      only performed for ordinary calls.
      This commit removes the excess kill from the liveness analysis, as well
      as the *redundant* excess kill from spilling-and-reloading, and adds a
      note to CmmNode to this effect.  The only registers we need to kill
      are the ones that the foreign call assigns to, just like any other
      machine instruction.
      Signed-off-by: Edward Z. Yang's avatarEdward Z. Yang <ezyang@mit.edu>
  31. 28 Jan, 2011 1 commit
  32. 24 Jan, 2011 1 commit
    • Simon Marlow's avatar
      Merge in new code generator branch. · 889c084e
      Simon Marlow authored
      This changes the new code generator to make use of the Hoopl package
      for dataflow analysis.  Hoopl is a new boot package, and is maintained
      in a separate upstream git repository (as usual, GHC has its own
      lagging darcs mirror in http://darcs.haskell.org/packages/hoopl).
      During this merge I squashed recent history into one patch.  I tried
      to rebase, but the history had some internal conflicts of its own
      which made rebase extremely confusing, so I gave up. The history I
      squashed was:
        - Update new codegen to work with latest Hoopl
        - Add some notes on new code gen to cmm-notes
        - Enable Hoopl lag package.
        - Add SPJ note to cmm-notes
        - Improve GC calls on new code generator.
      Work in this branch was done by:
         - Milan Straka <fox@ucw.cz>
         - John Dias <dias@cs.tufts.edu>
         - David Terei <davidterei@gmail.com>
      Edward Z. Yang <ezyang@mit.edu> merged in further changes from GHC HEAD
      and fixed a few bugs.