cvsuser     04/08/13 02:15:48

  Modified:    .        MANIFEST
               include/parrot parrot.h pobj.h
               jit/i386 jit_emit.h
               src      interpreter.c smallobject.c
  Added:       include/parrot settings.h
  Log:
  cleanup some DOD/GC stuff
  * mainly DOD/GC settings are in the new include/parrot/settings.h
  * split allocate_objects
  * put USE_CGP into settings.h
  
  Revision  Changes    Path
  1.719     +1 -0      parrot/MANIFEST
  
  Index: MANIFEST
  ===================================================================
  RCS file: /cvs/public/parrot/MANIFEST,v
  retrieving revision 1.718
  retrieving revision 1.719
  diff -u -w -r1.718 -r1.719
  --- MANIFEST  9 Aug 2004 21:53:46 -0000       1.718
  +++ MANIFEST  13 Aug 2004 09:15:05 -0000      1.719
  @@ -1861,6 +1861,7 @@
   include/parrot/runops_cores.h                     [devel]include
   include/parrot/rx.h                               [devel]include
   include/parrot/rxstacks.h                         [devel]include
  +include/parrot/settings.h                         [devel]include
   include/parrot/slice.h                            [devel]include
   include/parrot/smallobject.h                      [devel]include
   include/parrot/stacks.h                           [devel]include
  
  
  
  1.100     +2 -18     parrot/include/parrot/parrot.h
  
  Index: parrot.h
  ===================================================================
  RCS file: /cvs/public/parrot/include/parrot/parrot.h,v
  retrieving revision 1.99
  retrieving revision 1.100
  diff -u -w -r1.99 -r1.100
  --- parrot.h  30 Jul 2004 13:16:40 -0000      1.99
  +++ parrot.h  13 Aug 2004 09:15:14 -0000      1.100
  @@ -1,7 +1,7 @@
   /* parrot.h
    *  Copyright: 2001-2003 The Perl Foundation.  All Rights Reserved.
    *  CVS Info
  - *     $Id: parrot.h,v 1.99 2004/07/30 13:16:40 leo Exp $
  + *     $Id: parrot.h,v 1.100 2004/08/13 09:15:14 leo Exp $
    *  Overview:
    *     General header file includes for the parrot interpreter
    *  Data Structure and Algorithms:
  @@ -225,23 +225,7 @@
      used to make an empty block.  */
   #define UNUSED(a) if (a) {}
   
  -/* If you are trying to debug GC problems which only occur on large test cases,
  - * turning on GC_DEBUG should help make the problem appear with smaller data
  - * samples by reducing various numbers, and causing DOD and allocation runs
  - * to occur more frequently. It does significantly reduce performance. */
  -#ifndef DISABLE_GC_DEBUG
  -#  define DISABLE_GC_DEBUG 0
  -#endif /* DISABLE_GC_DEBUG */
  -
  -/* Helpful internal macro for testing whether we are currently
  - * debugging garbage collection and memory management. See also the
  - * definition of GC_VERBOSE in dod.c. */
  -#if DISABLE_GC_DEBUG
  -#  define GC_DEBUG(interp) 0
  -#else
  -#  define GC_DEBUG(interp) Interp_flags_TEST((interp), PARROT_GC_DEBUG_FLAG)
  -#endif /* DISABLE_GC_DEBUG */
  -
  +#include "parrot/settings.h"
   #include "parrot/enums.h"
   #include "parrot/platform.h"
   #include "parrot/platform_interface.h"
  
  
  
  1.48      +13 -3     parrot/include/parrot/pobj.h
  
  Index: pobj.h
  ===================================================================
  RCS file: /cvs/public/parrot/include/parrot/pobj.h,v
  retrieving revision 1.47
  retrieving revision 1.48
  diff -u -w -r1.47 -r1.48
  --- pobj.h    9 Aug 2004 14:50:56 -0000       1.47
  +++ pobj.h    13 Aug 2004 09:15:14 -0000      1.48
  @@ -1,7 +1,7 @@
   /* pobj.h
    *  Copyright: 2001-2003 The Perl Foundation.  All Rights Reserved.
    *  CVS Info
  - *     $Id: pobj.h,v 1.47 2004/08/09 14:50:56 leo Exp $
  + *     $Id: pobj.h,v 1.48 2004/08/13 09:15:14 leo Exp $
    *  Overview:
    *     Parrot Object data members and flags enum
    *  Data Structure and Algorithms:
  @@ -16,19 +16,29 @@
   #include "parrot/config.h"
   
   /*
  - * if define below is 1:
  + * if define below is 1 (see include/parrot/settings.h)
    *
    * live, on_free_list, special_PMC are kept in the pools arenas
    * this needs aligned memory
    */
   
  -#define ARENA_DOD_FLAGS 1
   
   #if ARENA_DOD_FLAGS && ! defined(PARROT_HAS_SOME_MEMALIGN)
   #  undef ARENA_DOD_FLAGS
   #  define ARENA_DOD_FLAGS 0
   #endif
   
  +/*
  + * when GC_IS_MALLOC is set at configure time, we turn off
  + * ARENA_DOD_FLAGS, because the additional flag setting needed
  + * for this mode isn't optimized. See src/dod.c used_cow() and clear_cow()
  + */
  +
  +#ifdef GC_IS_MALLOC
  +#  undef ARENA_DOD_FLAGS
  +#  define ARENA_DOD_FLAGS 0
  +#endif
  +
   
   typedef union UnionVal {
       struct {                    /* Buffers structure */
  
  
  
  1.1                  parrot/include/parrot/settings.h
  
  Index: settings.h
  ===================================================================
  /* settings.h
   *  Copyright: 2001-2004 The Perl Foundation.  All Rights Reserved.
   *  CVS Info
   *     $Id: settings.h,v 1.1 2004/08/13 09:15:14 leo Exp $
   *  Overview:
   *     Overall settings for Parrot
   *  Data Structure and Algorithms:
   *  History: initial version 2004.08.13
   *  Notes:
   *  References:
   */
  
  #if !defined(PARROT_SETTINGS_H_GUARD)
  #define PARROT_SETTINGS_H_GUARD
  
  /*
   * DOD/GC switches
   */
  
  /* If you are trying to debug GC problems which only occur on large test cases,
   * turning on GC_DEBUG should help make the problem appear with smaller data
   * samples by reducing various numbers, and causing DOD and allocation runs
   * to occur more frequently. It does significantly reduce performance. */
  #ifndef DISABLE_GC_DEBUG
  #  define DISABLE_GC_DEBUG 0
  #endif /* DISABLE_GC_DEBUG */
  
  /* Helpful internal macro for testing whether we are currently
   * debugging garbage collection and memory management. See also the
   * definition of GC_VERBOSE in dod.c. */
  #if DISABLE_GC_DEBUG
  #  define GC_DEBUG(interp) 0
  #else
  #  define GC_DEBUG(interp) Interp_flags_TEST((interp), PARROT_GC_DEBUG_FLAG)
  #endif /* DISABLE_GC_DEBUG */
  
  /*
   * The mark and sweep collector can run with 2 different setups.
   *
   * ARENA_DOD_FLAGS = 1:
   *
   *    DOD-related flags are in a separate area in the arena structure.
   *    This etup needs aligned arena memory. If aligned memory isn't
   *    provided by the C library, this switch gets turned off in
   *    include/parrot/pobj.h
   *
   * ARENA_DOD_FLAGS = 0
   *
   *    DOD-related flags are in the object header
   */
  
  #define ARENA_DOD_FLAGS 1
  
  /*
   * misc settings
   */
  
  /*
   * JIT/i386 can use the CGP run core for external functions instead
   * of calling the function version of the opcode
   *
   * This is for some reason currently slower, so it's turned off
   */
  
  #define PARROT_I386_JIT_CGP 0
  
  #endif /* PARROT_SETTINGS_H_GUARD */
  
  
  
  1.120     +2 -4      parrot/jit/i386/jit_emit.h
  
  Index: jit_emit.h
  ===================================================================
  RCS file: /cvs/public/parrot/jit/i386/jit_emit.h,v
  retrieving revision 1.119
  retrieving revision 1.120
  diff -u -w -r1.119 -r1.120
  --- jit_emit.h        21 Jul 2004 05:49:12 -0000      1.119
  +++ jit_emit.h        13 Aug 2004 09:15:28 -0000      1.120
  @@ -3,7 +3,7 @@
    *
    * i386
    *
  - * $Id: jit_emit.h,v 1.119 2004/07/21 05:49:12 leo Exp $
  + * $Id: jit_emit.h,v 1.120 2004/08/13 09:15:28 leo Exp $
    */
   
   #if !defined(PARROT_I386_JIT_EMIT_H_GUARD)
  @@ -11,9 +11,7 @@
   
   #include <assert.h>
   
  -/* #define USE_CGP */
  -
  -#if defined HAVE_COMPUTED_GOTO && defined __GNUC__ && defined USE_CGP
  +#if defined HAVE_COMPUTED_GOTO && defined __GNUC__ && PARROT_I386_JIT_CGP
   #  define JIT_CGP
   #endif
   
  
  
  
  1.316     +2 -3      parrot/src/interpreter.c
  
  Index: interpreter.c
  ===================================================================
  RCS file: /cvs/public/parrot/src/interpreter.c,v
  retrieving revision 1.315
  retrieving revision 1.316
  diff -u -w -r1.315 -r1.316
  --- interpreter.c     7 Aug 2004 11:32:25 -0000       1.315
  +++ interpreter.c     13 Aug 2004 09:15:48 -0000      1.316
  @@ -1,6 +1,6 @@
   /*
   Copyright: 2001-2003 The Perl Foundation.  All Rights Reserved.
  -$Id: interpreter.c,v 1.315 2004/08/07 11:32:25 leo Exp $
  +$Id: interpreter.c,v 1.316 2004/08/13 09:15:48 leo Exp $
   
   =head1 NAME
   
  @@ -50,7 +50,6 @@
   #include "parrot/method_util.h"
   #include "parrot/dynext.h"
   
  -/* #define USE_CGP */
   
   static void setup_event_func_ptrs(Parrot_Interp interpreter);
   
  @@ -468,7 +467,7 @@
       code_start = interpreter->code->byte_code;
       code_size = interpreter->code->cur_cs->base.size;
       code_end = interpreter->code->byte_code + code_size;
  -#  if defined HAVE_COMPUTED_GOTO && defined USE_CGP
  +#  if defined HAVE_COMPUTED_GOTO && PARROT_I386_JIT_CGP
   #    ifdef __GNUC__
   #      ifdef PARROT_I386
       init_prederef(interpreter, PARROT_CGP_CORE);
  
  
  
  1.48      +58 -35    parrot/src/smallobject.c
  
  Index: smallobject.c
  ===================================================================
  RCS file: /cvs/public/parrot/src/smallobject.c,v
  retrieving revision 1.47
  retrieving revision 1.48
  diff -u -w -r1.47 -r1.48
  --- smallobject.c     25 Jul 2004 10:40:30 -0000      1.47
  +++ smallobject.c     13 Aug 2004 09:15:48 -0000      1.48
  @@ -1,6 +1,6 @@
   /*
   Copyright: 2001-2003 The Perl Foundation.  All Rights Reserved.
  -$Id: smallobject.c,v 1.47 2004/07/25 10:40:30 leo Exp $
  +$Id: smallobject.c,v 1.48 2004/08/13 09:15:48 leo Exp $
   
   =head1 NAME
   
  @@ -285,6 +285,33 @@
   }
   
   /*
  + * insert the new arena into the pool's structure, update stats
  + */
  +static void
  +append_arena_in_pool(Interp *interpreter, struct Small_Object_Pool *pool,
  +    struct Small_Object_Arena *new_arena, size_t size)
  +{
  +
  +    /* Maintain the *_arena_memory invariant for stack walking code. Set it
  +     * regardless if we're the first pool to be added. */
  +    if (!pool->last_Arena
  +            || (pool->start_arena_memory > (size_t)new_arena->start_objects))
  +        pool->start_arena_memory = (size_t)new_arena->start_objects;
  +
  +    if (!pool->last_Arena || (pool->end_arena_memory <
  +                (size_t)new_arena->start_objects + size))
  +        pool->end_arena_memory = (size_t)new_arena->start_objects + size;
  +    new_arena->total_objects = pool->objects_per_alloc;
  +    new_arena->next = NULL;
  +    new_arena->prev = pool->last_Arena;
  +    if (new_arena->prev) {
  +        new_arena->prev->next = new_arena;
  +    }
  +    pool->last_Arena = new_arena;
  +    interpreter->arena_base->header_allocs_since_last_collect++;
  +}
  +
  +/*
   
   =item C<void
   alloc_objects(Interp *interpreter,
  @@ -297,6 +324,7 @@
   
   */
   
  +#if ARENA_DOD_FLAGS
   void
   alloc_objects(Interp *interpreter,
           struct Small_Object_Pool *pool)
  @@ -306,7 +334,6 @@
       UINTVAL start, end;
   
       /* Setup memory for the new objects */
  -#if ARENA_DOD_FLAGS
       size_t offset;
   
       /* check old arena first */
  @@ -351,27 +378,7 @@
   #endif
       new_arena->dod_flags = mem_sys_allocate(ARENA_FLAG_SIZE(pool));
       new_arena->pool = pool;
  -#else
  -    new_arena = mem_sys_allocate(sizeof(struct Small_Object_Arena));
  -    if (!new_arena)
  -        PANIC("Out of arena memory");
  -    size = pool->object_size * pool->objects_per_alloc;
  -    /* could be mem_sys_allocate too, but calloc is fast */
  -    new_arena->start_objects = mem_sys_allocate_zeroed(size);
  -#endif
  -
  -    /* Maintain the *_arena_memory invariant for stack walking code. Set it
  -     * regardless if we're the first pool to be added. */
  -    if (!pool->last_Arena
  -            || (pool->start_arena_memory > (size_t)new_arena->start_objects))
  -        pool->start_arena_memory = (size_t)new_arena->start_objects;
  -
  -    if (!pool->last_Arena || (pool->end_arena_memory <
  -                    (size_t)new_arena->start_objects + size))
  -        pool->end_arena_memory = (size_t)new_arena->start_objects + size;
   
  -    /* Hook up the new object block into the object pool */
  -#if ARENA_DOD_FLAGS
       /* not the first one - put all on free list */
       if (pool->last_Arena) {
           start = 0;
  @@ -383,22 +390,37 @@
           end = 1024*2;
           assert(end < pool->objects_per_alloc);
       }
  +    /* Hook up the new object block into the object pool */
  +    append_arena_in_pool(interpreter, pool, new_arena, size);
  +
  +    add_to_free_list(interpreter, pool, new_arena, start, end);
  +
  +}
  +
   #else
  +
  +void
  +alloc_objects(Interp *interpreter,
  +        struct Small_Object_Pool *pool)
  +{
  +    struct Small_Object_Arena *new_arena;
  +    size_t size;
  +    UINTVAL start, end;
  +
  +    /* Setup memory for the new objects */
  +    new_arena = mem_sys_allocate(sizeof(struct Small_Object_Arena));
  +    if (!new_arena)
  +        PANIC("Out of arena memory");
  +    size = pool->object_size * pool->objects_per_alloc;
  +    /* could be mem_sys_allocate too, but calloc is fast */
  +    new_arena->start_objects = mem_sys_allocate_zeroed(size);
  +
  +    append_arena_in_pool(interpreter, pool, new_arena, size);
  +
       start = 0;
       end = pool->objects_per_alloc;
  -#endif
  -    new_arena->total_objects = pool->objects_per_alloc;
  -    new_arena->next = NULL;
  -    new_arena->prev = pool->last_Arena;
  -    if (new_arena->prev) {
  -        new_arena->prev->next = new_arena;
  -    }
  -    pool->last_Arena = new_arena;
  -    interpreter->arena_base->header_allocs_since_last_collect++;
  -
       add_to_free_list(interpreter, pool, new_arena, start, end);
   
  -#if ! ARENA_DOD_FLAGS
       /* Allocate more next time */
       if (GC_DEBUG(interpreter)) {
           pool->objects_per_alloc *= GC_DEBUG_UNITS_PER_ALLOC_GROWTH_FACTOR;
  @@ -407,7 +429,8 @@
                   GC_DEBUG_REPLENISH_LEVEL_FACTOR);
       }
       else {
  -        pool->objects_per_alloc = (UINTVAL) pool->objects_per_alloc * 
UNITS_PER_ALLOC_GROWTH_FACTOR;
  +        pool->objects_per_alloc = (UINTVAL) pool->objects_per_alloc *
  +            UNITS_PER_ALLOC_GROWTH_FACTOR;
           pool->replenish_level =
                   (size_t)(pool->total_objects * REPLENISH_LEVEL_FACTOR);
       }
  @@ -417,8 +440,8 @@
       if (size > POOL_MAX_BYTES) {
           pool->objects_per_alloc = POOL_MAX_BYTES / pool->object_size;
       }
  -#endif
   }
  +#endif
   
   /*
   
  
  
  

Reply via email to