#5556: Support pin-changing on ByteArray#s
---------------------------------+------------------------------------------
    Reporter:  pumpkin           |       Owner:              
        Type:  feature request   |      Status:  new         
    Priority:  normal            |   Component:  Compiler    
     Version:  7.2.1             |    Keywords:              
    Testcase:                    |   Blockedby:              
          Os:  Unknown/Multiple  |    Blocking:              
Architecture:  Unknown/Multiple  |     Failure:  None/Unknown
---------------------------------+------------------------------------------

Comment(by AntoineLatter):

 Replying to [comment:1 AntoineLatter]:
 > I think Johan suggested a while back that it might be easier to have an
 'isPinned' primop, and then implement 'withPinned' in terms of that (and
 copying, for unpinned ByteArrays).

 I found what I'd tried towards this. I'm fairly inept at Cmm so I don't
 think I ever got it to build, but you can get the general idea:

 {{{
 stg_pinnedByteArrayzh
 {
     /* Args: R1 = pointer to heap data */

     // Is the byte array pinned?
     // This assumes that large objects are pinned

     W_ ptr, bd, ret;
     REP_bdescr_flags flags;

     ptr = R1;
     bd = Bdescr(ptr);
     flags = bdescr_flags(bd);

     if ( flags & (BF_LARGE::REP_bdescr_flags |
 BF_PINNED::REP_bdescr_flags) == 0::REP_bdescr_flags )
     {
       ret = 0::W_;
     } else {
       ret = 1::W_;
     }

     RET_N(ret);
 }
 }}}

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

_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to