cvsuser     02/11/09 01:13:52

  Modified:    include/parrot resources.h memory.h
               .        resources.c smallobject.c list.c res_lea.c
                        headers.c
  Log:
  allocate_zeroed
  
  Revision  Changes    Path
  1.40      +2 -1      parrot/include/parrot/resources.h
  
  Index: resources.h
  ===================================================================
  RCS file: /cvs/public/parrot/include/parrot/resources.h,v
  retrieving revision 1.39
  retrieving revision 1.40
  diff -u -w -r1.39 -r1.40
  --- resources.h       3 Nov 2002 21:15:17 -0000       1.39
  +++ resources.h       9 Nov 2002 09:13:47 -0000       1.40
  @@ -1,7 +1,7 @@
   /* register.h
    *  Copyright: (When this is determined...it will go here)
    *  CVS Info
  - *     $Id: resources.h,v 1.39 2002/11/03 21:15:17 leo Exp $
  + *     $Id: resources.h,v 1.40 2002/11/09 09:13:47 leo Exp $
    *  Overview:
    *     Defines the resource allocation API
    *  Data Structure and Algorithms:
  @@ -39,6 +39,7 @@
   
   
   void *Parrot_allocate(struct Parrot_Interp *, void *, size_t size);
  +void *Parrot_allocate_zeroed(struct Parrot_Interp *, void *, size_t size);
   void *Parrot_allocate_string(struct Parrot_Interp *, STRING *, size_t size);
   void *Parrot_reallocate(struct Parrot_Interp *interpreter,
                           void *from, size_t tosize);
  
  
  
  1.13      +4 -3      parrot/include/parrot/memory.h
  
  Index: memory.h
  ===================================================================
  RCS file: /cvs/public/parrot/include/parrot/memory.h,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -w -r1.12 -r1.13
  --- memory.h  4 Jul 2002 18:49:30 -0000       1.12
  +++ memory.h  9 Nov 2002 09:13:47 -0000       1.13
  @@ -1,7 +1,7 @@
   /* memory.h
    *  Copyright: (When this is determined...it will go here)
    *  CVS Info
  - *     $Id: memory.h,v 1.12 2002/07/04 18:49:30 mrjoltcola Exp $
  + *     $Id: memory.h,v 1.13 2002/11/09 09:13:47 leo Exp $
    *  Overview:
    *     This is the api header for the memory subsystem
    *  Data Structure and Algorithms:
  @@ -15,6 +15,8 @@
   
   void *mem_sys_allocate(size_t);
   
  +void *mem_sys_allocate_zeroed(size_t);
  +
   void *mem_sys_realloc(void *, size_t);
   
   void mem_sys_free(void *);
  @@ -25,7 +27,6 @@
   #define mem_allocate_new_stack() NULL
   #define mem_sys_memcopy memcpy
   #define mem_sys_memmove memmove
  -#define Parrot_mark_used_memory(a, b, c) mem_realloc(a, b, c, c)
   
   #endif
   
  
  
  
  1.99      +15 -11    parrot/resources.c
  
  Index: resources.c
  ===================================================================
  RCS file: /cvs/public/parrot/resources.c,v
  retrieving revision 1.98
  retrieving revision 1.99
  diff -u -w -r1.98 -r1.99
  --- resources.c       6 Nov 2002 05:02:46 -0000       1.98
  +++ resources.c       9 Nov 2002 09:13:52 -0000       1.99
  @@ -1,7 +1,7 @@
   /* resources.c
    *  Copyright: (When this is determined...it will go here)
    *  CVS Info
  - *     $Id: resources.c,v 1.98 2002/11/06 05:02:46 sfink Exp $
  + *     $Id: resources.c,v 1.99 2002/11/09 09:13:52 leo Exp $
    *  Overview:
    *     Allocate and deallocate tracked resources
    *  Data Structure and Algorithms:
  @@ -42,7 +42,7 @@
   
       /* Allocate a new block. Header info's on the front, plus a fudge factor
        * for good measure */
  -    new_block = mem_sys_allocate(sizeof(struct Memory_Block) +
  +    new_block = mem_sys_allocate_zeroed(sizeof(struct Memory_Block) +
               alloc_size + 32);
       if (!new_block) {
           return NULL;
  @@ -50,8 +50,6 @@
   
       new_block->free = alloc_size;
       new_block->size = alloc_size;
  -    new_block->next = NULL;
  -    new_block->prev = NULL;
       new_block->start = (char *)new_block + sizeof(struct Memory_Block);
       new_block->top = new_block->start;
   
  @@ -461,6 +459,12 @@
       ((Buffer *)buffer)->buflen = size;
       return buffer;
   }
  +void *
  +Parrot_allocate_zeroed(struct Parrot_Interp *interpreter,
  +        void *buffer, size_t size)
  +{
  +    return Parrot_allocate(interpreter, buffer, size);
  +}
   
   /* Allocate at least as much memory as they asked for. We round the
    * amount up to the allocation quantum */
  
  
  
  1.14      +3 -9      parrot/smallobject.c
  
  Index: smallobject.c
  ===================================================================
  RCS file: /cvs/public/parrot/smallobject.c,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -w -r1.13 -r1.14
  --- smallobject.c     3 Nov 2002 21:15:11 -0000       1.13
  +++ smallobject.c     9 Nov 2002 09:13:52 -0000       1.14
  @@ -1,7 +1,7 @@
   /* resources.c
    *  Copyright: (When this is determined...it will go here)
    *  CVS Info
  - *     $Id: smallobject.c,v 1.13 2002/11/03 21:15:11 leo Exp $
  + *     $Id: smallobject.c,v 1.14 2002/11/09 09:13:52 leo Exp $
    *  Overview:
    *     Handles the accessing of small object pools (header pools)
    *  Data Structure and Algorithms:
  @@ -99,7 +99,7 @@
       new_arena = mem_sys_allocate(sizeof(struct Small_Object_Arena));
   
       /* Setup memory for the new objects */
  -    new_arena->start_objects = mem_sys_allocate(size);
  +    new_arena->start_objects = mem_sys_allocate_zeroed(size);
   
       /* Maintain the *_arena_memory invariant for stack walking code. Set it
        * regardless if we're the first pool to be added. */
  @@ -149,18 +149,12 @@
   {
       struct Small_Object_Pool *pool;
   
  -    pool = mem_sys_allocate(sizeof(struct Small_Object_Pool));
  -    pool->last_Arena = NULL;
  +    pool = mem_sys_allocate_zeroed(sizeof(struct Small_Object_Pool));
       pool->object_size = object_size;
       pool->objects_per_alloc = objects_per_alloc;
  -    pool->total_objects = 0;
  -    pool->num_free_objects = 0;
  -    pool->replenish_level = 0;
  -    pool->free_list = NULL;
       pool->add_free_object = add_free_object;
       pool->get_free_object = get_free_object;
       pool->alloc_objects = alloc_objects;
  -    pool->mem_pool = NULL;
       return pool;
   }
   
  
  
  
  1.20      +2 -2      parrot/list.c
  
  Index: list.c
  ===================================================================
  RCS file: /cvs/public/parrot/list.c,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -w -r1.19 -r1.20
  --- list.c    8 Nov 2002 15:00:48 -0000       1.19
  +++ list.c    9 Nov 2002 09:13:52 -0000       1.20
  @@ -5,7 +5,7 @@
    *  Copyright: (c) 2002 Leopold Toetsch <[EMAIL PROTECTED]>
    *  License:  Artistic/GPL, see README and LICENSES for details
    *  CVS Info
  - *     $Id: list.c,v 1.19 2002/11/08 15:00:48 leo Exp $
  + *     $Id: list.c,v 1.20 2002/11/09 09:13:52 leo Exp $
    *  Overview:
    *     list aka array routines for Parrot
    *  History:
  @@ -187,7 +187,7 @@
       Parrot_block_GC(interpreter);
       chunk = (List_chunk *)new_bufferlike_header(interpreter, sizeof(*chunk));
       chunk->items = items;
  -    Parrot_allocate(interpreter, (Buffer *)chunk, size);
  +    Parrot_allocate_zeroed(interpreter, (Buffer *)chunk, size);
       Parrot_unblock_DOD(interpreter);
       Parrot_unblock_GC(interpreter);
       return chunk;
  
  
  
  1.6       +11 -0     parrot/res_lea.c
  
  Index: res_lea.c
  ===================================================================
  RCS file: /cvs/public/parrot/res_lea.c,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -w -r1.5 -r1.6
  --- res_lea.c 6 Nov 2002 08:52:07 -0000       1.5
  +++ res_lea.c 9 Nov 2002 09:13:52 -0000       1.6
  @@ -36,10 +36,21 @@
   Parrot_allocate(struct Parrot_Interp *interpreter, void *buffer, size_t size)
   {
       Buffer * b = buffer;
  +    b->bufstart = malloc(size);
  +    b->buflen = size;
  +    return b;
  +}
  +
  +void *
  +Parrot_allocate_zeroed(struct Parrot_Interp *interpreter, void *buffer,
  +        size_t size)
  +{
  +    Buffer * b = buffer;
       b->bufstart = calloc(1, size);
       b->buflen = size;
       return b;
   }
  +
   
   void *
   Parrot_reallocate_string(struct Parrot_Interp *interpreter, STRING *str,
  
  
  
  1.20      +2 -6      parrot/headers.c
  
  Index: headers.c
  ===================================================================
  RCS file: /cvs/public/parrot/headers.c,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -w -r1.19 -r1.20
  --- headers.c 6 Nov 2002 08:52:07 -0000       1.19
  +++ headers.c 9 Nov 2002 09:13:52 -0000       1.20
  @@ -1,7 +1,7 @@
   /* headers.c
    *  Copyright: (When this is determined...it will go here)
    *  CVS Info
  - *     $Id: headers.c,v 1.19 2002/11/06 08:52:07 leo Exp $
  + *     $Id: headers.c,v 1.20 2002/11/09 09:13:52 leo Exp $
    *  Overview:
    *     Header management functions. Handles getting of various headers,
    *     and pool creation
  @@ -280,14 +280,10 @@
   new_bufferlike_header(struct Parrot_Interp *interpreter, size_t size)
   {
       struct Small_Object_Pool *pool;
  -    Buffer *buffer;
   
       pool = get_bufferlike_pool(interpreter, size);
   
  -    buffer = get_free_buffer(interpreter, pool);
  -    buffer->bufstart = NULL;
  -    buffer->buflen = 0;
  -    return buffer;
  +    return get_free_buffer(interpreter, pool);
   }
   
   
  
  
  


Reply via email to