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

GHC ghc-devs at haskell.org
Sun Mar 9 10:35:49 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 managed to replicate a bug (#8867) in the out-of-line implementation.
 I've updated the attachment so the inline version doesn't have this bug.
 Now the Cmm generated for the example Haskell code above is:

 {{{
 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 + 152)) 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;
     }
 }
 }}}

 One question: even if the card table only uses one byte, do I have to zero
 out the whole word allocated for it?

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


More information about the ghc-tickets mailing list