cvsuser     05/01/26 09:13:52

  Modified:    include/parrot smallobject.h
               src      headers.c pmc_freeze.c resources.c smallobject.c
  Log:
  GMS generational MS 3 - arena access macros
  * virtualize object scans in arenas
  * object_size is total size of item
  
  Revision  Changes    Path
  1.19      +20 -1     parrot/include/parrot/smallobject.h
  
  Index: smallobject.h
  ===================================================================
  RCS file: /cvs/public/parrot/include/parrot/smallobject.h,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- smallobject.h     25 Jan 2005 14:47:31 -0000      1.18
  +++ smallobject.h     26 Jan 2005 17:13:51 -0000      1.19
  @@ -101,7 +101,11 @@
   /* Tracked resource pool */
   struct Small_Object_Pool {
       struct Small_Object_Arena *last_Arena;
  -    size_t object_size;     /* size in bytes of an individual pool item */
  +    /* Size in bytes of an individual pool item. This size may include
  +     * a GC-system specific GC header.
  +     * See the macros below.
  +     */
  +    size_t object_size;
       size_t objects_per_alloc;
       size_t total_objects;
       size_t num_free_objects;    /* number of resources in the free pool */
  @@ -134,6 +138,21 @@
   #endif
   };
   
  +/*
  + * macros used in arena scan code to convert from object pointers
  + * to arena pointers ...
  + */
  +
  +#if PARROT_GC_GMS
  +#  define GC_HEADER_SIZE (sizeof(Gc_gms_hdr))
  +#  define PObj_to_ARENA(o) PObj_to_GMSH(o)
  +#  define ARENA_to_PObj(p) GMSH_to_PObj(p)
  +#else
  +#  define GC_HEADER_SIZE 0
  +#  define PObj_to_ARENA(o) (o)
  +#  define ARENA_to_PObj(p) (p)
  +#endif
  +
   INTVAL contained_in_pool(Interp *,
                            struct Small_Object_Pool *, void *);
   size_t get_max_pool_address(Interp *interpreter,
  
  
  
  1.66      +4 -3      parrot/src/headers.c
  
  Index: headers.c
  ===================================================================
  RCS file: /cvs/public/parrot/src/headers.c,v
  retrieving revision 1.65
  retrieving revision 1.66
  diff -u -r1.65 -r1.66
  --- headers.c 25 Jan 2005 15:59:30 -0000      1.65
  +++ headers.c 26 Jan 2005 17:13:52 -0000      1.66
  @@ -1,6 +1,6 @@
   /*
   Copyright: 2001-2003 The Perl Foundation.  All Rights Reserved.
  -$Id: headers.c,v 1.65 2005/01/25 15:59:30 leo Exp $
  +$Id: headers.c,v 1.66 2005/01/26 17:13:52 leo Exp $
   
   =head1 NAME
   
  @@ -59,8 +59,9 @@
       PObj_bufstart(buffer) = NULL;
       PObj_buflen(buffer) = 0;
   
  -    if (pool->object_size > sizeof(PObj))
  -        memset(buffer + 1, 0, pool->object_size - sizeof(PObj));
  +    if (pool->object_size  - GC_HEADER_SIZE > sizeof(PObj))
  +        memset(buffer + 1, 0,
  +                pool->object_size - sizeof(PObj) - GC_HEADER_SIZE);
       return buffer;
   }
   
  
  
  
  1.33      +2 -1      parrot/src/pmc_freeze.c
  
  Index: pmc_freeze.c
  ===================================================================
  RCS file: /cvs/public/parrot/src/pmc_freeze.c,v
  retrieving revision 1.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- pmc_freeze.c      13 Dec 2004 13:46:25 -0000      1.32
  +++ pmc_freeze.c      26 Jan 2005 17:13:52 -0000      1.33
  @@ -1,6 +1,6 @@
   /*
   Copyright: 2001-2003 The Perl Foundation.  All Rights Reserved.
  -$Id: pmc_freeze.c,v 1.32 2004/12/13 13:46:25 leo Exp $
  +$Id: pmc_freeze.c,v 1.33 2005/01/26 17:13:52 leo Exp $
   
   =head1 NAME
   
  @@ -1076,6 +1076,7 @@
       struct Small_Object_Pool *pool;
       ptrdiff_t ptr_diff;
   
  +    pmc = (PMC*)PObj_to_ARENA(pmc);
       pool = interpreter->arena_base->pmc_pool;
       for (arena = pool->last_Arena; arena; arena = arena->prev) {
           ptr_diff = (ptrdiff_t)pmc - (ptrdiff_t)arena->start_objects;
  
  
  
  1.132     +3 -2      parrot/src/resources.c
  
  Index: resources.c
  ===================================================================
  RCS file: /cvs/public/parrot/src/resources.c,v
  retrieving revision 1.131
  retrieving revision 1.132
  diff -u -r1.131 -r1.132
  --- resources.c       4 Nov 2004 12:52:26 -0000       1.131
  +++ resources.c       26 Jan 2005 17:13:52 -0000      1.132
  @@ -1,6 +1,6 @@
   /*
   Copyright: 2001-2003 The Perl Foundation.  All Rights Reserved.
  -$Id: resources.c,v 1.131 2004/11/04 12:52:26 leo Exp $
  +$Id: resources.c,v 1.132 2005/01/26 17:13:52 leo Exp $
   
   =head1 NAME
   
  @@ -254,9 +254,10 @@
           for (cur_buffer_arena = header_pool->last_Arena;
                   NULL != cur_buffer_arena;
                   cur_buffer_arena = cur_buffer_arena->prev) {
  -            Buffer *b = cur_buffer_arena->start_objects;
  +            Buffer *b;
               UINTVAL i;
   
  +            b = ARENA_to_PObj(cur_buffer_arena->start_objects);
               for (i = 0; i < cur_buffer_arena->used; i++) {
                   /* ! (immobile | on_free_list | constant | external | 
sysmem) */
                   if (PObj_buflen(b) && PObj_is_movable_TESTALL(b)) {
  
  
  
  1.56      +3 -1      parrot/src/smallobject.c
  
  Index: smallobject.c
  ===================================================================
  RCS file: /cvs/public/parrot/src/smallobject.c,v
  retrieving revision 1.55
  retrieving revision 1.56
  diff -u -r1.55 -r1.56
  --- smallobject.c     25 Jan 2005 15:59:30 -0000      1.55
  +++ smallobject.c     26 Jan 2005 17:13:52 -0000      1.56
  @@ -1,6 +1,6 @@
   /*
   Copyright: 2001-2003 The Perl Foundation.  All Rights Reserved.
  -$Id: smallobject.c,v 1.55 2005/01/25 15:59:30 leo Exp $
  +$Id: smallobject.c,v 1.56 2005/01/26 17:13:52 leo Exp $
   
   =head1 NAME
   
  @@ -47,6 +47,8 @@
   {
       struct Small_Object_Arena *arena;
   
  +    ptr = PObj_to_ARENA(ptr);
  +
       for (arena = pool->last_Arena; arena; arena = arena->prev) {
           ptrdiff_t ptr_diff = (ptrdiff_t)ptr - 
(ptrdiff_t)arena->start_objects;
   
  
  
  

Reply via email to