[GHC] #5925: Add inline version of newArray#

GHC ghc-devs at haskell.org
Sun Mar 9 09:02:18 UTC 2014


#5925: Add inline version of newArray#
-------------------------------------+------------------------------------
        Reporter:  tibbe             |            Owner:  simonmar
            Type:  feature request   |           Status:  patch
        Priority:  normal            |        Milestone:  7.6.2
       Component:  Compiler          |          Version:  7.4.1
      Resolution:                    |         Keywords:
Operating System:  Unknown/Multiple  |     Architecture:  Unknown/Multiple
 Type of failure:  None/Unknown      |       Difficulty:  Unknown
       Test Case:                    |       Blocked By:  4258
        Blocking:                    |  Related Tickets:
-------------------------------------+------------------------------------

Comment (by tibbe):

 I've updated the patch to try to split out the array closure allocation
 code into a helper function. I'm currently trying to get validate to pass.

 If it helps reviewing, here's an output example.

 Input function:

 {{{#!haskell
 newArray :: IO ()
 newArray = IO $ \s -> case newArray# 16# () s of
                         (# s', arr #) -> (# s', () #)
 }}}

 Output Cmm:

 {{{
 Main.newArray1_entry() //  []
         { [(c3fD,
             Main.newArray1_info:
                 const 4294967299;
                 const 0;
                 const 15;)]
         }
     {offset
       c3fD:
           Hp = Hp + 160;
           if (Hp > I64[BaseReg + 856]) goto c3fH; else goto c3fG;
       c3fH:
           I64[BaseReg + 904] = 160;
           R1 = PicBaseReg + Main.newArray1_closure;
           call (I64[BaseReg - 8])(R1) args: 8, res: 0, upd: 8;
       c3fG:
           I64[Hp - 152] = I64[PicBaseReg +
 stg_MUT_ARR_PTRS_DIRTY_info at GOTPCREL];
           I64[Hp - 144] = 16;
           I64[Hp - 136] = 17;
           _c3fr::I64 = Hp - 152;
           _c3fs::I64 = _c3fr::I64 + 24;
           goto c3ft;
       c3ft:
           if (_c3fs::I64 < (_c3fr::I64 + 128)) goto c3fv; else goto c3fu;
       c3fv:
           I64[_c3fs::I64] = PicBaseReg + (GHC.Tuple.()_closure+1);
           _c3fs::I64 = _c3fs::I64 + 8;
           goto c3ft;
       c3fu:
           call MO_Memset(_c3fs::I64, 0, 1, 8);
           R1 = PicBaseReg + (GHC.Tuple.()_closure+1);
           call (P64[Sp])(R1) args: 8, res: 0, upd: 8;
     }
 }
 }}}

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/5925#comment:18>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list