Author: Whiteknight
Date: Tue Aug 12 14:53:57 2008
New Revision: 30189

Modified:
   branches/gsoc_pdd09/compilers/imcc/cfg.h
   branches/gsoc_pdd09/compilers/imcc/instructions.h
   branches/gsoc_pdd09/compilers/imcc/symreg.h
   branches/gsoc_pdd09/include/parrot/debugger.h
   branches/gsoc_pdd09/include/parrot/dod.h
   branches/gsoc_pdd09/include/parrot/exceptions.h
   branches/gsoc_pdd09/include/parrot/smallobject.h
   branches/gsoc_pdd09/include/parrot/sub.h
   branches/gsoc_pdd09/src/gc/gc_it.c

Log:
[gsoc_pdd09] Improve handling of freed items. make headerizer introduces some 
problems that I need to resolve before editing further

Modified: branches/gsoc_pdd09/compilers/imcc/cfg.h
==============================================================================
--- branches/gsoc_pdd09/compilers/imcc/cfg.h    (original)
+++ branches/gsoc_pdd09/compilers/imcc/cfg.h    Tue Aug 12 14:53:57 2008
@@ -59,45 +59,45 @@
         __attribute__nonnull__(1)
         __attribute__nonnull__(2);
 
-void build_cfg(PARROT_INTERP, ARGMOD(struct _IMC_Unit *unit))
+void build_cfg(PARROT_INTERP, ARGMOD(IMC_Unit *unit))
         __attribute__nonnull__(1)
         __attribute__nonnull__(2)
         FUNC_MODIFIES(*unit);
 
-void clear_basic_blocks(ARGMOD(struct _IMC_Unit *unit))
+void clear_basic_blocks(ARGMOD(IMC_Unit *unit))
         __attribute__nonnull__(1)
         FUNC_MODIFIES(*unit);
 
-void compute_dominance_frontiers(PARROT_INTERP, ARGMOD(struct _IMC_Unit *unit))
+void compute_dominance_frontiers(PARROT_INTERP, ARGMOD(IMC_Unit *unit))
         __attribute__nonnull__(1)
         __attribute__nonnull__(2)
         FUNC_MODIFIES(*unit);
 
-void compute_dominators(PARROT_INTERP, ARGMOD(struct _IMC_Unit *unit))
+void compute_dominators(PARROT_INTERP, ARGMOD(IMC_Unit *unit))
         __attribute__nonnull__(1)
         __attribute__nonnull__(2)
         FUNC_MODIFIES(*unit);
 
 PARROT_WARN_UNUSED_RESULT
-int edge_count(ARGIN(const struct _IMC_Unit *unit))
+int edge_count(ARGIN(const IMC_Unit *unit))
         __attribute__nonnull__(1);
 
-void find_basic_blocks(PARROT_INTERP, ARGMOD(struct _IMC_Unit *unit), int 
first)
+void find_basic_blocks(PARROT_INTERP, ARGMOD(IMC_Unit *unit), int first)
         __attribute__nonnull__(1)
         __attribute__nonnull__(2)
         FUNC_MODIFIES(*unit);
 
-void find_loops(PARROT_INTERP, ARGMOD(struct _IMC_Unit *unit))
+void find_loops(PARROT_INTERP, ARGMOD(IMC_Unit *unit))
         __attribute__nonnull__(1)
         __attribute__nonnull__(2)
         FUNC_MODIFIES(*unit);
 
-void free_life_info(ARGIN(const struct _IMC_Unit *unit), ARGMOD(SymReg *r))
+void free_life_info(ARGIN(const IMC_Unit *unit), ARGMOD(SymReg *r))
         __attribute__nonnull__(1)
         __attribute__nonnull__(2)
         FUNC_MODIFIES(*r);
 
-void life_analysis(PARROT_INTERP, ARGIN(const struct _IMC_Unit *unit))
+void life_analysis(PARROT_INTERP, ARGIN(const IMC_Unit *unit))
         __attribute__nonnull__(1)
         __attribute__nonnull__(2);
 
@@ -109,7 +109,7 @@
 
 PARROT_WARN_UNUSED_RESULT
 int natural_preheader(
-    ARGIN(const struct _IMC_Unit *unit),
+    ARGIN(const IMC_Unit *unit),
     ARGIN(const Loop_info* loop_info))
         __attribute__nonnull__(1)
         __attribute__nonnull__(2);

Modified: branches/gsoc_pdd09/compilers/imcc/instructions.h
==============================================================================
--- branches/gsoc_pdd09/compilers/imcc/instructions.h   (original)
+++ branches/gsoc_pdd09/compilers/imcc/instructions.h   Tue Aug 12 14:53:57 2008
@@ -103,7 +103,7 @@
 PARROT_API
 int emit_flush(PARROT_INTERP,
     ARGIN_NULLOK(void *param),
-    ARGIN(struct _IMC_Unit *unit))
+    ARGIN(IMC_Unit *unit))
         __attribute__nonnull__(1)
         __attribute__nonnull__(3);
 
@@ -113,7 +113,7 @@
 
 PARROT_WARN_UNUSED_RESULT
 PARROT_CAN_RETURN_NULL
-Instruction * _delete_ins(ARGMOD(struct _IMC_Unit *unit), ARGIN(Instruction 
*ins))
+Instruction * _delete_ins(ARGMOD(IMC_Unit *unit), ARGIN(Instruction *ins))
         __attribute__nonnull__(1)
         __attribute__nonnull__(2)
         FUNC_MODIFIES(*unit);
@@ -132,7 +132,7 @@
 
 PARROT_WARN_UNUSED_RESULT
 PARROT_CAN_RETURN_NULL
-Instruction * delete_ins(ARGMOD(struct _IMC_Unit *unit), ARGMOD(Instruction 
*ins))
+Instruction * delete_ins(ARGMOD(IMC_Unit *unit), ARGMOD(Instruction *ins))
         __attribute__nonnull__(1)
         __attribute__nonnull__(2)
         FUNC_MODIFIES(*unit)
@@ -140,7 +140,7 @@
 
 PARROT_CAN_RETURN_NULL
 Instruction * emitb(PARROT_INTERP,
-    ARGMOD_NULLOK(struct _IMC_Unit *unit),
+    ARGMOD_NULLOK(IMC_Unit *unit),
     ARGIN_NULLOK(Instruction *i))
         __attribute__nonnull__(1);
 
@@ -171,7 +171,7 @@
         __attribute__nonnull__(1);
 
 void insert_ins(
-    ARGMOD(struct _IMC_Unit *unit),
+    ARGMOD(IMC_Unit *unit),
     ARGMOD_NULLOK(Instruction *ins),
     ARGMOD(Instruction *tmp))
         __attribute__nonnull__(1)
@@ -191,7 +191,7 @@
 
 PARROT_CAN_RETURN_NULL
 Instruction * move_ins(
-    ARGMOD(struct _IMC_Unit *unit),
+    ARGMOD(IMC_Unit *unit),
     ARGMOD(Instruction *ins),
     ARGMOD(Instruction *to))
         __attribute__nonnull__(1)
@@ -202,7 +202,7 @@
         FUNC_MODIFIES(*to);
 
 void prepend_ins(
-    ARGMOD(struct _IMC_Unit *unit),
+    ARGMOD(IMC_Unit *unit),
     ARGMOD_NULLOK(Instruction *ins),
     ARGMOD(Instruction *tmp))
         __attribute__nonnull__(1)
@@ -211,7 +211,7 @@
         FUNC_MODIFIES(*tmp);
 
 void subst_ins(
-    ARGMOD(struct _IMC_Unit *unit),
+    ARGMOD(IMC_Unit *unit),
     ARGMOD(Instruction *ins),
     ARGMOD(Instruction *tmp),
     int needs_freeing)

Modified: branches/gsoc_pdd09/compilers/imcc/symreg.h
==============================================================================
--- branches/gsoc_pdd09/compilers/imcc/symreg.h (original)
+++ branches/gsoc_pdd09/compilers/imcc/symreg.h Tue Aug 12 14:53:57 2008
@@ -157,7 +157,7 @@
         FUNC_MODIFIES(*hsh)
         FUNC_MODIFIES(*r);
 
-void add_namespace(PARROT_INTERP, ARGMOD(struct _IMC_Unit *unit))
+void add_namespace(PARROT_INTERP, ARGMOD(IMC_Unit *unit))
         __attribute__nonnull__(1)
         __attribute__nonnull__(2)
         FUNC_MODIFIES(*unit);
@@ -191,7 +191,7 @@
 void clear_globals(PARROT_INTERP)
         __attribute__nonnull__(1);
 
-void clear_locals(ARGIN_NULLOK(struct _IMC_Unit *unit));
+void clear_locals(ARGIN_NULLOK(IMC_Unit *unit));
 void clear_sym_hash(ARGMOD(SymHash *hsh))
         __attribute__nonnull__(1)
         FUNC_MODIFIES(*hsh);

Modified: branches/gsoc_pdd09/include/parrot/debugger.h
==============================================================================
--- branches/gsoc_pdd09/include/parrot/debugger.h       (original)
+++ branches/gsoc_pdd09/include/parrot/debugger.h       Tue Aug 12 14:53:57 2008
@@ -175,6 +175,11 @@
 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END.  Your changes will 
be lost. */
 
 PARROT_API
+void Parrot_debugger_break(PARROT_INTERP, ARGIN(opcode_t * cur_opcode))
+        __attribute__nonnull__(1)
+        __attribute__nonnull__(2);
+
+PARROT_API
 void Parrot_debugger_init(PARROT_INTERP)
         __attribute__nonnull__(1);
 
@@ -188,11 +193,6 @@
         __attribute__nonnull__(2);
 
 PARROT_API
-void Parrot_debugger_break(PARROT_INTERP, ARGIN(opcode_t * cur_opcode))
-        __attribute__nonnull__(1)
-        __attribute__nonnull__(2);
-
-PARROT_API
 void PDB_load_source(PARROT_INTERP, ARGIN(const char *command))
         __attribute__nonnull__(1)
         __attribute__nonnull__(2);

Modified: branches/gsoc_pdd09/include/parrot/dod.h
==============================================================================
--- branches/gsoc_pdd09/include/parrot/dod.h    (original)
+++ branches/gsoc_pdd09/include/parrot/dod.h    Tue Aug 12 14:53:57 2008
@@ -277,6 +277,15 @@
 void Parrot_gc_it_run(PARROT_INTERP, int flags)
         __attribute__nonnull__(1);
 
+PARROT_INLINE
+void gc_it_add_free_header(SHIM_INTERP,
+    ARGMOD(struct Small_Object_Pool * pool),
+    ARGMOD(struct Gc_it_hdr * hdr))
+        __attribute__nonnull__(2)
+        __attribute__nonnull__(3)
+        FUNC_MODIFIES(* pool)
+        FUNC_MODIFIES(* hdr);
+
 PARROT_WARN_UNUSED_RESULT
 PARROT_INLINE
 UINTVAL gc_it_get_card_mark(ARGMOD(Gc_it_hdr *hdr))

Modified: branches/gsoc_pdd09/include/parrot/exceptions.h
==============================================================================
--- branches/gsoc_pdd09/include/parrot/exceptions.h     (original)
+++ branches/gsoc_pdd09/include/parrot/exceptions.h     Tue Aug 12 14:53:57 2008
@@ -201,7 +201,6 @@
 
 void Parrot_print_backtrace(void);
 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END.  Your changes will 
be lost. */
-/* Don't modify between HEADERIZER BEGIN / HEADERIZER END.  Your changes will 
be lost. */
 /* HEADERIZER END: src/exceptions.c */
 
 #define PANIC(interp, message) do_panic((interp), (message), __FILE__, 
__LINE__)

Modified: branches/gsoc_pdd09/include/parrot/smallobject.h
==============================================================================
--- branches/gsoc_pdd09/include/parrot/smallobject.h    (original)
+++ branches/gsoc_pdd09/include/parrot/smallobject.h    Tue Aug 12 14:53:57 2008
@@ -91,7 +91,7 @@
 
 /* Switches and modes */
 
-#  define GC_IT_DEBUG             0
+#  define GC_IT_DEBUG             1
 
 #  define GC_IT_INCREMENT_MODE    0
 #  define GC_IT_BATCH_MODE        1

Modified: branches/gsoc_pdd09/include/parrot/sub.h
==============================================================================
--- branches/gsoc_pdd09/include/parrot/sub.h    (original)
+++ branches/gsoc_pdd09/include/parrot/sub.h    Tue Aug 12 14:53:57 2008
@@ -316,13 +316,6 @@
         __attribute__nonnull__(2)
         __attribute__nonnull__(3);
 
-void Parrot_continuation_runloop_check(PARROT_INTERP,
-    ARGIN(PMC *pmc),
-    ARGIN(Parrot_cont *cc))
-        __attribute__nonnull__(1)
-        __attribute__nonnull__(2)
-        __attribute__nonnull__(3);
-
 PARROT_CAN_RETURN_NULL
 PARROT_WARN_UNUSED_RESULT
 PMC* Parrot_find_pad(PARROT_INTERP,

Modified: branches/gsoc_pdd09/src/gc/gc_it.c
==============================================================================
--- branches/gsoc_pdd09/src/gc/gc_it.c  (original)
+++ branches/gsoc_pdd09/src/gc/gc_it.c  Tue Aug 12 14:53:57 2008
@@ -627,7 +627,7 @@
         while (i >= 0) {
             mark = gc_it_get_card_mark(hdr);
             if (mark == GC_IT_CARD_WHITE) {
-                GC_IT_ADD_TO_FREE_LIST(pool, hdr);
+                gc_it_add_free_header(interp, pool, hdr);
                 gc_it_set_card_mark(hdr, GC_IT_CARD_FREE);
                 ++pool->num_free_objects;
             }
@@ -919,6 +919,11 @@
 Ideally, all items should be freed automatically, so this function should
 become obsolete. If it's no longer used, I will get rid of it.
 
+=item C<void gc_it_add_free_header>
+
+Takes a Gc_it_hdr object and adds it's corresponding object to the pool's
+free list.
+
 =cut
 
 */
@@ -929,13 +934,26 @@
     ARGMOD(void *to_add))
 {
     Gc_it_hdr * const hdr = PObj_to_IT_HDR(to_add);
+    gc_it_add_free_header(interp, pool, hdr);
+}
 
+PARROT_INLINE
+void
+gc_it_add_free_header(SHIM_INTERP, ARGMOD(struct Small_Object_Pool * pool),
+    ARGMOD(struct Gc_it_hdr * hdr))
+{
     /* If the item is already on the free list, short-circuit and return. If
        it's in the queue, we can't free it or we lose all the free objects
        in the queue after this one. So, in either case, we short circuit
        here and don't free the object manually. */
     if (hdr->next)
-        return;
+       return;
+
+#  if GC_IT_DEBUG
+    /* This check is costly but helpful. */
+    PARROT_ASSERT(contained_in_pool(pool, IT_HDR_to_PObj(hdr)));
+#  endif
+
     ++pool->num_free_objects;
 
     hdr->next       = (Gc_it_hdr *)pool->free_list;

Reply via email to