cvsuser     04/01/19 09:46:19

  Modified:    src      string.c
  Log:
  dont turn off GC during unmakeCOW
  
  Revision  Changes    Path
  1.169     +20 -15    parrot/src/string.c
  
  Index: string.c
  ===================================================================
  RCS file: /cvs/public/parrot/src/string.c,v
  retrieving revision 1.168
  retrieving revision 1.169
  diff -u -w -r1.168 -r1.169
  --- string.c  14 Jan 2004 10:21:06 -0000      1.168
  +++ string.c  19 Jan 2004 17:46:15 -0000      1.169
  @@ -1,7 +1,7 @@
   /* string.c
    *  Copyright: 2001-2003 The Perl Foundation.  All Rights Reserved.
    *  CVS Info
  - *     $Id: string.c,v 1.168 2004/01/14 10:21:06 leo Exp $
  + *     $Id: string.c,v 1.169 2004/01/19 17:46:15 leo Exp $
    *  Overview:
    *     This is the api definitions for the string subsystem
    *  Data Structure and Algorithms:
  @@ -52,29 +52,34 @@
    * allocated string
    * the header stays the same
    */
  +
   static void
   unmake_COW(struct Parrot_Interp *interpreter, STRING *s)
   {
       /* COW_FLAG | constant_FLAG | external_FLAG) */
       if (PObj_is_cowed_TESTALL(s)) {
  -        void *p;
  -        UINTVAL size, bsize;
  -        /* Make the copy point to only the portion of the string that
  -         * we are actually using. */
  -        p = s->strstart;
  -        size = s->bufused;
  -        bsize = s->buflen;
  +        STRING for_alloc;
  +
           /* Create new pool data for this header to use,
            * independant of the original COW data */
           PObj_constant_CLEAR(s);
  -        /* don't shorten string, string_append may use buflen
  -         *
  -         * block GC, p points into string memory
  +        /*
  +         * allocate a dummy strings memory
  +         * buflen might be bigger and used, so pass this length
  +         * also be sure not to allocate from the constant pool
  +         */
  +        PObj_constant_CLEAR(&for_alloc);
  +        Parrot_allocate_string(interpreter, &for_alloc, s->buflen);
  +        /*
  +         * now copy memory over
  +         */
  +        mem_sys_memcopy(for_alloc.strstart, s->strstart, s->bufused);
  +        /*
  +         * and finally use that string memory
            */
  -        Parrot_block_GC(interpreter);
  -        Parrot_allocate_string(interpreter, s, bsize);
  -        Parrot_unblock_GC(interpreter);
  -        mem_sys_memcopy(s->strstart, p, size);
  +        s->bufstart = for_alloc.bufstart;
  +        s->strstart = for_alloc.strstart;
  +        s->buflen   = for_alloc.buflen;
           /* COW_FLAG | external_FLAG | bufstart_external_FLAG immobile_FLAG */
           PObj_is_external_CLEARALL(s);
       }
  
  
  

Reply via email to