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

GHC cvs-ghc at haskell.org
Wed May 8 10:06:20 CEST 2013


#5925: Add inline version of newArray#
---------------------------------+------------------------------------------
    Reporter:  tibbe             |       Owner:                  
        Type:  feature request   |      Status:  new             
    Priority:  normal            |   Milestone:  7.6.2           
   Component:  Compiler          |     Version:  7.4.1           
    Keywords:                    |          Os:  Unknown/Multiple
Architecture:  Unknown/Multiple  |     Failure:  None/Unknown    
  Difficulty:  Unknown           |    Testcase:                  
   Blockedby:  4258              |    Blocking:                  
     Related:                    |  
---------------------------------+------------------------------------------

Comment(by simonpj):

 If the array size is fixed at compile time, it should be easy... the heap
 check can be aggregated with all the others at the start of the basic
 block.

 If the array size is not known at compile time, but somehow known to be
 small, then with the new codegen it should be possible to just emit an
 inline heap check.  EXCEPT that doing so could mess up downstream fixed-
 size checks.  Eg
 {{{
 let x = f v in
 let y = newArray# n# in
 let z = f w in
 ...
 }}}
 Absent the `newArray#` we'd have a single heap check that made sure there
 was enough space for both `x` and `z`.  But we can't do that if the
 `newArray#` in the middle allocates an unknown amount of space.  I suppose
 we could emit three heap checks... that would work I think.

 A related ticket is #2387 and #2289, where we'd like to put a heap check
 at the beginning of a primop case alternative, something that should now
 work just fine.

 Simon

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



More information about the ghc-tickets mailing list