[svn:parrot] r41116 - in branches/gc-refactor/src: . gc pmc

jrtayloriv at svn.parrot.org jrtayloriv at svn.parrot.org
Mon Sep 7 15:48:11 UTC 2009


Author: jrtayloriv
Date: Mon Sep  7 15:48:09 2009
New Revision: 41116
URL: https://trac.parrot.org/parrot/changeset/41116

Log:
Removed unused GMS code from various places.

Modified:
   branches/gc-refactor/src/gc/alloc_resources.c
   branches/gc-refactor/src/gc/api.c
   branches/gc-refactor/src/gc/gc_private.h
   branches/gc-refactor/src/gc/mark_sweep.c
   branches/gc-refactor/src/hash.c
   branches/gc-refactor/src/list.c
   branches/gc-refactor/src/pmc/default.pmc
   branches/gc-refactor/src/pmc/fixedpmcarray.pmc
   branches/gc-refactor/src/pmc/fixedstringarray.pmc
   branches/gc-refactor/src/pmc/resizablepmcarray.pmc
   branches/gc-refactor/src/pmc/resizablestringarray.pmc
   branches/gc-refactor/src/pmc_freeze.c

Modified: branches/gc-refactor/src/gc/alloc_resources.c
==============================================================================
--- branches/gc-refactor/src/gc/alloc_resources.c	Mon Sep  7 15:35:04 2009	(r41115)
+++ branches/gc-refactor/src/gc/alloc_resources.c	Mon Sep  7 15:48:09 2009	(r41116)
@@ -418,17 +418,6 @@
         for (cur_buffer_arena = header_pool->last_Arena;
                 cur_buffer_arena;
                 cur_buffer_arena = cur_buffer_arena->prev) {
-            /*JT: Something like this is what we really want ...
-             *JT: if only I knew how to program C ...
-            if (interp->gc_sys->Arena_to_PObj){
-                Buffer *b =
-                    (Buffer *)
-                    interp->gc_sys->Arena_to_PObj(cur_buffer_arena->start_objects);
-            }
-            */
-
-            /*JT: but for now, we'll just cheat, since it's only GMS
-                  that needs that stuff anyway*/
             Buffer *b = (Buffer *) cur_buffer_arena->start_objects;
             UINTVAL i;
             const size_t objects_end = cur_buffer_arena->used;

Modified: branches/gc-refactor/src/gc/api.c
==============================================================================
--- branches/gc-refactor/src/gc/api.c	Mon Sep  7 15:35:04 2009	(r41115)
+++ branches/gc-refactor/src/gc/api.c	Mon Sep  7 15:48:09 2009	(r41116)
@@ -198,52 +198,40 @@
     /* TODO: Have each core register a ->pobject_lives function pointer in the
        Memory_Pools struct, and call that pointer directly instead of having a messy
        set of #if preparser conditions. */
-
-    if (interp->gc_sys->sys_type == GMS) {
-        /*
-        do {
-            if (!PObj_live_TEST(obj) &&
-                 PObj_to_GMSH(obj)->gen->gen_no >=
-                 interp->gc_sys->gc_sys_data.gms_data->gc_generation)
-                parrot_gc_gms_Parrot_gc_mark_PObj_alive(interp, obj);
-        } while (0);
-        break;
-        */
-    }
-    else {
-        /* if object is live or on free list return */
-        if (PObj_is_live_or_free_TESTALL(obj))
-            return;
+        
+    /* if object is live or on free list return */
+    if (PObj_is_live_or_free_TESTALL(obj))
+        return;
 
 #  if ! DISABLE_GC_DEBUG
 #    if GC_VERBOSE
-        if (CONSERVATIVE_POINTER_CHASING)
-            fprintf(stderr, "GC Warning! Unanchored %s %p found in system areas \n",
-                    PObj_is_PMC_TEST(obj) ? "PMC" : "Buffer", obj);
-
+    if (CONSERVATIVE_POINTER_CHASING)
+        fprintf(stderr, "GC Warning! Unanchored %s %p found in system areas \n",
+                PObj_is_PMC_TEST(obj) ? "PMC" : "Buffer", obj);
+    
 #    endif
 #  endif
-        /* mark it live */
-        PObj_live_SET(obj);
-
-        /* if object is a PMC and contains buffers or PMCs, then attach the PMC
-         * to the chained mark list. */
-        if (PObj_is_PMC_TEST(obj)) {
-            PMC * const p = (PMC *)obj;
-
-            if (PObj_is_special_PMC_TEST(obj))
-                mark_special(interp, p);
-
-            else if (PMC_metadata(p))
-                Parrot_gc_mark_PObj_alive(interp, (PObj*)PMC_metadata(p));
-        }
+    /* mark it live */
+    PObj_live_SET(obj);
+    
+    /* if object is a PMC and contains buffers or PMCs, then attach the PMC
+     * to the chained mark list. */
+    if (PObj_is_PMC_TEST(obj)) {
+        PMC * const p = (PMC *)obj;
+        
+        if (PObj_is_special_PMC_TEST(obj))
+            mark_special(interp, p);
+        
+        else if (PMC_metadata(p))
+            Parrot_gc_mark_PObj_alive(interp, (PObj*)PMC_metadata(p));
+    }
 #  if GC_VERBOSE
-        /* buffer GC_DEBUG stuff */
-        if (GC_DEBUG(interp) && PObj_report_TEST(obj))
-            fprintf(stderr, "GC: buffer %p pointing to %p marked live\n",
-                    obj, Buffer_bufstart((Buffer *)obj));
+    /* buffer GC_DEBUG stuff */
+    if (GC_DEBUG(interp) && PObj_report_TEST(obj))
+        fprintf(stderr, "GC: buffer %p pointing to %p marked live\n",
+                obj, Buffer_bufstart((Buffer *)obj));
 #  endif
-    }
+    
 }
 
 /*
@@ -275,23 +263,17 @@
 
     interp->gc_sys = mem_allocate_zeroed_typed(GC_Subsystem);
 
-    /*JT: This is set at compile time ... what we need to do next is
-     *    add a command-line switch --gc that will enable us to choose
-     *    a different one ... if --gc is set, we use it, otherwise use
-     *    the default  */
-    interp->gc_sys->sys_type = PARROT_GC_DEFAULT_TYPE;
-
-    /* Set the sys_type here if we got a --gc command line switch
-     * ... we need some sort of set_gc_sys_type_from_command_line_switch()
-     * function ...
-     */
-
+    /*TODO: add ability to specify GC core at command line w/ --gc= */
+    if(0) /*If they chose sys_type with the --gc command line switch,*/
+        ; /* set sys_type to value they gave */
+    else
+        interp->gc_sys->sys_type = PARROT_GC_DEFAULT_TYPE;
+    
     /*Call appropriate initialization function for GC subsystem*/
     switch (interp->gc_sys->sys_type) {
       case MS:
         Parrot_gc_ms_init(interp);
         break;
-      /* These currently don't work
       case IMS:
         Parrot_gc_ims_init(interp);
         break;
@@ -301,9 +283,9 @@
       case INF:
         Parrot_gc_inf_init(interp);
         break;
-       */
       default:
-        break;  /*What SHOULD we be doing if we get here?*/
+        /*die horribly because of invalid GC core specified*/
+        break;
     }
 
     initialize_var_size_pools(interp);
@@ -550,9 +532,9 @@
     Buffer_bufstart(buffer) = NULL;
     Buffer_buflen(buffer)   = 0;
 
-    if (pool->object_size - interp->gc_sys->header_size > sizeof (Buffer))
+    if (pool->object_size > sizeof (Buffer))
         memset(buffer + 1, 0,
-                pool->object_size - sizeof (Buffer) - interp->gc_sys->header_size);
+                pool->object_size - sizeof (Buffer));
 
     return buffer;
 }
@@ -979,7 +961,7 @@
     const UINTVAL       object_size = pool->object_size;
 
     for (cur_arena = pool->last_Arena; cur_arena; cur_arena = cur_arena->prev) {
-        PMC   *p = (PMC *)((char*)cur_arena->start_objects + dest_interp->gc_sys->header_size);
+        PMC   *p = (PMC *)((char*)cur_arena->start_objects);
         size_t i;
 
         for (i = 0; i < cur_arena->used; i++) {
@@ -1233,9 +1215,6 @@
     Fixed_Size_Arena *arena;
     Fixed_Size_Pool *pool;
 
-    if (interp->gc_sys->PObj_to_Arena){
-        pmc = (PMC*) interp->gc_sys->PObj_to_Arena(pmc);
-    }
     pool = interp->mem_pools->pmc_pool;
     for (arena = pool->last_Arena; arena; arena = arena->prev) {
         const ptrdiff_t ptr_diff = (ptrdiff_t)pmc - (ptrdiff_t)arena->start_objects;
@@ -1611,36 +1590,6 @@
     ++interp->mem_pools->num_early_gc_PMCs;
 }
 
-/*
-=item C<void Parrot_gc_write_barrier(PARROT_INTERP, PMC *agg, PMC *old, PMC
-*new)>
-
-Wrapper around write_barrier hook for currently active GC system ...
-
-=cut
-
-*/
-
-void
-Parrot_gc_write_barrier(PARROT_INTERP, PMC *agg, PMC *old, PMC *new){
-    interp->gc_sys->write_barrier(interp, agg, old, new);
-}
-
-/*
-=item C<void Parrot_gc_write_barrier_key(PARROT_INTERP, PMC *agg, PMC *old, PObj
-*old_key, PMC *_new, PObj *new_key)>
-
-Wrapper around write_barrier_key hook for currently active GC system ...
-
-=cut
-
-*/
-
-void
-Parrot_gc_write_barrier_key(PARROT_INTERP, PMC *agg, PMC *old, PObj *old_key, PMC *_new, PObj *new_key){
-    interp->gc_sys->write_barrier_key(interp, agg, old, old_key, _new, new_key);
-}
-
 
 /*
 

Modified: branches/gc-refactor/src/gc/gc_private.h
==============================================================================
--- branches/gc-refactor/src/gc/gc_private.h	Mon Sep  7 15:35:04 2009	(r41115)
+++ branches/gc-refactor/src/gc/gc_private.h	Mon Sep  7 15:48:09 2009	(r41116)
@@ -105,18 +105,9 @@
     void (*init_pool)(PARROT_INTERP, struct Fixed_Size_Pool *);
 
     /*Function hooks that GC systems can CHOOSE to provide if they need them
-     *These will be called from the GC API function Parrot_gc_func_name */
-    void (*write_barrier)(PARROT_INTERP, PMC *, PMC *, PMC *);
-    void (*write_barrier_key)(PARROT_INTERP, PMC *, PMC *, PObj *, PMC *, PObj *);
-    /*read_barrier hooks can go here later*/
-
-    /* functions used in arena scan code to convert from object pointers
-     * to arena pointers ... GMS only I think ...*/
-    void * (*PObj_to_Arena)(const void *);
-    PObj * (*Arena_to_PObj)(void *);
+     *These will be called via the GC API functions Parrot_gc_func_name
+     *e.g. read barrier && write barrier hooks can go here later ...*/
 
-    /*JT: this is only used by GMS afaict, but we'll keep it here for now ...*/
-    size_t header_size;
 } GC_Subsystem;
 
 typedef struct Memory_Block {

Modified: branches/gc-refactor/src/gc/mark_sweep.c
==============================================================================
--- branches/gc-refactor/src/gc/mark_sweep.c	Mon Sep  7 15:35:04 2009	(r41115)
+++ branches/gc-refactor/src/gc/mark_sweep.c	Mon Sep  7 15:48:09 2009	(r41116)
@@ -368,9 +368,6 @@
     ASSERT_ARGS(contained_in_pool)
     const Fixed_Size_Arena *arena;
 
-    if (interp->gc_sys->PObj_to_Arena){
-        ptr = interp->gc_sys->PObj_to_Arena(ptr);
-    }
     for (arena = pool->last_Arena; arena; arena = arena->prev) {
         const ptrdiff_t ptr_diff =
             (ptrdiff_t)ptr - (ptrdiff_t)arena->start_objects;

Modified: branches/gc-refactor/src/hash.c
==============================================================================
--- branches/gc-refactor/src/hash.c	Mon Sep  7 15:35:04 2009	(r41115)
+++ branches/gc-refactor/src/hash.c	Mon Sep  7 15:48:09 2009	(r41116)
@@ -1304,34 +1304,11 @@
 
     if (bucket) {
         if (hash->entry_type == enum_type_PMC && hash->container) {
-
-        /*JT: can't get this to work right now ...
-        if (interp->gc_sys->write_barrier_key) {
-            Parrot_gc_write_barrier_key(interp,
-                                              hash->container,
-                                              (PMC *)bucket->value,
-                                              bucket->key,
-                                              (PMC *)value,
-                                              key);
-        }
-        */
         }
         bucket->value = value;
     }
     else {
-        if (hash->entry_type == enum_type_PMC && hash->container) {
 
-        /*JT: can't get this to work right now ...
-        if (interp->gc_sys->write_barrier_key){
-            Parrot_gc_write_barrier_key(interp,
-                                              hash->container,
-                                              NULL,
-                                              NULL,
-                                              (PMC *)value,
-                                              key);
-        }
-        */
-        }
         bucket = hash->free_list;
 
         if (!bucket) {

Modified: branches/gc-refactor/src/list.c
==============================================================================
--- branches/gc-refactor/src/list.c	Mon Sep  7 15:35:04 2009	(r41115)
+++ branches/gc-refactor/src/list.c	Mon Sep  7 15:48:09 2009	(r41116)
@@ -383,14 +383,6 @@
     Parrot_gc_allocate_buffer_storage_aligned(interp, (Buffer *)chunk, size);
     memset(Buffer_bufstart((Buffer*)chunk), 0, size);
 
-    /* see also src/hash.c */
-    if (list->container) {
-        /*JT: not working now ... GMS only anyway
-        if (interp->gc_sys->write_barrier){
-            Parrot_gc_write_barrier(interp, list->container, 0, chunk);
-        }
-        */
-    }
     Parrot_unblock_GC_mark(interp);
 
     /* Parrot_unblock_GC_sweep(interp); */
@@ -519,14 +511,6 @@
                 Parrot_gc_reallocate_buffer_storage(interp, (Buffer *)prev,
                         MAX_ITEMS * list->item_size);
 
-                if (list->container) {
-                    /*JT: not working now ... GMS only anyway
-                    if (interp->gc_sys->write_barrier){
-                        Parrot_gc_write_barrier(interp, list->container, 0, prev);
-                    }
-                    */
-                }
-
                 mem_sys_memmove(
                         (char *) Buffer_bufstart(&prev->data) +
                         prev->items * list->item_size,
@@ -544,13 +528,7 @@
             else {
                 Parrot_gc_reallocate_buffer_storage(interp, (Buffer *)prev,
                         (prev->items + chunk->items) * list->item_size);
-                if (list->container) {
-                    /*JT: not working now ... GMS only anyway
-                    if (interp->gc_sys->write_barrier){
-                        Parrot_gc_write_barrier(interp, list->container, 0, prev);
-                    }
-                    */
-                }
+
                 mem_sys_memmove(
                         (char *) Buffer_bufstart(&prev->data) +
                         prev->items * list->item_size,
@@ -648,14 +626,6 @@
         Parrot_gc_reallocate_buffer_storage(interp, (Buffer *)list,
                 len * sizeof (List_chunk *));
 
-        if (list->container) {
-            /*JT: not working now ... GMS only anyway
-            if (interp->gc_sys->write_barrier){
-                Parrot_gc_write_barrier(interp, list->container, 0, list);
-            }
-            */
-        }
-
         list->collect_runs = Parrot_gc_count_collect_runs(interp);
     }
 
@@ -1151,14 +1121,6 @@
         Parrot_gc_reallocate_buffer_storage(interp, (Buffer *)chunk,
                 chunk->items * list->item_size);
 
-        if (list->container) {
-            /*JT: not working now ... GMS only anyway
-            if (interp->gc_sys->write_barrier){
-                Parrot_gc_write_barrier(interp, list->container, 0, chunk);
-            }
-            */
-        }
-
         chunk->flags |= no_power_2;
         chunk->flags &= ~sparse;
     }
@@ -1175,14 +1137,6 @@
         Parrot_gc_reallocate_buffer_storage(interp, (Buffer *)chunk,
                 chunk->items * list->item_size);
 
-        if (list->container) {
-            /*JT: not working now ... GMS only anyway
-            if (interp->gc_sys->write_barrier){
-                Parrot_gc_write_barrier(interp, list->container, 0, chunk);
-            }
-            */
-        }
-
         chunk->flags &= ~sparse;
 
         if (n3) {
@@ -1270,16 +1224,6 @@
         ((FLOATVAL *) Buffer_bufstart(&chunk->data))[idx] = *(FLOATVAL *)item;
         break;
     case enum_type_PMC:
-        if (list->container) {
-            /*JT: not working now ... GMS only anyway
-            if (interp->gc_sys->write_barrier){
-                Parrot_gc_write_barrier(interp,
-                                              list->container,
-                                              ((PMC **) Buffer_bufstart(&chunk->data))[idx],
-                                              (PMC *)item);
-            }
-            */
-        }
         ((PMC **) Buffer_bufstart(&chunk->data))[idx] = (PMC *)item;
         break;
     case enum_type_STRING:

Modified: branches/gc-refactor/src/pmc/default.pmc
==============================================================================
--- branches/gc-refactor/src/pmc/default.pmc	Mon Sep  7 15:35:04 2009	(r41115)
+++ branches/gc-refactor/src/pmc/default.pmc	Mon Sep  7 15:48:09 2009	(r41116)
@@ -231,11 +231,6 @@
     PMC *prop;
 
     PMC_metadata(self) = prop = pmc_new(interp, enum_class_Hash);
-    /*JT: not working now ... GMS only anyway
-    if (interp->gc_sys->write_barrier){
-        Parrot_gc_write_barrier(interp, self, NULL, prop);
-    }
-    */
     propagate_std_props(interp, self, prop);
     return prop;
 }

Modified: branches/gc-refactor/src/pmc/fixedpmcarray.pmc
==============================================================================
--- branches/gc-refactor/src/pmc/fixedpmcarray.pmc	Mon Sep  7 15:35:04 2009	(r41115)
+++ branches/gc-refactor/src/pmc/fixedpmcarray.pmc	Mon Sep  7 15:48:09 2009	(r41116)
@@ -543,11 +543,6 @@
                 _("FixedPMCArray: index out of bounds!"));
 
         data      = PMC_array(SELF);
-        /*JT: not working now ... GMS only anyway
-        if (interp->gc_sys->write_barrier){
-            Parrot_gc_write_barrier(INTERP, SELF, data[key], src);
-        }
-        */
         data[key] = src;
     }
 

Modified: branches/gc-refactor/src/pmc/fixedstringarray.pmc
==============================================================================
--- branches/gc-refactor/src/pmc/fixedstringarray.pmc	Mon Sep  7 15:35:04 2009	(r41115)
+++ branches/gc-refactor/src/pmc/fixedstringarray.pmc	Mon Sep  7 15:48:09 2009	(r41116)
@@ -436,11 +436,7 @@
                 "FixedStringArray: index out of bounds!");
 
         GET_ATTR_str_array(INTERP, SELF, str_array);
-        /*JT: not working now ... GMS only anyway
-        if (interp->gc_sys->write_barrier){
-            Parrot_gc_write_barrier(INTERP, SELF, str_array[key], value);
-        }
-        */
+
         str_array[key] = value;
     }
 

Modified: branches/gc-refactor/src/pmc/resizablepmcarray.pmc
==============================================================================
--- branches/gc-refactor/src/pmc/resizablepmcarray.pmc	Mon Sep  7 15:35:04 2009	(r41115)
+++ branches/gc-refactor/src/pmc/resizablepmcarray.pmc	Mon Sep  7 15:48:09 2009	(r41116)
@@ -266,11 +266,6 @@
             SELF.set_integer_native(key+1);
 
         data      = PMC_array(SELF);
-        /*JT: not working now ... GMS only anyway
-        if (interp->gc_sys->write_barrier){
-            Parrot_gc_write_barrier(INTERP, SELF, data[key], src);
-        }
-        */
 
         data[key] = src;
     }

Modified: branches/gc-refactor/src/pmc/resizablestringarray.pmc
==============================================================================
--- branches/gc-refactor/src/pmc/resizablestringarray.pmc	Mon Sep  7 15:35:04 2009	(r41115)
+++ branches/gc-refactor/src/pmc/resizablestringarray.pmc	Mon Sep  7 15:48:09 2009	(r41116)
@@ -86,11 +86,6 @@
             SELF.set_integer_native(key+1);
 
         GET_ATTR_str_array(INTERP, SELF, str_array);
-        /*JT: not working now ... GMS only anyway
-        if (interp->gc_sys->write_barrier){
-            Parrot_gc_write_barrier(INTERP, SELF, str_array[key], value);
-        }
-        */
         str_array[key] = value;
     }
 

Modified: branches/gc-refactor/src/pmc_freeze.c
==============================================================================
--- branches/gc-refactor/src/pmc_freeze.c	Mon Sep  7 15:35:04 2009	(r41115)
+++ branches/gc-refactor/src/pmc_freeze.c	Mon Sep  7 15:48:09 2009	(r41116)
@@ -1358,16 +1358,9 @@
     }
     if (!info->thaw_result)
         info->thaw_result = pmc;
-    else {
-        if (info->container) {
-            /*JT: not working now ... GMS only anyway            
-            if (interp->gc_sys->write_barrier){
-                Parrot_gc_write_barrier(interp, info->container, NULL, pmc);
-            }
-            */
-        }
+    else
         *info->thaw_ptr = pmc;
-    }
+
     list_assign(interp, (List *)PMC_data(info->id_list), id, pmc, enum_type_PMC);
 
     /* remember nested aggregates depth first */


More information about the parrot-commits mailing list