[svn:parrot] r44291 - in trunk: compilers/imcc config/gen/crypto config/gen/makefiles config/gen/platform config/gen/platform/generic include/parrot lib/Parrot/Ops2c src src/call src/dynpmc src/gc src/interp src/io src/packfile src/pmc src/runcore src/string src/string/encoding t/pmc

bacek at svn.parrot.org bacek at svn.parrot.org
Mon Feb 22 09:28:45 UTC 2010


Author: bacek
Date: Mon Feb 22 09:28:39 2010
New Revision: 44291
URL: https://trac.parrot.org/parrot/changeset/44291

Log:
Merge branch 'sys_mem' into trunk

Modified:
   trunk/compilers/imcc/cfg.c
   trunk/compilers/imcc/cfg.h
   trunk/compilers/imcc/imc.c
   trunk/compilers/imcc/imcc.l
   trunk/compilers/imcc/imcc.y
   trunk/compilers/imcc/imclexer.c
   trunk/compilers/imcc/imcparser.c
   trunk/compilers/imcc/imcparser.h
   trunk/compilers/imcc/instructions.c
   trunk/compilers/imcc/optimizer.c
   trunk/compilers/imcc/parser_util.c
   trunk/compilers/imcc/pbc.c
   trunk/compilers/imcc/pcc.c
   trunk/compilers/imcc/reg_alloc.c
   trunk/compilers/imcc/sets.c
   trunk/compilers/imcc/sets.h
   trunk/compilers/imcc/symreg.c
   trunk/compilers/imcc/symreg.h
   trunk/config/gen/crypto/digest_pmc.in
   trunk/config/gen/makefiles/root.in
   trunk/config/gen/platform/generic/exec.c
   trunk/config/gen/platform/platform_interface.h
   trunk/include/parrot/charset.h
   trunk/include/parrot/debugger.h
   trunk/include/parrot/encoding.h
   trunk/include/parrot/gc_api.h
   trunk/include/parrot/memory.h
   trunk/include/parrot/oplib.h
   trunk/include/parrot/packfile.h
   trunk/lib/Parrot/Ops2c/Utils.pm
   trunk/src/call/args.c
   trunk/src/call/ops.c
   trunk/src/debug.c
   trunk/src/dynext.c
   trunk/src/dynpmc/gdbmhash.pmc
   trunk/src/dynpmc/rational.pmc
   trunk/src/embed.c
   trunk/src/events.c
   trunk/src/exit.c
   trunk/src/frame_builder.c
   trunk/src/gc/alloc_memory.c
   trunk/src/gc/api.c
   trunk/src/gc/gc_inf.c
   trunk/src/gc/gc_ms.c
   trunk/src/gc/gc_private.h
   trunk/src/interp/inter_create.c
   trunk/src/io/buffer.c
   trunk/src/io/core.c
   trunk/src/multidispatch.c
   trunk/src/oo.c
   trunk/src/packfile.c
   trunk/src/packfile/pf_items.c
   trunk/src/pbc_dump.c
   trunk/src/pbc_merge.c
   trunk/src/pmc/bigint.pmc
   trunk/src/pmc/bignum.pmc
   trunk/src/pmc/callcontext.pmc
   trunk/src/pmc/fixedbooleanarray.pmc
   trunk/src/pmc/fixedfloatarray.pmc
   trunk/src/pmc/fixedintegerarray.pmc
   trunk/src/pmc/fixedpmcarray.pmc
   trunk/src/pmc/fixedstringarray.pmc
   trunk/src/pmc/managedstruct.pmc
   trunk/src/pmc/nci.pmc
   trunk/src/pmc/opcode.pmc
   trunk/src/pmc/oplib.pmc
   trunk/src/pmc/orderedhash.pmc
   trunk/src/pmc/os.pmc
   trunk/src/pmc/packfile.pmc
   trunk/src/pmc/packfileannotations.pmc
   trunk/src/pmc/packfileconstanttable.pmc
   trunk/src/pmc/packfilefixupentry.pmc
   trunk/src/pmc/packfilefixuptable.pmc
   trunk/src/pmc/packfilerawsegment.pmc
   trunk/src/pmc/parrotinterpreter.pmc
   trunk/src/pmc/resizablebooleanarray.pmc
   trunk/src/pmc/resizablefloatarray.pmc
   trunk/src/pmc/resizableintegerarray.pmc
   trunk/src/pmc/resizablepmcarray.pmc
   trunk/src/pmc/resizablestringarray.pmc
   trunk/src/pmc/sockaddr.pmc
   trunk/src/pmc/sub.pmc
   trunk/src/runcore/cores.c
   trunk/src/runcore/main.c
   trunk/src/runcore/profiling.c
   trunk/src/string/api.c
   trunk/src/string/charset.c
   trunk/src/string/encoding.c
   trunk/src/string/encoding/utf16.c
   trunk/src/string/encoding/utf8.c
   trunk/src/string/primitives.c
   trunk/src/thread.c
   trunk/src/tsq.c
   trunk/src/utils.c
   trunk/src/vtables.c
   trunk/t/pmc/fixedbooleanarray.t

Modified: trunk/compilers/imcc/cfg.c
==============================================================================
--- trunk/compilers/imcc/cfg.c	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/compilers/imcc/cfg.c	Mon Feb 22 09:28:39 2010	(r44291)
@@ -35,27 +35,30 @@
 /* HEADERIZER BEGIN: static */
 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END.  Your changes will be lost. */
 
-static void analyse_life_block(
+static void analyse_life_block(PARROT_INTERP,
     ARGIN(const Basic_block* bb),
     ARGMOD(SymReg *r))
         __attribute__nonnull__(1)
         __attribute__nonnull__(2)
+        __attribute__nonnull__(3)
         FUNC_MODIFIES(*r);
 
-static void analyse_life_symbol(
+static void analyse_life_symbol(PARROT_INTERP,
     ARGIN(const IMC_Unit *unit),
     ARGMOD(SymReg* r))
         __attribute__nonnull__(1)
         __attribute__nonnull__(2)
+        __attribute__nonnull__(3)
         FUNC_MODIFIES(* r);
 
-static void bb_add_edge(
+static void bb_add_edge(PARROT_INTERP,
     ARGMOD(IMC_Unit *unit),
     ARGIN(Basic_block *from),
     ARGMOD(Basic_block *to))
         __attribute__nonnull__(1)
         __attribute__nonnull__(2)
         __attribute__nonnull__(3)
+        __attribute__nonnull__(4)
         FUNC_MODIFIES(*unit)
         FUNC_MODIFIES(*to);
 
@@ -110,17 +113,19 @@
         __attribute__nonnull__(1)
         FUNC_MODIFIES(*unit);
 
-static void init_basic_blocks(ARGMOD(IMC_Unit *unit))
+static void init_basic_blocks(PARROT_INTERP, ARGMOD(IMC_Unit *unit))
         __attribute__nonnull__(1)
+        __attribute__nonnull__(2)
         FUNC_MODIFIES(*unit);
 
 PARROT_CANNOT_RETURN_NULL
 PARROT_WARN_UNUSED_RESULT
-static Basic_block* make_basic_block(
+static Basic_block* make_basic_block(PARROT_INTERP,
     ARGMOD(IMC_Unit *unit),
     ARGMOD(Instruction *ins))
         __attribute__nonnull__(1)
         __attribute__nonnull__(2)
+        __attribute__nonnull__(3)
         FUNC_MODIFIES(*unit)
         FUNC_MODIFIES(*ins);
 
@@ -145,13 +150,16 @@
         __attribute__nonnull__(2);
 
 #define ASSERT_ARGS_analyse_life_block __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(bb) \
+       PARROT_ASSERT_ARG(interp) \
+    , PARROT_ASSERT_ARG(bb) \
     , PARROT_ASSERT_ARG(r))
 #define ASSERT_ARGS_analyse_life_symbol __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(unit) \
+       PARROT_ASSERT_ARG(interp) \
+    , PARROT_ASSERT_ARG(unit) \
     , PARROT_ASSERT_ARG(r))
 #define ASSERT_ARGS_bb_add_edge __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(unit) \
+       PARROT_ASSERT_ARG(interp) \
+    , PARROT_ASSERT_ARG(unit) \
     , PARROT_ASSERT_ARG(from) \
     , PARROT_ASSERT_ARG(to))
 #define ASSERT_ARGS_bb_check_set_addr __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
@@ -180,9 +188,11 @@
 #define ASSERT_ARGS_free_loops __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(unit))
 #define ASSERT_ARGS_init_basic_blocks __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(unit))
+       PARROT_ASSERT_ARG(interp) \
+    , PARROT_ASSERT_ARG(unit))
 #define ASSERT_ARGS_make_basic_block __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(unit) \
+       PARROT_ASSERT_ARG(interp) \
+    , PARROT_ASSERT_ARG(unit) \
     , PARROT_ASSERT_ARG(ins))
 #define ASSERT_ARGS_mark_loop __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp) \
@@ -267,7 +277,7 @@
     unsigned int          i;
 
     IMCC_info(interp, 2, "find_basic_blocks\n");
-    init_basic_blocks(unit);
+    init_basic_blocks(interp, unit);
 
     for (i = 0; i < hsh->size; i++) {
         SymReg *r;
@@ -288,7 +298,7 @@
 
     ins->index = i = 0;
 
-    bb         = make_basic_block(unit, ins);
+    bb         = make_basic_block(interp, unit, ins);
 
     if (ins->type & ITBRANCH) {
         SymReg * const addr = get_branch_reg(bb->end);
@@ -326,7 +336,7 @@
             nu = 0;
         else if (ins->type & ITLABEL) {
             bb->end = ins->prev;
-            bb      = make_basic_block(unit, ins);
+            bb      = make_basic_block(interp, unit, ins);
         }
 
         /* a branch is the end of a basic block
@@ -342,7 +352,7 @@
                 continue;
 
             if (ins->next)
-                bb = make_basic_block(unit, ins->next);
+                bb = make_basic_block(interp, unit, ins->next);
 
             nu = 1;
         }
@@ -380,8 +390,8 @@
                     ins->symregs[1]->name);
 
             /* connect this block with first and last block */
-            bb_add_edge(unit, unit->bb_list[0], bb);
-            bb_add_edge(unit, unit->bb_list[unit->n_basic_blocks - 1], bb);
+            bb_add_edge(interp, unit, unit->bb_list[0], bb);
+            bb_add_edge(interp, unit, unit->bb_list[unit->n_basic_blocks - 1], bb);
 
             /* and mark the instruction as being kind of a branch */
             bb->start->type |= ITADDR;
@@ -419,7 +429,7 @@
 
         /* if the block can fall-through */
         if (i > 0 && ! (last->end->type & IF_goto))
-            bb_add_edge(unit, last, bb);
+            bb_add_edge(interp, unit, last, bb);
 
         /* check first ins, if label try to find a set_addr op */
         if (bb->start->type & ITLABEL)
@@ -433,7 +443,7 @@
         else if (STREQ(bb->start->opname, "invoke")
              ||  STREQ(bb->start->opname, "invokecc")) {
             if (check_invoke_type(interp, unit, bb->start) == INVOKE_SUB_LOOP)
-                bb_add_edge(unit, bb, unit->bb_list[0]);
+                bb_add_edge(interp, unit, bb, unit->bb_list[0]);
         }
 
         last = bb;
@@ -486,14 +496,14 @@
     const SymReg * const r = find_sym(interp, label->name);
 
     if (r && (r->type & VTADDRESS) && r->first_ins)
-        bb_add_edge(unit, from, unit->bb_list[r->first_ins->bbindex]);
+        bb_add_edge(interp, unit, from, unit->bb_list[r->first_ins->bbindex]);
     else {
         IMCC_debug(interp, DEBUG_CFG, "register branch %I ", from->end);
         for (ins = from->end; ins; ins = ins->prev) {
             if ((ins->type & ITBRANCH)
             &&   STREQ(ins->opname, "set_addr")
             &&   ins->symregs[1]->first_ins) {
-                bb_add_edge(unit, from,
+                bb_add_edge(interp, unit, from,
                     unit-> bb_list[ins->symregs[1]->first_ins->bbindex]);
                 IMCC_debug(interp, DEBUG_CFG, "(%s) ", ins->symregs[1]->name);
                 break;
@@ -538,8 +548,8 @@
 
 /*
 
-=item C<static void bb_add_edge(IMC_Unit *unit, Basic_block *from, Basic_block
-*to)>
+=item C<static void bb_add_edge(PARROT_INTERP, IMC_Unit *unit, Basic_block
+*from, Basic_block *to)>
 
 Adds an edge between the two given blocks.
 
@@ -548,8 +558,10 @@
 */
 
 static void
-bb_add_edge(ARGMOD(IMC_Unit *unit), ARGIN(Basic_block  *from),
-                                    ARGMOD(Basic_block *to))
+bb_add_edge(PARROT_INTERP,
+        ARGMOD(IMC_Unit *unit),
+        ARGIN(Basic_block  *from),
+        ARGMOD(Basic_block *to))
 {
     ASSERT_ARGS(bb_add_edge)
     Edge *e;
@@ -558,7 +570,7 @@
 
     /* we assume that the data is correct, and thus if the edge is not
      * on the predecessors of 'from', it won't be on the successors of 'to' */
-    e             = mem_allocate_typed(Edge);
+    e             = mem_gc_allocate_typed(interp, Edge);
 
     e->succ_next  = from->succ_list;
     e->from       = from;
@@ -708,13 +720,14 @@
     IMCC_info(interp, 2, "life_analysis\n");
 
     for (i = 0; i < unit->n_symbols; i++)
-        analyse_life_symbol(unit, reglist[i]);
+        analyse_life_symbol(interp, unit, reglist[i]);
 }
 
 
 /*
 
-=item C<static void analyse_life_symbol(const IMC_Unit *unit, SymReg* r)>
+=item C<static void analyse_life_symbol(PARROT_INTERP, const IMC_Unit *unit,
+SymReg* r)>
 
 Analyzes the lifetime for a given symbol.
 
@@ -723,7 +736,8 @@
 */
 
 static void
-analyse_life_symbol(ARGIN(const IMC_Unit *unit), ARGMOD(SymReg* r))
+analyse_life_symbol(PARROT_INTERP,
+        ARGIN(const IMC_Unit *unit), ARGMOD(SymReg* r))
 {
     ASSERT_ARGS(analyse_life_symbol)
     unsigned int i;
@@ -735,13 +749,13 @@
     if (r->life_info)
         free_life_info(unit, r);
 
-    r->life_info = mem_allocate_n_zeroed_typed(unit->n_basic_blocks,
+    r->life_info = mem_gc_allocate_n_zeroed_typed(interp, unit->n_basic_blocks,
                                                Life_range *);
 
     /* First we make a pass to each block to gather the information
      * that can be obtained locally */
     for (i = 0; i < unit->n_basic_blocks; i++) {
-        analyse_life_block(unit->bb_list[i], r);
+        analyse_life_block(interp, unit->bb_list[i], r);
     }
 
     /* Now we need to consider the relations between blocks */
@@ -807,7 +821,8 @@
 
 /*
 
-=item C<static void analyse_life_block(const Basic_block* bb, SymReg *r)>
+=item C<static void analyse_life_block(PARROT_INTERP, const Basic_block* bb,
+SymReg *r)>
 
 Studies the state of the var r in the block bb.
 
@@ -819,10 +834,10 @@
 */
 
 static void
-analyse_life_block(ARGIN(const Basic_block* bb), ARGMOD(SymReg *r))
+analyse_life_block(PARROT_INTERP, ARGIN(const Basic_block* bb), ARGMOD(SymReg *r))
 {
     ASSERT_ARGS(analyse_life_block)
-    Life_range  * const l        = make_life_range(r, bb->index);
+    Life_range  * const l        = make_life_range(interp, r, bb->index);
     Instruction         *special = NULL;
     Instruction         *ins;
 
@@ -985,19 +1000,19 @@
     const unsigned int n = unit->n_basic_blocks;
     IMCC_info(interp, 2, "compute_dominators\n");
 
-    unit->idoms          = mem_allocate_n_zeroed_typed(n, int);
-    dominators           = mem_allocate_n_zeroed_typed(n, Set *);
+    unit->idoms          = mem_gc_allocate_n_zeroed_typed(interp, n, int);
+    dominators           = mem_gc_allocate_n_zeroed_typed(interp, n, Set *);
     unit->dominators     = dominators;
 
-    dominators[0]        = set_make(n);
+    dominators[0]        = set_make(interp, n);
     set_add(dominators[0], 0);
 
     for (i = n - 1; i; --i) {
         if (unit->bb_list[i]->pred_list) {
-            dominators[i] = set_make_full(n);
+            dominators[i] = set_make_full(interp, n);
         }
         else {
-            dominators[i] = set_make(n);
+            dominators[i] = set_make(interp, n);
             set_add(dominators[i], i);
         }
     }
@@ -1034,7 +1049,7 @@
 
         /* TODO: This 'for' should be a breadth-first search for speed */
         for (i = 1; i < n; i++) {
-            Set  * const s = set_copy(dominators[i]);
+            Set  * const s = set_copy(interp, dominators[i]);
             Edge *edge;
 
             for (edge = unit->bb_list[i]->pred_list;
@@ -1113,12 +1128,12 @@
 
     const int    n                   = unit->n_basic_blocks;
     Set ** const dominance_frontiers = unit->dominance_frontiers =
-        mem_allocate_n_typed(n, Set *);
+            mem_gc_allocate_n_typed(interp, n, Set *);
 
     IMCC_info(interp, 2, "compute_dominance_frontiers\n");
 
     for (i = 0; i < n; i++) {
-        dominance_frontiers[i] = set_make(n);
+        dominance_frontiers[i] = set_make(interp, n);
     }
 
     /* for all nodes, b */
@@ -1416,7 +1431,7 @@
                 "\tcan't determine loop entry block (%d found)\n" , i);
     }
 
-    loop = set_make(unit->n_basic_blocks);
+    loop = set_make(interp, unit->n_basic_blocks);
     set_add(loop, footer->index);
     set_add(loop, header->index);
 
@@ -1427,7 +1442,7 @@
         search_predecessors_not_in(footer, loop);
     }
 
-    exits = set_make(unit->n_basic_blocks);
+    exits = set_make(interp, unit->n_basic_blocks);
 
     for (i = 1; i < unit->n_basic_blocks; i++) {
         if (set_contains(loop, i)) {
@@ -1443,9 +1458,10 @@
 
     /* now 'loop' contains the set of nodes inside the loop.  */
     n_loops                       = unit->n_loops;
-    loop_info                     = mem_realloc_n_typed(unit->loop_info,
-                                        n_loops + 1, Loop_info *);
-    loop_info[n_loops]            = mem_allocate_typed(Loop_info);
+    loop_info                     = mem_gc_realloc_n_typed(interp,
+                                            unit->loop_info,
+                                            n_loops + 1, Loop_info *);
+    loop_info[n_loops]            = mem_gc_allocate_typed(interp, Loop_info);
     loop_info[n_loops]->loop      = loop;
     loop_info[n_loops]->exits     = exits;
     loop_info[n_loops]->depth     = footer->loop_depth;
@@ -1453,6 +1469,8 @@
     loop_info[n_loops]->header    = header->index;
     loop_info[n_loops]->preheader = natural_preheader(unit, loop_info[n_loops]);
 
+    unit->loop_info = loop_info;
+
     unit->n_loops++;
 }
 
@@ -1518,7 +1536,7 @@
 
 /*
 
-=item C<static void init_basic_blocks(IMC_Unit *unit)>
+=item C<static void init_basic_blocks(PARROT_INTERP, IMC_Unit *unit)>
 
 Initializes the basic blocks memory for this unit.
 
@@ -1527,7 +1545,7 @@
 */
 
 static void
-init_basic_blocks(ARGMOD(IMC_Unit *unit))
+init_basic_blocks(PARROT_INTERP, ARGMOD(IMC_Unit *unit))
 {
     ASSERT_ARGS(init_basic_blocks)
 
@@ -1537,8 +1555,8 @@
     unit->n_basic_blocks = 0;
     unit->edge_list      = NULL;
     unit->bb_list_size   = 256;
-    unit->bb_list        = mem_allocate_n_zeroed_typed(unit->bb_list_size,
-                                                     Basic_block *);
+    unit->bb_list        = mem_gc_allocate_n_zeroed_typed(interp,
+                                    unit->bb_list_size, Basic_block *);
 }
 
 
@@ -1576,7 +1594,8 @@
 
 /*
 
-=item C<static Basic_block* make_basic_block(IMC_Unit *unit, Instruction *ins)>
+=item C<static Basic_block* make_basic_block(PARROT_INTERP, IMC_Unit *unit,
+Instruction *ins)>
 
 Creates, initializes, and returns a new Basic_block.
 
@@ -1587,10 +1606,10 @@
 PARROT_CANNOT_RETURN_NULL
 PARROT_WARN_UNUSED_RESULT
 static Basic_block*
-make_basic_block(ARGMOD(IMC_Unit *unit), ARGMOD(Instruction *ins))
+make_basic_block(PARROT_INTERP, ARGMOD(IMC_Unit *unit), ARGMOD(Instruction *ins))
 {
     ASSERT_ARGS(make_basic_block)
-    Basic_block * const bb = mem_allocate_typed(Basic_block);
+    Basic_block * const bb = mem_gc_allocate_typed(interp, Basic_block);
     int                 n  = unit->n_basic_blocks;
 
     bb->start      = ins;
@@ -1605,7 +1624,8 @@
 
     if (n == unit->bb_list_size) {
         unit->bb_list_size *= 2;
-        mem_realloc_n_typed(unit->bb_list, unit->bb_list_size, Basic_block *);
+        unit->bb_list = mem_gc_realloc_n_typed(interp, unit->bb_list,
+                    unit->bb_list_size, Basic_block *);
     }
 
     unit->bb_list[n] = bb;
@@ -1617,7 +1637,7 @@
 
 /*
 
-=item C<Life_range * make_life_range(SymReg *r, int idx)>
+=item C<Life_range * make_life_range(PARROT_INTERP, SymReg *r, int idx)>
 
 Creates and returns a Life_range for the given register at the specified index.
 
@@ -1628,10 +1648,10 @@
 PARROT_MALLOC
 PARROT_CANNOT_RETURN_NULL
 Life_range *
-make_life_range(ARGMOD(SymReg *r), int idx)
+make_life_range(PARROT_INTERP, ARGMOD(SymReg *r), int idx)
 {
     ASSERT_ARGS(make_life_range)
-    Life_range * const l = mem_allocate_zeroed_typed(Life_range);
+    Life_range * const l = mem_gc_allocate_zeroed_typed(interp, Life_range);
     r->life_info[idx]    = l;
 
     return l;

Modified: trunk/compilers/imcc/cfg.h
==============================================================================
--- trunk/compilers/imcc/cfg.h	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/compilers/imcc/cfg.h	Mon Feb 22 09:28:39 2010	(r44291)
@@ -100,8 +100,9 @@
 
 PARROT_MALLOC
 PARROT_CANNOT_RETURN_NULL
-Life_range * make_life_range(ARGMOD(SymReg *r), int idx)
+Life_range * make_life_range(PARROT_INTERP, ARGMOD(SymReg *r), int idx)
         __attribute__nonnull__(1)
+        __attribute__nonnull__(2)
         FUNC_MODIFIES(*r);
 
 PARROT_WARN_UNUSED_RESULT
@@ -147,7 +148,8 @@
        PARROT_ASSERT_ARG(interp) \
     , PARROT_ASSERT_ARG(unit))
 #define ASSERT_ARGS_make_life_range __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(r))
+       PARROT_ASSERT_ARG(interp) \
+    , PARROT_ASSERT_ARG(r))
 #define ASSERT_ARGS_natural_preheader __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(unit) \
     , PARROT_ASSERT_ARG(loop_info))

Modified: trunk/compilers/imcc/imc.c
==============================================================================
--- trunk/compilers/imcc/imc.c	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/compilers/imcc/imc.c	Mon Feb 22 09:28:39 2010	(r44291)
@@ -39,12 +39,14 @@
 
 PARROT_CANNOT_RETURN_NULL
 PARROT_MALLOC
-static IMC_Unit * imc_new_unit(IMC_Unit_Type t);
+static IMC_Unit * imc_new_unit(PARROT_INTERP, IMC_Unit_Type t)
+        __attribute__nonnull__(1);
 
 #define ASSERT_ARGS_imc_free_unit __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp) \
     , PARROT_ASSERT_ARG(unit))
-#define ASSERT_ARGS_imc_new_unit __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
+#define ASSERT_ARGS_imc_new_unit __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+       PARROT_ASSERT_ARG(interp))
 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END.  Your changes will be lost. */
 /* HEADERIZER END: static */
 
@@ -153,7 +155,7 @@
 
 /*
 
-=item C<static IMC_Unit * imc_new_unit(IMC_Unit_Type t)>
+=item C<static IMC_Unit * imc_new_unit(PARROT_INTERP, IMC_Unit_Type t)>
 
 Creates a new IMC_Unit of the given IMC_Unit_Type C<t>.
 
@@ -164,11 +166,11 @@
 PARROT_CANNOT_RETURN_NULL
 PARROT_MALLOC
 static IMC_Unit *
-imc_new_unit(IMC_Unit_Type t)
+imc_new_unit(PARROT_INTERP, IMC_Unit_Type t)
 {
     ASSERT_ARGS(imc_new_unit)
-    IMC_Unit * const unit = mem_allocate_zeroed_typed(IMC_Unit);
-    create_symhash(&unit->hash);
+    IMC_Unit * const unit = mem_gc_allocate_zeroed_typed(interp, IMC_Unit);
+    create_symhash(interp, &unit->hash);
     unit->type = t;
     return unit;
 }
@@ -191,14 +193,14 @@
 imc_open_unit(PARROT_INTERP, IMC_Unit_Type t)
 {
     ASSERT_ARGS(imc_open_unit)
-    IMC_Unit   * const unit     = imc_new_unit(t);
+    IMC_Unit   * const unit     = imc_new_unit(interp, t);
     imc_info_t * const imc_info = IMCC_INFO(interp);
 
     if (!imc_info->imc_units)
         imc_info->imc_units = unit;
 
     if (!imc_info->ghash.data)
-        create_symhash(&imc_info->ghash);
+        create_symhash(interp, &imc_info->ghash);
 
     unit->prev = imc_info->last_unit;
 

Modified: trunk/compilers/imcc/imcc.l
==============================================================================
--- trunk/compilers/imcc/imcc.l	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/compilers/imcc/imcc.l	Mon Feb 22 09:28:39 2010	(r44291)
@@ -787,7 +787,7 @@
 static macro_frame_t *
 new_frame(PARROT_INTERP) {
     static int label   = 0;
-    macro_frame_t * const tmp = mem_allocate_zeroed_typed(macro_frame_t);
+    macro_frame_t * const tmp = mem_gc_allocate_zeroed_typed(interp, macro_frame_t);
 
     tmp->label         = ++label;
     tmp->s.line        = IMCC_INFO(interp)->line;
@@ -1107,7 +1107,7 @@
         m->expansion = NULL;
     }
     else {
-        m = mem_allocate_zeroed_typed(macro_t);
+        m = mem_gc_allocate_zeroed_typed(interp, macro_t);
 
         if (!IMCC_INFO(interp)->macros)
             IMCC_INFO(interp)->macros = parrot_new_cstring_hash(interp);

Modified: trunk/compilers/imcc/imcc.y
==============================================================================
--- trunk/compilers/imcc/imcc.y	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/compilers/imcc/imcc.y	Mon Feb 22 09:28:39 2010	(r44291)
@@ -43,57 +43,62 @@
 /* HEADERIZER BEGIN: static */
 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END.  Your changes will be lost. */
 
-static void add_pcc_named_arg(
+static void add_pcc_named_arg(PARROT_INTERP,
     ARGMOD(SymReg *cur_call),
     ARGMOD(SymReg *name),
     ARGMOD(SymReg *value))
         __attribute__nonnull__(1)
         __attribute__nonnull__(2)
         __attribute__nonnull__(3)
+        __attribute__nonnull__(4)
         FUNC_MODIFIES(*cur_call)
         FUNC_MODIFIES(*name)
         FUNC_MODIFIES(*value);
 
-static void add_pcc_named_arg_var(
+static void add_pcc_named_arg_var(PARROT_INTERP,
     ARGMOD(SymReg *cur_call),
     ARGMOD(SymReg *name),
     ARGMOD(SymReg *value))
         __attribute__nonnull__(1)
         __attribute__nonnull__(2)
         __attribute__nonnull__(3)
+        __attribute__nonnull__(4)
         FUNC_MODIFIES(*cur_call)
         FUNC_MODIFIES(*name)
         FUNC_MODIFIES(*value);
 
-static void add_pcc_named_param(
+static void add_pcc_named_param(PARROT_INTERP,
     ARGMOD(SymReg *cur_call),
     ARGMOD(SymReg *name),
     ARGMOD(SymReg *value))
         __attribute__nonnull__(1)
         __attribute__nonnull__(2)
         __attribute__nonnull__(3)
+        __attribute__nonnull__(4)
         FUNC_MODIFIES(*cur_call)
         FUNC_MODIFIES(*name)
         FUNC_MODIFIES(*value);
 
-static void add_pcc_named_result(
+static void add_pcc_named_result(PARROT_INTERP,
     ARGMOD(SymReg *cur_call),
     ARGMOD(SymReg *name),
     ARGMOD(SymReg *value))
         __attribute__nonnull__(1)
         __attribute__nonnull__(2)
         __attribute__nonnull__(3)
+        __attribute__nonnull__(4)
         FUNC_MODIFIES(*cur_call)
         FUNC_MODIFIES(*name)
         FUNC_MODIFIES(*value);
 
-static void add_pcc_named_return(
+static void add_pcc_named_return(PARROT_INTERP,
     ARGMOD(SymReg *cur_call),
     ARGMOD(SymReg *name),
     ARGMOD(SymReg *value))
         __attribute__nonnull__(1)
         __attribute__nonnull__(2)
         __attribute__nonnull__(3)
+        __attribute__nonnull__(4)
         FUNC_MODIFIES(*cur_call)
         FUNC_MODIFIES(*name)
         FUNC_MODIFIES(*value);
@@ -251,23 +256,28 @@
         FUNC_MODIFIES(*name);
 
 #define ASSERT_ARGS_add_pcc_named_arg __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(cur_call) \
+       PARROT_ASSERT_ARG(interp) \
+    , PARROT_ASSERT_ARG(cur_call) \
     , PARROT_ASSERT_ARG(name) \
     , PARROT_ASSERT_ARG(value))
 #define ASSERT_ARGS_add_pcc_named_arg_var __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(cur_call) \
+       PARROT_ASSERT_ARG(interp) \
+    , PARROT_ASSERT_ARG(cur_call) \
     , PARROT_ASSERT_ARG(name) \
     , PARROT_ASSERT_ARG(value))
 #define ASSERT_ARGS_add_pcc_named_param __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(cur_call) \
+       PARROT_ASSERT_ARG(interp) \
+    , PARROT_ASSERT_ARG(cur_call) \
     , PARROT_ASSERT_ARG(name) \
     , PARROT_ASSERT_ARG(value))
 #define ASSERT_ARGS_add_pcc_named_result __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(cur_call) \
+       PARROT_ASSERT_ARG(interp) \
+    , PARROT_ASSERT_ARG(cur_call) \
     , PARROT_ASSERT_ARG(name) \
     , PARROT_ASSERT_ARG(value))
 #define ASSERT_ARGS_add_pcc_named_return __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(cur_call) \
+       PARROT_ASSERT_ARG(interp) \
+    , PARROT_ASSERT_ARG(cur_call) \
     , PARROT_ASSERT_ARG(name) \
     , PARROT_ASSERT_ARG(value))
 #define ASSERT_ARGS_adv_named_set __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
@@ -648,7 +658,7 @@
     Instruction * const i = iLABEL(interp, unit, r);
 
     r->type    = (r->type & VT_ENCODED) ? VT_PCC_SUB|VT_ENCODED : VT_PCC_SUB;
-    r->pcc_sub = mem_allocate_zeroed_typed(pcc_sub_t);
+    r->pcc_sub = mem_gc_allocate_zeroed_typed(interp, pcc_sub_t);
 
     IMCC_INFO(interp)->cur_call = r;
     i->line                     = IMCC_INFO(interp)->line;
@@ -899,105 +909,111 @@
 
 /*
 
-=item C<static void add_pcc_named_arg(SymReg *cur_call, SymReg *name, SymReg
-*value)>
+=item C<static void add_pcc_named_arg(PARROT_INTERP, SymReg *cur_call, SymReg
+*name, SymReg *value)>
 
 =cut
 
 */
 
 static void
-add_pcc_named_arg(ARGMOD(SymReg *cur_call),
+add_pcc_named_arg(PARROT_INTERP,
+        ARGMOD(SymReg *cur_call),
         ARGMOD(SymReg *name),
         ARGMOD(SymReg *value))
 {
     ASSERT_ARGS(add_pcc_named_arg)
     name->type  |= VT_NAMED;
 
-    add_pcc_arg(cur_call, name);
-    add_pcc_arg(cur_call, value);
+    add_pcc_arg(interp, cur_call, name);
+    add_pcc_arg(interp, cur_call, value);
 }
 
 /*
 
-=item C<static void add_pcc_named_arg_var(SymReg *cur_call, SymReg *name, SymReg
-*value)>
+=item C<static void add_pcc_named_arg_var(PARROT_INTERP, SymReg *cur_call,
+SymReg *name, SymReg *value)>
 
 =cut
 
 */
 
 static void
-add_pcc_named_arg_var(ARGMOD(SymReg *cur_call),
-    ARGMOD(SymReg *name), ARGMOD(SymReg *value))
+add_pcc_named_arg_var(PARROT_INTERP,
+        ARGMOD(SymReg *cur_call),
+        ARGMOD(SymReg *name),
+        ARGMOD(SymReg *value))
 {
     ASSERT_ARGS(add_pcc_named_arg_var)
     name->type |= VT_NAMED;
-    add_pcc_arg(cur_call, name);
-    add_pcc_arg(cur_call, value);
+    add_pcc_arg(interp, cur_call, name);
+    add_pcc_arg(interp, cur_call, value);
 }
 
 /*
 
-=item C<static void add_pcc_named_result(SymReg *cur_call, SymReg *name, SymReg
-*value)>
+=item C<static void add_pcc_named_result(PARROT_INTERP, SymReg *cur_call, SymReg
+*name, SymReg *value)>
 
 =cut
 
 */
 
 static void
-add_pcc_named_result(ARGMOD(SymReg *cur_call),
+add_pcc_named_result(PARROT_INTERP,
+        ARGMOD(SymReg *cur_call),
         ARGMOD(SymReg *name),
         ARGMOD(SymReg *value))
 {
     ASSERT_ARGS(add_pcc_named_result)
     name->type         |= VT_NAMED;
 
-    add_pcc_result(cur_call, name);
-    add_pcc_result(cur_call, value);
+    add_pcc_result(interp, cur_call, name);
+    add_pcc_result(interp, cur_call, value);
 }
 
 /*
 
-=item C<static void add_pcc_named_param(SymReg *cur_call, SymReg *name, SymReg
-*value)>
+=item C<static void add_pcc_named_param(PARROT_INTERP, SymReg *cur_call, SymReg
+*name, SymReg *value)>
 
 =cut
 
 */
 
 static void
-add_pcc_named_param(ARGMOD(SymReg *cur_call),
+add_pcc_named_param(PARROT_INTERP,
+        ARGMOD(SymReg *cur_call),
         ARGMOD(SymReg *name),
         ARGMOD(SymReg *value))
 {
     ASSERT_ARGS(add_pcc_named_param)
     name->type         |= VT_NAMED;
 
-    add_pcc_arg(cur_call, name);
-    add_pcc_arg(cur_call, value);
+    add_pcc_arg(interp, cur_call, name);
+    add_pcc_arg(interp, cur_call, value);
 }
 
 /*
 
-=item C<static void add_pcc_named_return(SymReg *cur_call, SymReg *name, SymReg
-*value)>
+=item C<static void add_pcc_named_return(PARROT_INTERP, SymReg *cur_call, SymReg
+*name, SymReg *value)>
 
 =cut
 
 */
 
 static void
-add_pcc_named_return(ARGMOD(SymReg *cur_call),
+add_pcc_named_return(PARROT_INTERP,
+        ARGMOD(SymReg *cur_call),
         ARGMOD(SymReg *name),
         ARGMOD(SymReg *value))
 {
     ASSERT_ARGS(add_pcc_named_return)
     name->type         |= VT_NAMED;
 
-    add_pcc_result(cur_call, name);
-    add_pcc_result(cur_call, value);
+    add_pcc_result(interp, cur_call, name);
+    add_pcc_result(interp, cur_call, value);
 }
 
 /*
@@ -1387,12 +1403,12 @@
    | sub_params sub_param '\n'
          {
            if (IMCC_INFO(interp)->adv_named_id) {
-                 add_pcc_named_param(IMCC_INFO(interp)->cur_call,
+                 add_pcc_named_param(interp, IMCC_INFO(interp)->cur_call,
                                      IMCC_INFO(interp)->adv_named_id, $2);
                  IMCC_INFO(interp)->adv_named_id = NULL;
            }
            else
-               add_pcc_arg(IMCC_INFO(interp)->cur_call, $2);
+               add_pcc_arg(interp, IMCC_INFO(interp)->cur_call, $2);
          }
    ;
 
@@ -1516,17 +1532,17 @@
 multi_types:
      /* empty */
          {
-           add_pcc_multi(IMCC_INFO(interp)->cur_call, NULL);
+           add_pcc_multi(interp, IMCC_INFO(interp)->cur_call, NULL);
          }
    | multi_types COMMA multi_type
          {
            $$ = 0;
-           add_pcc_multi(IMCC_INFO(interp)->cur_call, $3);
+           add_pcc_multi(interp, IMCC_INFO(interp)->cur_call, $3);
          }
    | multi_type
          {
            $$ = 0;
-           add_pcc_multi(IMCC_INFO(interp)->cur_call, $1);
+           add_pcc_multi(interp, IMCC_INFO(interp)->cur_call, $1);
          }
    ;
 
@@ -1673,7 +1689,7 @@
 
 pcc_args:
      /* empty */               { $$ = 0; }
-   | pcc_args pcc_arg '\n'     { add_pcc_arg(IMCC_INFO(interp)->cur_call, $2); }
+   | pcc_args pcc_arg '\n'     { add_pcc_arg(interp, IMCC_INFO(interp)->cur_call, $2); }
    ;
 
 pcc_arg:
@@ -1686,7 +1702,7 @@
    | pcc_results pcc_result '\n'
          {
            if ($2)
-               add_pcc_result(IMCC_INFO(interp)->cur_call, $2);
+               add_pcc_result(interp, IMCC_INFO(interp)->cur_call, $2);
          }
    ;
 
@@ -1745,12 +1761,12 @@
    | pcc_returns '\n'
          {
            if ($1)
-               add_pcc_result(IMCC_INFO(interp)->sr_return, $1);
+               add_pcc_result(interp, IMCC_INFO(interp)->sr_return, $1);
          }
    | pcc_returns pcc_return '\n'
          {
            if ($2)
-               add_pcc_result(IMCC_INFO(interp)->sr_return, $2);
+               add_pcc_result(interp, IMCC_INFO(interp)->sr_return, $2);
          }
    ;
 
@@ -1759,12 +1775,12 @@
    | pcc_yields '\n'
          {
            if ($1)
-               add_pcc_result(IMCC_INFO(interp)->sr_return, $1);
+               add_pcc_result(interp, IMCC_INFO(interp)->sr_return, $1);
          }
    | pcc_yields pcc_set_yield '\n'
          {
            if ($2)
-               add_pcc_result(IMCC_INFO(interp)->sr_return, $2);
+               add_pcc_result(interp, IMCC_INFO(interp)->sr_return, $2);
          }
    ;
 
@@ -1799,32 +1815,32 @@
    | arg
          {
            if (IMCC_INFO(interp)->adv_named_id) {
-               add_pcc_named_return(IMCC_INFO(interp)->sr_return,
+               add_pcc_named_return(interp, IMCC_INFO(interp)->sr_return,
                                     IMCC_INFO(interp)->adv_named_id, $1);
                IMCC_INFO(interp)->adv_named_id = NULL;
            }
            else
-               add_pcc_result(IMCC_INFO(interp)->sr_return, $1);
+               add_pcc_result(interp, IMCC_INFO(interp)->sr_return, $1);
          }
    | STRINGC ADV_ARROW var
          {
             SymReg * const name = mk_const(interp, $1, 'S');
-            add_pcc_named_return(IMCC_INFO(interp)->sr_return, name, $3);
+            add_pcc_named_return(interp, IMCC_INFO(interp)->sr_return, name, $3);
          }
    | var_returns COMMA arg
          {
            if (IMCC_INFO(interp)->adv_named_id) {
-               add_pcc_named_return(IMCC_INFO(interp)->sr_return,
+               add_pcc_named_return(interp, IMCC_INFO(interp)->sr_return,
                                     IMCC_INFO(interp)->adv_named_id, $3);
                IMCC_INFO(interp)->adv_named_id = NULL;
              }
              else
-                 add_pcc_result(IMCC_INFO(interp)->sr_return, $3);
+                 add_pcc_result(interp, IMCC_INFO(interp)->sr_return, $3);
          }
    | var_returns COMMA STRINGC ADV_ARROW var
          {
            SymReg * const name = mk_const(interp, $3, 'S');
-           add_pcc_named_return(IMCC_INFO(interp)->sr_return, name, $5);
+           add_pcc_named_return(interp, IMCC_INFO(interp)->sr_return, name, $5);
          }
    ;
 
@@ -1908,7 +1924,7 @@
 id_list_id :
      IDENTIFIER opt_unique_reg
          {
-           IdList* const l = mem_allocate_n_zeroed_typed(1, IdList);
+           IdList* const l = mem_gc_allocate_n_zeroed_typed(interp, 1, IdList);
            l->id           = $1;
            l->unique_reg   = $2;
            $$ = l;
@@ -2053,7 +2069,7 @@
      /* Subroutine call the short way */
    | target  '=' sub_call
          {
-           add_pcc_result($3->symregs[0], $1);
+           add_pcc_result(interp, $3->symregs[0], $1);
            IMCC_INFO(interp)->cur_call = NULL;
            $$ = 0;
          }
@@ -2209,38 +2225,38 @@
          {
            $$ = 0;
            if (IMCC_INFO(interp)->adv_named_id) {
-               add_pcc_named_arg(IMCC_INFO(interp)->cur_call, IMCC_INFO(interp)->adv_named_id, $3);
+               add_pcc_named_arg(interp, IMCC_INFO(interp)->cur_call, IMCC_INFO(interp)->adv_named_id, $3);
                IMCC_INFO(interp)->adv_named_id = NULL;
            }
            else
-               add_pcc_arg(IMCC_INFO(interp)->cur_call, $3);
+               add_pcc_arg(interp, IMCC_INFO(interp)->cur_call, $3);
          }
    | arg
          {
            $$ = 0;
            if (IMCC_INFO(interp)->adv_named_id) {
-               add_pcc_named_arg(IMCC_INFO(interp)->cur_call, IMCC_INFO(interp)->adv_named_id, $1);
+               add_pcc_named_arg(interp, IMCC_INFO(interp)->cur_call, IMCC_INFO(interp)->adv_named_id, $1);
                IMCC_INFO(interp)->adv_named_id = NULL;
            }
            else
-               add_pcc_arg(IMCC_INFO(interp)->cur_call, $1);
+               add_pcc_arg(interp, IMCC_INFO(interp)->cur_call, $1);
          }
    | arglist COMMA STRINGC ADV_ARROW var
          {
            $$ = 0;
-           add_pcc_named_arg(IMCC_INFO(interp)->cur_call,
+           add_pcc_named_arg(interp, IMCC_INFO(interp)->cur_call,
                 mk_const(interp, $3, 'S'), $5);
            mem_sys_free($3);
          }
    | var ADV_ARROW var
          {
            $$ = 0;
-           add_pcc_named_arg_var(IMCC_INFO(interp)->cur_call, $1, $3);
+           add_pcc_named_arg_var(interp, IMCC_INFO(interp)->cur_call, $1, $3);
          }
    | STRINGC ADV_ARROW var
          {
            $$ = 0;
-           add_pcc_named_arg(IMCC_INFO(interp)->cur_call,
+           add_pcc_named_arg(interp, IMCC_INFO(interp)->cur_call,
                 mk_const(interp, $1, 'S'), $3);
            mem_sys_free($1);
          }
@@ -2274,31 +2290,31 @@
          {
            $$ = 0;
            if (IMCC_INFO(interp)->adv_named_id) {
-               add_pcc_named_result(IMCC_INFO(interp)->cur_call, IMCC_INFO(interp)->adv_named_id, $3);
+               add_pcc_named_result(interp, IMCC_INFO(interp)->cur_call, IMCC_INFO(interp)->adv_named_id, $3);
                IMCC_INFO(interp)->adv_named_id = NULL;
            }
            else
-               add_pcc_result(IMCC_INFO(interp)->cur_call, $3);
+               add_pcc_result(interp, IMCC_INFO(interp)->cur_call, $3);
          }
    | targetlist COMMA STRINGC ADV_ARROW target
          {
-            add_pcc_named_result(IMCC_INFO(interp)->cur_call,
-            mk_const(interp, $3, 'S'), $5);
+            add_pcc_named_result(interp, IMCC_INFO(interp)->cur_call,
+                    mk_const(interp, $3, 'S'), $5);
             mem_sys_free($3);
          }
    | result
          {
            $$ = 0;
            if (IMCC_INFO(interp)->adv_named_id) {
-               add_pcc_named_result(IMCC_INFO(interp)->cur_call, IMCC_INFO(interp)->adv_named_id, $1);
+               add_pcc_named_result(interp, IMCC_INFO(interp)->cur_call, IMCC_INFO(interp)->adv_named_id, $1);
                IMCC_INFO(interp)->adv_named_id = NULL;
            }
            else
-               add_pcc_result(IMCC_INFO(interp)->cur_call, $1);
+               add_pcc_result(interp, IMCC_INFO(interp)->cur_call, $1);
          }
    | STRINGC ADV_ARROW target
          {
-           add_pcc_named_result(IMCC_INFO(interp)->cur_call, mk_const(interp, $1, 'S'), $3);
+           add_pcc_named_result(interp, IMCC_INFO(interp)->cur_call, mk_const(interp, $1, 'S'), $3);
            mem_sys_free($1);
          }
    | /* empty */                { $$ = 0; }

Modified: trunk/compilers/imcc/imclexer.c
==============================================================================
--- trunk/compilers/imcc/imclexer.c	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/compilers/imcc/imclexer.c	Mon Feb 22 09:28:39 2010	(r44291)
@@ -5209,7 +5209,7 @@
 static macro_frame_t *
 new_frame(PARROT_INTERP) {
     static int label   = 0;
-    macro_frame_t * const tmp = mem_allocate_zeroed_typed(macro_frame_t);
+    macro_frame_t * const tmp = mem_gc_allocate_zeroed_typed(interp, macro_frame_t);
 
     tmp->label         = ++label;
     tmp->s.line        = IMCC_INFO(interp)->line;
@@ -5529,7 +5529,7 @@
         m->expansion = NULL;
     }
     else {
-        m = mem_allocate_zeroed_typed(macro_t);
+        m = mem_gc_allocate_zeroed_typed(interp, macro_t);
 
         if (!IMCC_INFO(interp)->macros)
             IMCC_INFO(interp)->macros = parrot_new_cstring_hash(interp);

Modified: trunk/compilers/imcc/imcparser.c
==============================================================================
--- trunk/compilers/imcc/imcparser.c	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/compilers/imcc/imcparser.c	Mon Feb 22 09:28:39 2010	(r44291)
@@ -9,26 +9,27 @@
  */
 /* HEADERIZER HFILE: none */
 /* HEADERIZER STOP */
-
-/* A Bison parser, made by GNU Bison 2.4.1.  */
+/* A Bison parser, made by GNU Bison 2.3.  */
 
 /* Skeleton implementation for Bison's Yacc-like parsers in C
-   
-      Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+
+   Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
    Free Software Foundation, Inc.
-   
-   This program is free software: you can redistribute it and/or modify
+
+   This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
-   the Free Software Foundation, either version 3 of the License, or
-   (at your option) any later version.
-   
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
-   
+
    You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street, Fifth Floor,
+   Boston, MA 02110-1301, USA.  */
 
 /* As a special exception, you may create a larger work that contains
    part or all of the Bison parser skeleton and distribute that work
@@ -39,7 +40,7 @@
    special exception, which will cause the skeleton and the resulting
    Bison output files to be licensed under the GNU General Public
    License without this special exception.
-   
+
    This special exception was added by the Free Software Foundation in
    version 2.2 of Bison.  */
 
@@ -57,7 +58,7 @@
 #define YYBISON 1
 
 /* Bison version.  */
-#define YYBISON_VERSION "2.4.1"
+#define YYBISON_VERSION "2.3"
 
 /* Skeleton name.  */
 #define YYSKELETON_NAME "yacc.c"
@@ -65,146 +66,394 @@
 /* Pure parsers.  */
 #define YYPURE 1
 
-/* Push parsers.  */
-#define YYPUSH 0
-
-/* Pull parsers.  */
-#define YYPULL 1
-
 /* Using locations.  */
 #define YYLSP_NEEDED 0
 
 
 
-/* Copy the first part of user declarations.  */
-
-/* Line 189 of yacc.c  */
-#line 1 "compilers/imcc/imcc.y"
-
-/*
- * imcc.y
- *
- * Intermediate Code Compiler for Parrot.
- *
- * Copyright (C) 2002 Melvin Smith <melvin.smith at mindspring.com>
- * Copyright (C) 2002-2009, Parrot Foundation.
- *
- * Grammar of the PIR language parser.
- *
- * $Id$
- *
- */
-
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#define _PARSER
-#define PARSER_MAIN
-#include "imc.h"
-#include "parrot/dynext.h"
-#include "pmc/pmc_callcontext.h"
-#include "pbc.h"
-#include "parser.h"
-#include "optimizer.h"
-
-/* prevent declarations of malloc() and free() in the generated parser. */
-#define YYMALLOC
-#define YYFREE
-
-#ifndef YYENABLE_NLS
-#  define YYENABLE_NLS 0
-#endif
-
-#ifndef YYLTYPE_IS_TRIVIAL
-#  define YYLTYPE_IS_TRIVIAL 0
+/* Tokens.  */
+#ifndef YYTOKENTYPE
+# define YYTOKENTYPE
+   /* Put the tokens into the symbol table, so that GDB and other debuggers
+      know about them.  */
+   enum yytokentype {
+     LOW_PREC = 258,
+     PARAM = 259,
+     HLL = 260,
+     TK_LINE = 261,
+     TK_FILE = 262,
+     GOTO = 263,
+     ARG = 264,
+     IF = 265,
+     UNLESS = 266,
+     PNULL = 267,
+     SET_RETURN = 268,
+     SET_YIELD = 269,
+     ADV_FLAT = 270,
+     ADV_SLURPY = 271,
+     ADV_OPTIONAL = 272,
+     ADV_OPT_FLAG = 273,
+     ADV_NAMED = 274,
+     ADV_ARROW = 275,
+     NEW = 276,
+     ADV_INVOCANT = 277,
+     ADV_CALL_SIG = 278,
+     NAMESPACE = 279,
+     DOT_METHOD = 280,
+     SUB = 281,
+     SYM = 282,
+     LOCAL = 283,
+     LEXICAL = 284,
+     CONST = 285,
+     ANNOTATE = 286,
+     INC = 287,
+     DEC = 288,
+     GLOBAL_CONST = 289,
+     PLUS_ASSIGN = 290,
+     MINUS_ASSIGN = 291,
+     MUL_ASSIGN = 292,
+     DIV_ASSIGN = 293,
+     CONCAT_ASSIGN = 294,
+     BAND_ASSIGN = 295,
+     BOR_ASSIGN = 296,
+     BXOR_ASSIGN = 297,
+     FDIV = 298,
+     FDIV_ASSIGN = 299,
+     MOD_ASSIGN = 300,
+     SHR_ASSIGN = 301,
+     SHL_ASSIGN = 302,
+     SHR_U_ASSIGN = 303,
+     SHIFT_LEFT = 304,
+     SHIFT_RIGHT = 305,
+     INTV = 306,
+     FLOATV = 307,
+     STRINGV = 308,
+     PMCV = 309,
+     LOG_XOR = 310,
+     RELOP_EQ = 311,
+     RELOP_NE = 312,
+     RELOP_GT = 313,
+     RELOP_GTE = 314,
+     RELOP_LT = 315,
+     RELOP_LTE = 316,
+     RESULT = 317,
+     RETURN = 318,
+     TAILCALL = 319,
+     YIELDT = 320,
+     GET_RESULTS = 321,
+     POW = 322,
+     SHIFT_RIGHT_U = 323,
+     LOG_AND = 324,
+     LOG_OR = 325,
+     COMMA = 326,
+     ESUB = 327,
+     DOTDOT = 328,
+     PCC_BEGIN = 329,
+     PCC_END = 330,
+     PCC_CALL = 331,
+     PCC_SUB = 332,
+     PCC_BEGIN_RETURN = 333,
+     PCC_END_RETURN = 334,
+     PCC_BEGIN_YIELD = 335,
+     PCC_END_YIELD = 336,
+     NCI_CALL = 337,
+     METH_CALL = 338,
+     INVOCANT = 339,
+     MAIN = 340,
+     LOAD = 341,
+     INIT = 342,
+     IMMEDIATE = 343,
+     POSTCOMP = 344,
+     METHOD = 345,
+     ANON = 346,
+     OUTER = 347,
+     NEED_LEX = 348,
+     MULTI = 349,
+     VTABLE_METHOD = 350,
+     LOADLIB = 351,
+     SUB_INSTANCE_OF = 352,
+     SUBID = 353,
+     NS_ENTRY = 354,
+     UNIQUE_REG = 355,
+     LABEL = 356,
+     EMIT = 357,
+     EOM = 358,
+     IREG = 359,
+     NREG = 360,
+     SREG = 361,
+     PREG = 362,
+     IDENTIFIER = 363,
+     REG = 364,
+     MACRO = 365,
+     ENDM = 366,
+     STRINGC = 367,
+     INTC = 368,
+     FLOATC = 369,
+     USTRINGC = 370,
+     PARROT_OP = 371,
+     VAR = 372,
+     LINECOMMENT = 373,
+     FILECOMMENT = 374,
+     DOT = 375,
+     CONCAT = 376
+   };
 #endif
-
-/* HEADERIZER HFILE: compilers/imcc/imc.h */
-
-/* HEADERIZER BEGIN: static */
-/* Don't modify between HEADERIZER BEGIN / HEADERIZER END.  Your changes will be lost. */
-
-static void add_pcc_named_arg(
-    ARGMOD(SymReg *cur_call),
-    ARGMOD(SymReg *name),
-    ARGMOD(SymReg *value))
-        __attribute__nonnull__(1)
-        __attribute__nonnull__(2)
-        __attribute__nonnull__(3)
-        FUNC_MODIFIES(*cur_call)
-        FUNC_MODIFIES(*name)
-        FUNC_MODIFIES(*value);
-
-static void add_pcc_named_arg_var(
-    ARGMOD(SymReg *cur_call),
-    ARGMOD(SymReg *name),
-    ARGMOD(SymReg *value))
-        __attribute__nonnull__(1)
-        __attribute__nonnull__(2)
-        __attribute__nonnull__(3)
-        FUNC_MODIFIES(*cur_call)
-        FUNC_MODIFIES(*name)
-        FUNC_MODIFIES(*value);
-
-static void add_pcc_named_param(
-    ARGMOD(SymReg *cur_call),
-    ARGMOD(SymReg *name),
-    ARGMOD(SymReg *value))
-        __attribute__nonnull__(1)
-        __attribute__nonnull__(2)
-        __attribute__nonnull__(3)
-        FUNC_MODIFIES(*cur_call)
-        FUNC_MODIFIES(*name)
-        FUNC_MODIFIES(*value);
-
-static void add_pcc_named_result(
-    ARGMOD(SymReg *cur_call),
-    ARGMOD(SymReg *name),
-    ARGMOD(SymReg *value))
-        __attribute__nonnull__(1)
-        __attribute__nonnull__(2)
-        __attribute__nonnull__(3)
-        FUNC_MODIFIES(*cur_call)
-        FUNC_MODIFIES(*name)
-        FUNC_MODIFIES(*value);
-
-static void add_pcc_named_return(
-    ARGMOD(SymReg *cur_call),
-    ARGMOD(SymReg *name),
-    ARGMOD(SymReg *value))
-        __attribute__nonnull__(1)
-        __attribute__nonnull__(2)
-        __attribute__nonnull__(3)
-        FUNC_MODIFIES(*cur_call)
-        FUNC_MODIFIES(*name)
-        FUNC_MODIFIES(*value);
-
-static void adv_named_set(PARROT_INTERP, ARGIN(const char *name))
-        __attribute__nonnull__(1)
-        __attribute__nonnull__(2);
-
-static void adv_named_set_u(PARROT_INTERP, ARGIN(const char *name))
-        __attribute__nonnull__(1)
-        __attribute__nonnull__(2);
-
-static void begin_return_or_yield(PARROT_INTERP, int yield)
-        __attribute__nonnull__(1);
-
-static void clear_state(PARROT_INTERP)
-        __attribute__nonnull__(1);
-
-static void do_loadlib(PARROT_INTERP, ARGIN(const char *lib))
-        __attribute__nonnull__(1)
-        __attribute__nonnull__(2);
-
-PARROT_WARN_UNUSED_RESULT
-PARROT_CAN_RETURN_NULL
-static Instruction* func_ins(PARROT_INTERP,
-    ARGMOD(IMC_Unit *unit),
-    ARGIN(SymReg *lhs),
-    ARGIN(const char *op),
-    ARGMOD(SymReg **r),
+/* Tokens.  */
+#define LOW_PREC 258
+#define PARAM 259
+#define HLL 260
+#define TK_LINE 261
+#define TK_FILE 262
+#define GOTO 263
+#define ARG 264
+#define IF 265
+#define UNLESS 266
+#define PNULL 267
+#define SET_RETURN 268
+#define SET_YIELD 269
+#define ADV_FLAT 270
+#define ADV_SLURPY 271
+#define ADV_OPTIONAL 272
+#define ADV_OPT_FLAG 273
+#define ADV_NAMED 274
+#define ADV_ARROW 275
+#define NEW 276
+#define ADV_INVOCANT 277
+#define ADV_CALL_SIG 278
+#define NAMESPACE 279
+#define DOT_METHOD 280
+#define SUB 281
+#define SYM 282
+#define LOCAL 283
+#define LEXICAL 284
+#define CONST 285
+#define ANNOTATE 286
+#define INC 287
+#define DEC 288
+#define GLOBAL_CONST 289
+#define PLUS_ASSIGN 290
+#define MINUS_ASSIGN 291
+#define MUL_ASSIGN 292
+#define DIV_ASSIGN 293
+#define CONCAT_ASSIGN 294
+#define BAND_ASSIGN 295
+#define BOR_ASSIGN 296
+#define BXOR_ASSIGN 297
+#define FDIV 298
+#define FDIV_ASSIGN 299
+#define MOD_ASSIGN 300
+#define SHR_ASSIGN 301
+#define SHL_ASSIGN 302
+#define SHR_U_ASSIGN 303
+#define SHIFT_LEFT 304
+#define SHIFT_RIGHT 305
+#define INTV 306
+#define FLOATV 307
+#define STRINGV 308
+#define PMCV 309
+#define LOG_XOR 310
+#define RELOP_EQ 311
+#define RELOP_NE 312
+#define RELOP_GT 313
+#define RELOP_GTE 314
+#define RELOP_LT 315
+#define RELOP_LTE 316
+#define RESULT 317
+#define RETURN 318
+#define TAILCALL 319
+#define YIELDT 320
+#define GET_RESULTS 321
+#define POW 322
+#define SHIFT_RIGHT_U 323
+#define LOG_AND 324
+#define LOG_OR 325
+#define COMMA 326
+#define ESUB 327
+#define DOTDOT 328
+#define PCC_BEGIN 329
+#define PCC_END 330
+#define PCC_CALL 331
+#define PCC_SUB 332
+#define PCC_BEGIN_RETURN 333
+#define PCC_END_RETURN 334
+#define PCC_BEGIN_YIELD 335
+#define PCC_END_YIELD 336
+#define NCI_CALL 337
+#define METH_CALL 338
+#define INVOCANT 339
+#define MAIN 340
+#define LOAD 341
+#define INIT 342
+#define IMMEDIATE 343
+#define POSTCOMP 344
+#define METHOD 345
+#define ANON 346
+#define OUTER 347
+#define NEED_LEX 348
+#define MULTI 349
+#define VTABLE_METHOD 350
+#define LOADLIB 351
+#define SUB_INSTANCE_OF 352
+#define SUBID 353
+#define NS_ENTRY 354
+#define UNIQUE_REG 355
+#define LABEL 356
+#define EMIT 357
+#define EOM 358
+#define IREG 359
+#define NREG 360
+#define SREG 361
+#define PREG 362
+#define IDENTIFIER 363
+#define REG 364
+#define MACRO 365
+#define ENDM 366
+#define STRINGC 367
+#define INTC 368
+#define FLOATC 369
+#define USTRINGC 370
+#define PARROT_OP 371
+#define VAR 372
+#define LINECOMMENT 373
+#define FILECOMMENT 374
+#define DOT 375
+#define CONCAT 376
+
+
+
+
+/* Copy the first part of user declarations.  */
+#line 1 "compilers/imcc/imcc.y"
+
+/*
+ * imcc.y
+ *
+ * Intermediate Code Compiler for Parrot.
+ *
+ * Copyright (C) 2002 Melvin Smith <melvin.smith at mindspring.com>
+ * Copyright (C) 2002-2009, Parrot Foundation.
+ *
+ * Grammar of the PIR language parser.
+ *
+ * $Id$
+ *
+ */
+
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#define _PARSER
+#define PARSER_MAIN
+#include "imc.h"
+#include "parrot/dynext.h"
+#include "pmc/pmc_callcontext.h"
+#include "pbc.h"
+#include "parser.h"
+#include "optimizer.h"
+
+/* prevent declarations of malloc() and free() in the generated parser. */
+#define YYMALLOC
+#define YYFREE
+
+#ifndef YYENABLE_NLS
+#  define YYENABLE_NLS 0
+#endif
+
+#ifndef YYLTYPE_IS_TRIVIAL
+#  define YYLTYPE_IS_TRIVIAL 0
+#endif
+
+/* HEADERIZER HFILE: compilers/imcc/imc.h */
+
+/* HEADERIZER BEGIN: static */
+/* Don't modify between HEADERIZER BEGIN / HEADERIZER END.  Your changes will be lost. */
+
+static void add_pcc_named_arg(PARROT_INTERP,
+    ARGMOD(SymReg *cur_call),
+    ARGMOD(SymReg *name),
+    ARGMOD(SymReg *value))
+        __attribute__nonnull__(1)
+        __attribute__nonnull__(2)
+        __attribute__nonnull__(3)
+        __attribute__nonnull__(4)
+        FUNC_MODIFIES(*cur_call)
+        FUNC_MODIFIES(*name)
+        FUNC_MODIFIES(*value);
+
+static void add_pcc_named_arg_var(PARROT_INTERP,
+    ARGMOD(SymReg *cur_call),
+    ARGMOD(SymReg *name),
+    ARGMOD(SymReg *value))
+        __attribute__nonnull__(1)
+        __attribute__nonnull__(2)
+        __attribute__nonnull__(3)
+        __attribute__nonnull__(4)
+        FUNC_MODIFIES(*cur_call)
+        FUNC_MODIFIES(*name)
+        FUNC_MODIFIES(*value);
+
+static void add_pcc_named_param(PARROT_INTERP,
+    ARGMOD(SymReg *cur_call),
+    ARGMOD(SymReg *name),
+    ARGMOD(SymReg *value))
+        __attribute__nonnull__(1)
+        __attribute__nonnull__(2)
+        __attribute__nonnull__(3)
+        __attribute__nonnull__(4)
+        FUNC_MODIFIES(*cur_call)
+        FUNC_MODIFIES(*name)
+        FUNC_MODIFIES(*value);
+
+static void add_pcc_named_result(PARROT_INTERP,
+    ARGMOD(SymReg *cur_call),
+    ARGMOD(SymReg *name),
+    ARGMOD(SymReg *value))
+        __attribute__nonnull__(1)
+        __attribute__nonnull__(2)
+        __attribute__nonnull__(3)
+        __attribute__nonnull__(4)
+        FUNC_MODIFIES(*cur_call)
+        FUNC_MODIFIES(*name)
+        FUNC_MODIFIES(*value);
+
+static void add_pcc_named_return(PARROT_INTERP,
+    ARGMOD(SymReg *cur_call),
+    ARGMOD(SymReg *name),
+    ARGMOD(SymReg *value))
+        __attribute__nonnull__(1)
+        __attribute__nonnull__(2)
+        __attribute__nonnull__(3)
+        __attribute__nonnull__(4)
+        FUNC_MODIFIES(*cur_call)
+        FUNC_MODIFIES(*name)
+        FUNC_MODIFIES(*value);
+
+static void adv_named_set(PARROT_INTERP, ARGIN(const char *name))
+        __attribute__nonnull__(1)
+        __attribute__nonnull__(2);
+
+static void adv_named_set_u(PARROT_INTERP, ARGIN(const char *name))
+        __attribute__nonnull__(1)
+        __attribute__nonnull__(2);
+
+static void begin_return_or_yield(PARROT_INTERP, int yield)
+        __attribute__nonnull__(1);
+
+static void clear_state(PARROT_INTERP)
+        __attribute__nonnull__(1);
+
+static void do_loadlib(PARROT_INTERP, ARGIN(const char *lib))
+        __attribute__nonnull__(1)
+        __attribute__nonnull__(2);
+
+PARROT_WARN_UNUSED_RESULT
+PARROT_CAN_RETURN_NULL
+static Instruction* func_ins(PARROT_INTERP,
+    ARGMOD(IMC_Unit *unit),
+    ARGIN(SymReg *lhs),
+    ARGIN(const char *op),
+    ARGMOD(SymReg **r),
     int n,
     int keyv,
     int emit)
@@ -333,23 +582,28 @@
         FUNC_MODIFIES(*name);
 
 #define ASSERT_ARGS_add_pcc_named_arg __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(cur_call) \
+       PARROT_ASSERT_ARG(interp) \
+    , PARROT_ASSERT_ARG(cur_call) \
     , PARROT_ASSERT_ARG(name) \
     , PARROT_ASSERT_ARG(value))
 #define ASSERT_ARGS_add_pcc_named_arg_var __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(cur_call) \
+       PARROT_ASSERT_ARG(interp) \
+    , PARROT_ASSERT_ARG(cur_call) \
     , PARROT_ASSERT_ARG(name) \
     , PARROT_ASSERT_ARG(value))
 #define ASSERT_ARGS_add_pcc_named_param __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(cur_call) \
+       PARROT_ASSERT_ARG(interp) \
+    , PARROT_ASSERT_ARG(cur_call) \
     , PARROT_ASSERT_ARG(name) \
     , PARROT_ASSERT_ARG(value))
 #define ASSERT_ARGS_add_pcc_named_result __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(cur_call) \
+       PARROT_ASSERT_ARG(interp) \
+    , PARROT_ASSERT_ARG(cur_call) \
     , PARROT_ASSERT_ARG(name) \
     , PARROT_ASSERT_ARG(value))
 #define ASSERT_ARGS_add_pcc_named_return __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(cur_call) \
+       PARROT_ASSERT_ARG(interp) \
+    , PARROT_ASSERT_ARG(cur_call) \
     , PARROT_ASSERT_ARG(name) \
     , PARROT_ASSERT_ARG(value))
 #define ASSERT_ARGS_adv_named_set __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
@@ -730,7 +984,7 @@
     Instruction * const i = iLABEL(interp, unit, r);
 
     r->type    = (r->type & VT_ENCODED) ? VT_PCC_SUB|VT_ENCODED : VT_PCC_SUB;
-    r->pcc_sub = mem_allocate_zeroed_typed(pcc_sub_t);
+    r->pcc_sub = mem_gc_allocate_zeroed_typed(interp, pcc_sub_t);
 
     IMCC_INFO(interp)->cur_call = r;
     i->line                     = IMCC_INFO(interp)->line;
@@ -981,105 +1235,111 @@
 
 /*
 
-=item C<static void add_pcc_named_arg(SymReg *cur_call, SymReg *name, SymReg
-*value)>
+=item C<static void add_pcc_named_arg(PARROT_INTERP, SymReg *cur_call, SymReg
+*name, SymReg *value)>
 
 =cut
 
 */
 
 static void
-add_pcc_named_arg(ARGMOD(SymReg *cur_call),
+add_pcc_named_arg(PARROT_INTERP,
+        ARGMOD(SymReg *cur_call),
         ARGMOD(SymReg *name),
         ARGMOD(SymReg *value))
 {
     ASSERT_ARGS(add_pcc_named_arg)
     name->type  |= VT_NAMED;
 
-    add_pcc_arg(cur_call, name);
-    add_pcc_arg(cur_call, value);
+    add_pcc_arg(interp, cur_call, name);
+    add_pcc_arg(interp, cur_call, value);
 }
 
 /*
 
-=item C<static void add_pcc_named_arg_var(SymReg *cur_call, SymReg *name, SymReg
-*value)>
+=item C<static void add_pcc_named_arg_var(PARROT_INTERP, SymReg *cur_call,
+SymReg *name, SymReg *value)>
 
 =cut
 
 */
 
 static void
-add_pcc_named_arg_var(ARGMOD(SymReg *cur_call),
-    ARGMOD(SymReg *name), ARGMOD(SymReg *value))
+add_pcc_named_arg_var(PARROT_INTERP,
+        ARGMOD(SymReg *cur_call),
+        ARGMOD(SymReg *name),
+        ARGMOD(SymReg *value))
 {
     ASSERT_ARGS(add_pcc_named_arg_var)
     name->type |= VT_NAMED;
-    add_pcc_arg(cur_call, name);
-    add_pcc_arg(cur_call, value);
+    add_pcc_arg(interp, cur_call, name);
+    add_pcc_arg(interp, cur_call, value);
 }
 
 /*
 
-=item C<static void add_pcc_named_result(SymReg *cur_call, SymReg *name, SymReg
-*value)>
+=item C<static void add_pcc_named_result(PARROT_INTERP, SymReg *cur_call, SymReg
+*name, SymReg *value)>
 
 =cut
 
 */
 
 static void
-add_pcc_named_result(ARGMOD(SymReg *cur_call),
+add_pcc_named_result(PARROT_INTERP,
+        ARGMOD(SymReg *cur_call),
         ARGMOD(SymReg *name),
         ARGMOD(SymReg *value))
 {
     ASSERT_ARGS(add_pcc_named_result)
     name->type         |= VT_NAMED;
 
-    add_pcc_result(cur_call, name);
-    add_pcc_result(cur_call, value);
+    add_pcc_result(interp, cur_call, name);
+    add_pcc_result(interp, cur_call, value);
 }
 
 /*
 
-=item C<static void add_pcc_named_param(SymReg *cur_call, SymReg *name, SymReg
-*value)>
+=item C<static void add_pcc_named_param(PARROT_INTERP, SymReg *cur_call, SymReg
+*name, SymReg *value)>
 
 =cut
 
 */
 
 static void
-add_pcc_named_param(ARGMOD(SymReg *cur_call),
+add_pcc_named_param(PARROT_INTERP,
+        ARGMOD(SymReg *cur_call),
         ARGMOD(SymReg *name),
         ARGMOD(SymReg *value))
 {
     ASSERT_ARGS(add_pcc_named_param)
     name->type         |= VT_NAMED;
 
-    add_pcc_arg(cur_call, name);
-    add_pcc_arg(cur_call, value);
+    add_pcc_arg(interp, cur_call, name);
+    add_pcc_arg(interp, cur_call, value);
 }
 
 /*
 
-=item C<static void add_pcc_named_return(SymReg *cur_call, SymReg *name, SymReg
-*value)>
+=item C<static void add_pcc_named_return(PARROT_INTERP, SymReg *cur_call, SymReg
+*name, SymReg *value)>
 
 =cut
 
 */
 
 static void
-add_pcc_named_return(ARGMOD(SymReg *cur_call),
+add_pcc_named_return(PARROT_INTERP,
+        ARGMOD(SymReg *cur_call),
         ARGMOD(SymReg *name),
         ARGMOD(SymReg *value))
 {
     ASSERT_ARGS(add_pcc_named_return)
     name->type         |= VT_NAMED;
 
-    add_pcc_result(cur_call, name);
-    add_pcc_result(cur_call, value);
+    add_pcc_result(interp, cur_call, name);
+    add_pcc_result(interp, cur_call, value);
 }
 
 /*
@@ -1122,324 +1382,65 @@
 
 =cut
 
-*/
-
-static void
-do_loadlib(PARROT_INTERP, ARGIN(const char *lib))
-{
-    ASSERT_ARGS(do_loadlib)
-    STRING * const s = Parrot_str_unescape(interp, lib + 1, '"', NULL);
-    PMC    *ignored  = Parrot_load_lib(interp, s, NULL);
-    UNUSED(ignored);
-    Parrot_register_HLL_lib(interp, s);
-}
-
-/* HEADERIZER STOP */
-
-
-
-/* Line 189 of yacc.c  */
-#line 1132 "compilers/imcc/imcparser.c"
-
-/* Enabling traces.  */
-#ifndef YYDEBUG
-# define YYDEBUG 0
-#endif
-
-/* Enabling verbose error messages.  */
-#ifdef YYERROR_VERBOSE
-# undef YYERROR_VERBOSE
-# define YYERROR_VERBOSE 1
-#else
-# define YYERROR_VERBOSE 0
-#endif
-
-/* Enabling the token table.  */
-#ifndef YYTOKEN_TABLE
-# define YYTOKEN_TABLE 0
-#endif
-
-
-/* Tokens.  */
-#ifndef YYTOKENTYPE
-# define YYTOKENTYPE
-   /* Put the tokens into the symbol table, so that GDB and other debuggers
-      know about them.  */
-   enum yytokentype {
-     LOW_PREC = 258,
-     PARAM = 259,
-     HLL = 260,
-     TK_LINE = 261,
-     TK_FILE = 262,
-     GOTO = 263,
-     ARG = 264,
-     IF = 265,
-     UNLESS = 266,
-     PNULL = 267,
-     SET_RETURN = 268,
-     SET_YIELD = 269,
-     ADV_FLAT = 270,
-     ADV_SLURPY = 271,
-     ADV_OPTIONAL = 272,
-     ADV_OPT_FLAG = 273,
-     ADV_NAMED = 274,
-     ADV_ARROW = 275,
-     NEW = 276,
-     ADV_INVOCANT = 277,
-     ADV_CALL_SIG = 278,
-     NAMESPACE = 279,
-     DOT_METHOD = 280,
-     SUB = 281,
-     SYM = 282,
-     LOCAL = 283,
-     LEXICAL = 284,
-     CONST = 285,
-     ANNOTATE = 286,
-     INC = 287,
-     DEC = 288,
-     GLOBAL_CONST = 289,
-     PLUS_ASSIGN = 290,
-     MINUS_ASSIGN = 291,
-     MUL_ASSIGN = 292,
-     DIV_ASSIGN = 293,
-     CONCAT_ASSIGN = 294,
-     BAND_ASSIGN = 295,
-     BOR_ASSIGN = 296,
-     BXOR_ASSIGN = 297,
-     FDIV = 298,
-     FDIV_ASSIGN = 299,
-     MOD_ASSIGN = 300,
-     SHR_ASSIGN = 301,
-     SHL_ASSIGN = 302,
-     SHR_U_ASSIGN = 303,
-     SHIFT_LEFT = 304,
-     SHIFT_RIGHT = 305,
-     INTV = 306,
-     FLOATV = 307,
-     STRINGV = 308,
-     PMCV = 309,
-     LOG_XOR = 310,
-     RELOP_EQ = 311,
-     RELOP_NE = 312,
-     RELOP_GT = 313,
-     RELOP_GTE = 314,
-     RELOP_LT = 315,
-     RELOP_LTE = 316,
-     RESULT = 317,
-     RETURN = 318,
-     TAILCALL = 319,
-     YIELDT = 320,
-     GET_RESULTS = 321,
-     POW = 322,
-     SHIFT_RIGHT_U = 323,
-     LOG_AND = 324,
-     LOG_OR = 325,
-     COMMA = 326,
-     ESUB = 327,
-     DOTDOT = 328,
-     PCC_BEGIN = 329,
-     PCC_END = 330,
-     PCC_CALL = 331,
-     PCC_SUB = 332,
-     PCC_BEGIN_RETURN = 333,
-     PCC_END_RETURN = 334,
-     PCC_BEGIN_YIELD = 335,
-     PCC_END_YIELD = 336,
-     NCI_CALL = 337,
-     METH_CALL = 338,
-     INVOCANT = 339,
-     MAIN = 340,
-     LOAD = 341,
-     INIT = 342,
-     IMMEDIATE = 343,
-     POSTCOMP = 344,
-     METHOD = 345,
-     ANON = 346,
-     OUTER = 347,
-     NEED_LEX = 348,
-     MULTI = 349,
-     VTABLE_METHOD = 350,
-     LOADLIB = 351,
-     SUB_INSTANCE_OF = 352,
-     SUBID = 353,
-     NS_ENTRY = 354,
-     UNIQUE_REG = 355,
-     LABEL = 356,
-     EMIT = 357,
-     EOM = 358,
-     IREG = 359,
-     NREG = 360,
-     SREG = 361,
-     PREG = 362,
-     IDENTIFIER = 363,
-     REG = 364,
-     MACRO = 365,
-     ENDM = 366,
-     STRINGC = 367,
-     INTC = 368,
-     FLOATC = 369,
-     USTRINGC = 370,
-     PARROT_OP = 371,
-     VAR = 372,
-     LINECOMMENT = 373,
-     FILECOMMENT = 374,
-     DOT = 375,
-     CONCAT = 376
-   };
-#endif
-/* Tokens.  */
-#define LOW_PREC 258
-#define PARAM 259
-#define HLL 260
-#define TK_LINE 261
-#define TK_FILE 262
-#define GOTO 263
-#define ARG 264
-#define IF 265
-#define UNLESS 266
-#define PNULL 267
-#define SET_RETURN 268
-#define SET_YIELD 269
-#define ADV_FLAT 270
-#define ADV_SLURPY 271
-#define ADV_OPTIONAL 272
-#define ADV_OPT_FLAG 273
-#define ADV_NAMED 274
-#define ADV_ARROW 275
-#define NEW 276
-#define ADV_INVOCANT 277
-#define ADV_CALL_SIG 278
-#define NAMESPACE 279
-#define DOT_METHOD 280
-#define SUB 281
-#define SYM 282
-#define LOCAL 283
-#define LEXICAL 284
-#define CONST 285
-#define ANNOTATE 286
-#define INC 287
-#define DEC 288
-#define GLOBAL_CONST 289
-#define PLUS_ASSIGN 290
-#define MINUS_ASSIGN 291
-#define MUL_ASSIGN 292
-#define DIV_ASSIGN 293
-#define CONCAT_ASSIGN 294
-#define BAND_ASSIGN 295
-#define BOR_ASSIGN 296
-#define BXOR_ASSIGN 297
-#define FDIV 298
-#define FDIV_ASSIGN 299
-#define MOD_ASSIGN 300
-#define SHR_ASSIGN 301
-#define SHL_ASSIGN 302
-#define SHR_U_ASSIGN 303
-#define SHIFT_LEFT 304
-#define SHIFT_RIGHT 305
-#define INTV 306
-#define FLOATV 307
-#define STRINGV 308
-#define PMCV 309
-#define LOG_XOR 310
-#define RELOP_EQ 311
-#define RELOP_NE 312
-#define RELOP_GT 313
-#define RELOP_GTE 314
-#define RELOP_LT 315
-#define RELOP_LTE 316
-#define RESULT 317
-#define RETURN 318
-#define TAILCALL 319
-#define YIELDT 320
-#define GET_RESULTS 321
-#define POW 322
-#define SHIFT_RIGHT_U 323
-#define LOG_AND 324
-#define LOG_OR 325
-#define COMMA 326
-#define ESUB 327
-#define DOTDOT 328
-#define PCC_BEGIN 329
-#define PCC_END 330
-#define PCC_CALL 331
-#define PCC_SUB 332
-#define PCC_BEGIN_RETURN 333
-#define PCC_END_RETURN 334
-#define PCC_BEGIN_YIELD 335
-#define PCC_END_YIELD 336
-#define NCI_CALL 337
-#define METH_CALL 338
-#define INVOCANT 339
-#define MAIN 340
-#define LOAD 341
-#define INIT 342
-#define IMMEDIATE 343
-#define POSTCOMP 344
-#define METHOD 345
-#define ANON 346
-#define OUTER 347
-#define NEED_LEX 348
-#define MULTI 349
-#define VTABLE_METHOD 350
-#define LOADLIB 351
-#define SUB_INSTANCE_OF 352
-#define SUBID 353
-#define NS_ENTRY 354
-#define UNIQUE_REG 355
-#define LABEL 356
-#define EMIT 357
-#define EOM 358
-#define IREG 359
-#define NREG 360
-#define SREG 361
-#define PREG 362
-#define IDENTIFIER 363
-#define REG 364
-#define MACRO 365
-#define ENDM 366
-#define STRINGC 367
-#define INTC 368
-#define FLOATC 369
-#define USTRINGC 370
-#define PARROT_OP 371
-#define VAR 372
-#define LINECOMMENT 373
-#define FILECOMMENT 374
-#define DOT 375
-#define CONCAT 376
+*/
+
+static void
+do_loadlib(PARROT_INTERP, ARGIN(const char *lib))
+{
+    ASSERT_ARGS(do_loadlib)
+    STRING * const s = Parrot_str_unescape(interp, lib + 1, '"', NULL);
+    PMC    *ignored  = Parrot_load_lib(interp, s, NULL);
+    UNUSED(ignored);
+    Parrot_register_HLL_lib(interp, s);
+}
+
+/* HEADERIZER STOP */
+
 
 
+/* Enabling traces.  */
+#ifndef YYDEBUG
+# define YYDEBUG 0
+#endif
+
+/* Enabling verbose error messages.  */
+#ifdef YYERROR_VERBOSE
+# undef YYERROR_VERBOSE
+# define YYERROR_VERBOSE 1
+#else
+# define YYERROR_VERBOSE 0
+#endif
 
+/* Enabling the token table.  */
+#ifndef YYTOKEN_TABLE
+# define YYTOKEN_TABLE 0
+#endif
 
 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
 typedef union YYSTYPE
+#line 1075 "compilers/imcc/imcc.y"
 {
-
-/* Line 214 of yacc.c  */
-#line 1059 "compilers/imcc/imcc.y"
-
     IdList * idlist;
     int t;
     char * s;
     SymReg * sr;
     Instruction *i;
-
-
-
-/* Line 214 of yacc.c  */
+}
+/* Line 187 of yacc.c.  */
 #line 1420 "compilers/imcc/imcparser.c"
-} YYSTYPE;
-# define YYSTYPE_IS_TRIVIAL 1
+	YYSTYPE;
 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
 # define YYSTYPE_IS_DECLARED 1
+# define YYSTYPE_IS_TRIVIAL 1
 #endif
 
 
+
 /* Copy the second part of user declarations.  */
 
 
-/* Line 264 of yacc.c  */
-#line 1432 "compilers/imcc/imcparser.c"
+/* Line 216 of yacc.c.  */
+#line 1433 "compilers/imcc/imcparser.c"
 
 #ifdef short
 # undef short
@@ -1514,14 +1515,14 @@
 #if (defined __STDC__ || defined __C99__FUNC__ \
      || defined __cplusplus || defined _MSC_VER)
 static int
-YYID (int yyi)
+YYID (int i)
 #else
 static int
-YYID (yyi)
-    int yyi;
+YYID (i)
+    int i;
 #endif
 {
-  return yyi;
+  return i;
 }
 #endif
 
@@ -1602,9 +1603,9 @@
 /* A type that is properly aligned for any stack member.  */
 union yyalloc
 {
-  yytype_int16 yyss_alloc;
-  YYSTYPE yyvs_alloc;
-};
+  yytype_int16 yyss;
+  YYSTYPE yyvs;
+  };
 
 /* The size of the maximum gap between one aligned stack and the next.  */
 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
@@ -1638,12 +1639,12 @@
    elements in the stack, and YYPTR gives the new location of the
    stack.  Advance YYPTR to a properly aligned location for the next
    stack.  */
-# define YYSTACK_RELOCATE(Stack_alloc, Stack)				\
+# define YYSTACK_RELOCATE(Stack)					\
     do									\
       {									\
 	YYSIZE_T yynewbytes;						\
-	YYCOPY (&yyptr->Stack_alloc, Stack, yysize);			\
-	Stack = &yyptr->Stack_alloc;					\
+	YYCOPY (&yyptr->Stack, Stack, yysize);				\
+	Stack = &yyptr->Stack;						\
 	yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
 	yyptr += yynewbytes / sizeof (*yyptr);				\
       }									\
@@ -1860,40 +1861,40 @@
 /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
 static const yytype_uint16 yyrline[] =
 {
-       0,  1154,  1154,  1158,  1159,  1163,  1164,  1165,  1171,  1177,
-    1178,  1179,  1180,  1184,  1185,  1194,  1200,  1208,  1220,  1233,
-    1233,  1242,  1242,  1249,  1249,  1258,  1259,  1263,  1264,  1268,
-    1269,  1270,  1271,  1272,  1273,  1274,  1277,  1277,  1286,  1285,
-    1298,  1302,  1315,  1319,  1323,  1323,  1335,  1337,  1341,  1356,
-    1360,  1365,  1369,  1373,  1364,  1385,  1386,  1387,  1400,  1400,
-    1404,  1430,  1434,  1440,  1449,  1455,  1464,  1470,  1479,  1485,
-    1494,  1502,  1507,  1518,  1521,  1526,  1534,  1535,  1536,  1537,
-    1538,  1549,  1560,  1563,  1565,  1570,  1569,  1602,  1603,  1607,
-    1608,  1612,  1613,  1617,  1618,  1622,  1623,  1624,  1625,  1626,
-    1627,  1628,  1629,  1630,  1631,  1632,  1633,  1634,  1635,  1639,
-    1644,  1648,  1653,  1657,  1661,  1666,  1675,  1676,  1680,  1685,
-    1686,  1694,  1695,  1695,  1710,  1711,  1715,  1716,  1717,  1718,
-    1719,  1720,  1721,  1722,  1727,  1727,  1730,  1738,  1738,  1744,
-    1745,  1750,  1758,  1759,  1764,  1772,  1776,  1781,  1780,  1793,
-    1794,  1798,  1799,  1809,  1814,  1824,  1833,  1834,  1846,  1850,
-    1852,  1853,  1854,  1855,  1856,  1860,  1861,  1865,  1866,  1870,
-    1881,  1882,  1893,  1900,  1909,  1919,  1920,  1925,  1926,  1927,
-    1927,  1943,  1960,  1973,  1973,  1980,  1981,  1981,  1987,  1993,
-    1997,  2009,  2010,  2011,  2012,  2013,  2014,  2018,  2019,  2020,
-    2021,  2025,  2038,  2040,  2042,  2044,  2046,  2051,  2054,  2061,
-    2060,  2069,  2070,  2071,  2072,  2080,  2081,  2082,  2086,  2087,
-    2088,  2089,  2090,  2091,  2092,  2093,  2094,  2095,  2096,  2097,
-    2098,  2099,  2100,  2101,  2102,  2103,  2104,  2105,  2106,  2107,
-    2108,  2114,  2113,  2125,  2130,  2131,  2132,  2133,  2134,  2135,
-    2136,  2137,  2138,  2139,  2140,  2141,  2142,  2147,  2158,  2159,
-    2160,  2161,  2167,  2181,  2187,  2193,  2199,  2198,  2207,  2208,
-    2218,  2228,  2235,  2240,  2250,  2254,  2255,  2259,  2260,  2261,
-    2264,  2265,  2269,  2273,  2283,  2289,  2299,  2304,  2308,  2309,
-    2313,  2317,  2321,  2328,  2332,  2336,  2343,  2344,  2348,  2349,
-    2350,  2351,  2352,  2353,  2357,  2358,  2362,  2363,  2367,  2368,
-    2372,  2373,  2380,  2387,  2388,  2389,  2393,  2394,  2398,  2399,
-    2403,  2404,  2408,  2409,  2413,  2413,  2425,  2425,  2437,  2438,
-    2446,  2453,  2454,  2455,  2456,  2457,  2461,  2462,  2463,  2464
+       0,  1170,  1170,  1174,  1175,  1179,  1180,  1181,  1187,  1193,
+    1194,  1195,  1196,  1200,  1201,  1210,  1216,  1224,  1236,  1249,
+    1249,  1258,  1258,  1265,  1265,  1274,  1275,  1279,  1280,  1284,
+    1285,  1286,  1287,  1288,  1289,  1290,  1293,  1293,  1302,  1301,
+    1314,  1318,  1331,  1335,  1339,  1339,  1351,  1353,  1357,  1372,
+    1376,  1381,  1385,  1389,  1380,  1401,  1402,  1403,  1416,  1416,
+    1420,  1446,  1450,  1456,  1465,  1471,  1480,  1486,  1495,  1501,
+    1510,  1518,  1523,  1534,  1537,  1542,  1550,  1551,  1552,  1553,
+    1554,  1565,  1576,  1579,  1581,  1586,  1585,  1618,  1619,  1623,
+    1624,  1628,  1629,  1633,  1634,  1638,  1639,  1640,  1641,  1642,
+    1643,  1644,  1645,  1646,  1647,  1648,  1649,  1650,  1651,  1655,
+    1660,  1664,  1669,  1673,  1677,  1682,  1691,  1692,  1696,  1701,
+    1702,  1710,  1711,  1711,  1726,  1727,  1731,  1732,  1733,  1734,
+    1735,  1736,  1737,  1738,  1743,  1743,  1746,  1754,  1754,  1760,
+    1761,  1766,  1774,  1775,  1780,  1788,  1792,  1797,  1796,  1809,
+    1810,  1814,  1815,  1825,  1830,  1840,  1849,  1850,  1862,  1866,
+    1868,  1869,  1870,  1871,  1872,  1876,  1877,  1881,  1882,  1886,
+    1897,  1898,  1909,  1916,  1925,  1935,  1936,  1941,  1942,  1943,
+    1943,  1959,  1976,  1989,  1989,  1996,  1997,  1997,  2003,  2009,
+    2013,  2025,  2026,  2027,  2028,  2029,  2030,  2034,  2035,  2036,
+    2037,  2041,  2054,  2056,  2058,  2060,  2062,  2067,  2070,  2077,
+    2076,  2085,  2086,  2087,  2088,  2096,  2097,  2098,  2102,  2103,
+    2104,  2105,  2106,  2107,  2108,  2109,  2110,  2111,  2112,  2113,
+    2114,  2115,  2116,  2117,  2118,  2119,  2120,  2121,  2122,  2123,
+    2124,  2130,  2129,  2141,  2146,  2147,  2148,  2149,  2150,  2151,
+    2152,  2153,  2154,  2155,  2156,  2157,  2158,  2163,  2174,  2175,
+    2176,  2177,  2183,  2197,  2203,  2209,  2215,  2214,  2223,  2224,
+    2234,  2244,  2251,  2256,  2266,  2270,  2271,  2275,  2276,  2277,
+    2280,  2281,  2285,  2289,  2299,  2305,  2315,  2320,  2324,  2325,
+    2329,  2333,  2337,  2344,  2348,  2352,  2359,  2360,  2364,  2365,
+    2366,  2367,  2368,  2369,  2373,  2374,  2378,  2379,  2383,  2384,
+    2388,  2389,  2396,  2403,  2404,  2405,  2409,  2410,  2414,  2415,
+    2419,  2420,  2424,  2425,  2429,  2429,  2441,  2441,  2453,  2454,
+    2462,  2469,  2470,  2471,  2472,  2473,  2477,  2478,  2479,  2480
 };
 #endif
 
@@ -1923,31 +1924,30 @@
   "EMIT", "EOM", "IREG", "NREG", "SREG", "PREG", "IDENTIFIER", "REG",
   "MACRO", "ENDM", "STRINGC", "INTC", "FLOATC", "USTRINGC", "PARROT_OP",
   "VAR", "LINECOMMENT", "FILECOMMENT", "DOT", "CONCAT", "'='", "'['",
-  "']'", "'('", "')'", "'n'", "'!'", "'~'", "'-'", "'+'", "'*'", "'/'",
+  "']'", "'('", "')'", "'new'", "'!'", "'~'", "'-'", "'+'", "'*'", "'/'",
   "'%'", "'&'", "'|'", "';'", "$accept", "program", "compilation_units",
   "compilation_unit", "pragma", "location_directive", "annotate_directive",
-  "hll_def", "constdef", "$@1", "pmc_const", "$@2", "$@3", "any_string",
-  "pasmcode", "pasmline", "pasm_inst", "$@4", "$@5", "pasm_args", "emit",
-  "$@6", "opt_pasmcode", "class_namespace", "maybe_ns", "sub", "$@7",
-  "$@8", "$@9", "sub_params", "sub_param", "$@10", "sub_param_type_def",
-  "multi", "outer", "vtable", "method", "ns_entry_name", "instanceof",
-  "subid", "multi_types", "multi_type", "sub_body", "pcc_sub_call", "@11",
+  "hll_def", "constdef", "@1", "pmc_const", "@2", "@3", "any_string",
+  "pasmcode", "pasmline", "pasm_inst", "@4", "@5", "pasm_args", "emit",
+  "@6", "opt_pasmcode", "class_namespace", "maybe_ns", "sub", "@7", "@8",
+  "@9", "sub_params", "sub_param", "@10", "sub_param_type_def", "multi",
+  "outer", "vtable", "method", "ns_entry_name", "instanceof", "subid",
+  "multi_types", "multi_type", "sub_body", "pcc_sub_call", "@11",
   "opt_label", "opt_invocant", "sub_proto", "sub_proto_list", "proto",
-  "pcc_call", "pcc_args", "pcc_arg", "pcc_results", "pcc_result", "$@12",
-  "paramtype_list", "paramtype", "pcc_ret", "$@13", "pcc_yield", "$@14",
+  "pcc_call", "pcc_args", "pcc_arg", "pcc_results", "pcc_result", "@12",
+  "paramtype_list", "paramtype", "pcc_ret", "@13", "pcc_yield", "@14",
   "pcc_returns", "pcc_yields", "pcc_return", "pcc_set_yield",
-  "pcc_return_many", "$@15", "return_or_yield", "var_returns",
-  "statements", "helper_clear_state", "statement", "labels", "_labels",
-  "label", "instruction", "id_list", "id_list_id", "opt_unique_reg",
-  "labeled_inst", "$@16", "$@17", "$@18", "type", "classname",
-  "assignment", "@19", "un_op", "bin_op", "get_results", "@20",
-  "op_assign", "assign_op", "func_assign", "the_sub", "sub_call", "@21",
-  "arglist", "arg", "argtype_list", "argtype", "result", "targetlist",
-  "conditional_statement", "unless_statement", "if_statement",
-  "comma_or_goto", "relop", "target", "vars", "_vars", "_var_or_i",
-  "sub_label_op_c", "sub_label_op", "label_op", "var_or_i", "var",
-  "keylist", "$@22", "keylist_force", "$@23", "_keylist", "key", "reg",
-  "const", 0
+  "pcc_return_many", "@15", "return_or_yield", "var_returns", "statements",
+  "helper_clear_state", "statement", "labels", "_labels", "label",
+  "instruction", "id_list", "id_list_id", "opt_unique_reg", "labeled_inst",
+  "@16", "@17", "@18", "type", "classname", "assignment", "@19", "un_op",
+  "bin_op", "get_results", "@20", "op_assign", "assign_op", "func_assign",
+  "the_sub", "sub_call", "@21", "arglist", "arg", "argtype_list",
+  "argtype", "result", "targetlist", "conditional_statement",
+  "unless_statement", "if_statement", "comma_or_goto", "relop", "target",
+  "vars", "_vars", "_var_or_i", "sub_label_op_c", "sub_label_op",
+  "label_op", "var_or_i", "var", "keylist", "@22", "keylist_force", "@23",
+  "_keylist", "key", "reg", "const", 0
 };
 #endif
 
@@ -2605,20 +2605,17 @@
 #if (defined __STDC__ || defined __C99__FUNC__ \
      || defined __cplusplus || defined _MSC_VER)
 static void
-yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
+yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
 #else
 static void
-yy_stack_print (yybottom, yytop)
-    yytype_int16 *yybottom;
-    yytype_int16 *yytop;
+yy_stack_print (bottom, top)
+    yytype_int16 *bottom;
+    yytype_int16 *top;
 #endif
 {
   YYFPRINTF (stderr, "Stack now");
-  for (; yybottom <= yytop; yybottom++)
-    {
-      int yybot = *yybottom;
-      YYFPRINTF (stderr, " %d", yybot);
-    }
+  for (; bottom <= top; ++bottom)
+    YYFPRINTF (stderr, " %d", *bottom);
   YYFPRINTF (stderr, "\n");
 }
 
@@ -2654,11 +2651,11 @@
   /* The symbols being reduced.  */
   for (yyi = 0; yyi < yynrhs; yyi++)
     {
-      YYFPRINTF (stderr, "   $%d = ", yyi + 1);
+      fprintf (stderr, "   $%d = ", yyi + 1);
       yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
 		       &(yyvsp[(yyi + 1) - (yynrhs)])
 		       		       , yyscanner, interp);
-      YYFPRINTF (stderr, "\n");
+      fprintf (stderr, "\n");
     }
 }
 
@@ -2942,8 +2939,10 @@
 	break;
     }
 }
+
 
 /* Prevent warnings from -Wmissing-prototypes.  */
+
 #ifdef YYPARSE_PARAM
 #if defined __STDC__ || defined __cplusplus
 int yyparse (void *YYPARSE_PARAM);
@@ -2962,9 +2961,10 @@
 
 
 
-/*-------------------------.
-| yyparse or yypush_parse.  |
-`-------------------------*/
+
+/*----------.
+| yyparse.  |
+`----------*/
 
 #ifdef YYPARSE_PARAM
 #if (defined __STDC__ || defined __C99__FUNC__ \
@@ -2989,46 +2989,22 @@
 #endif
 #endif
 {
-/* The lookahead symbol.  */
+  /* The look-ahead symbol.  */
 int yychar;
 
-/* The semantic value of the lookahead symbol.  */
+/* The semantic value of the look-ahead symbol.  */
 YYSTYPE yylval;
 
-    /* Number of syntax errors so far.  */
-    int yynerrs;
-
-    int yystate;
-    /* Number of tokens to shift before error messages enabled.  */
-    int yyerrstatus;
-
-    /* The stacks and their tools:
-       `yyss': related to states.
-       `yyvs': related to semantic values.
-
-       Refer to the stacks thru separate pointers, to allow yyoverflow
-       to reallocate them elsewhere.  */
-
-    /* The state stack.  */
-    yytype_int16 yyssa[YYINITDEPTH];
-    yytype_int16 *yyss;
-    yytype_int16 *yyssp;
-
-    /* The semantic value stack.  */
-    YYSTYPE yyvsa[YYINITDEPTH];
-    YYSTYPE *yyvs;
-    YYSTYPE *yyvsp;
-
-    YYSIZE_T yystacksize;
+/* Number of syntax errors so far.  */
+int yynerrs;
 
+  int yystate;
   int yyn;
   int yyresult;
-  /* Lookahead token as an internal (translated) token number.  */
-  int yytoken;
-  /* The variables used to return semantic value and location from the
-     action routines.  */
-  YYSTYPE yyval;
-
+  /* Number of tokens to shift before error messages enabled.  */
+  int yyerrstatus;
+  /* Look-ahead token as an internal (translated) token number.  */
+  int yytoken = 0;
 #if YYERROR_VERBOSE
   /* Buffer for error messages, and its allocated size.  */
   char yymsgbuf[128];
@@ -3036,28 +3012,51 @@
   YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
 #endif
 
+  /* Three stacks and their tools:
+     `yyss': related to states,
+     `yyvs': related to semantic values,
+     `yyls': related to locations.
+
+     Refer to the stacks thru separate pointers, to allow yyoverflow
+     to reallocate them elsewhere.  */
+
+  /* The state stack.  */
+  yytype_int16 yyssa[YYINITDEPTH];
+  yytype_int16 *yyss = yyssa;
+  yytype_int16 *yyssp;
+
+  /* The semantic value stack.  */
+  YYSTYPE yyvsa[YYINITDEPTH];
+  YYSTYPE *yyvs = yyvsa;
+  YYSTYPE *yyvsp;
+
+
+
 #define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))
 
+  YYSIZE_T yystacksize = YYINITDEPTH;
+
+  /* The variables used to return semantic value and location from the
+     action routines.  */
+  YYSTYPE yyval;
+
+
   /* The number of symbols on the RHS of the reduced rule.
      Keep to zero when no symbol should be popped.  */
   int yylen = 0;
 
-  yytoken = 0;
-  yyss = yyssa;
-  yyvs = yyvsa;
-  yystacksize = YYINITDEPTH;
-
   YYDPRINTF ((stderr, "Starting parse\n"));
 
   yystate = 0;
   yyerrstatus = 0;
   yynerrs = 0;
-  yychar = YYEMPTY; /* Cause a token to be read.  */
+  yychar = YYEMPTY;		/* Cause a token to be read.  */
 
   /* Initialize stack pointers.
      Waste one element of value and location stack
      so that they stay on the same level as the state stack.
      The wasted elements are never initialized.  */
+
   yyssp = yyss;
   yyvsp = yyvs;
 
@@ -3087,6 +3086,7 @@
 	YYSTYPE *yyvs1 = yyvs;
 	yytype_int16 *yyss1 = yyss;
 
+
 	/* Each stack pointer address is followed by the size of the
 	   data in use in that stack, in bytes.  This used to be a
 	   conditional around just the two extra args, but that might
@@ -3094,6 +3094,7 @@
 	yyoverflow (YY_("memory exhausted"),
 		    &yyss1, yysize * sizeof (*yyssp),
 		    &yyvs1, yysize * sizeof (*yyvsp),
+
 		    &yystacksize);
 
 	yyss = yyss1;
@@ -3116,8 +3117,9 @@
 	  (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
 	if (! yyptr)
 	  goto yyexhaustedlab;
-	YYSTACK_RELOCATE (yyss_alloc, yyss);
-	YYSTACK_RELOCATE (yyvs_alloc, yyvs);
+	YYSTACK_RELOCATE (yyss);
+	YYSTACK_RELOCATE (yyvs);
+
 #  undef YYSTACK_RELOCATE
 	if (yyss1 != yyssa)
 	  YYSTACK_FREE (yyss1);
@@ -3128,6 +3130,7 @@
       yyssp = yyss + yysize - 1;
       yyvsp = yyvs + yysize - 1;
 
+
       YYDPRINTF ((stderr, "Stack size increased to %lu\n",
 		  (unsigned long int) yystacksize));
 
@@ -3137,9 +3140,6 @@
 
   YYDPRINTF ((stderr, "Entering state %d\n", yystate));
 
-  if (yystate == YYFINAL)
-    YYACCEPT;
-
   goto yybackup;
 
 /*-----------.
@@ -3148,16 +3148,16 @@
 yybackup:
 
   /* Do appropriate processing given the current state.  Read a
-     lookahead token if we need one and don't already have one.  */
+     look-ahead token if we need one and don't already have one.  */
 
-  /* First try to decide what to do without reference to lookahead token.  */
+  /* First try to decide what to do without reference to look-ahead token.  */
   yyn = yypact[yystate];
   if (yyn == YYPACT_NINF)
     goto yydefault;
 
-  /* Not known => get a lookahead token if don't already have one.  */
+  /* Not known => get a look-ahead token if don't already have one.  */
 
-  /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
+  /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol.  */
   if (yychar == YYEMPTY)
     {
       YYDPRINTF ((stderr, "Reading a token: "));
@@ -3189,16 +3189,20 @@
       goto yyreduce;
     }
 
+  if (yyn == YYFINAL)
+    YYACCEPT;
+
   /* Count tokens shifted since error; after three, turn off error
      status.  */
   if (yyerrstatus)
     yyerrstatus--;
 
-  /* Shift the lookahead token.  */
+  /* Shift the look-ahead token.  */
   YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
 
-  /* Discard the shifted token.  */
-  yychar = YYEMPTY;
+  /* Discard the shifted token unless it is eof.  */
+  if (yychar != YYEOF)
+    yychar = YYEMPTY;
 
   yystate = yyn;
   *++yyvsp = yylval;
@@ -3238,30 +3242,22 @@
   switch (yyn)
     {
         case 2:
-
-/* Line 1455 of yacc.c  */
-#line 1154 "compilers/imcc/imcc.y"
+#line 1170 "compilers/imcc/imcc.y"
     { if (yynerrs) YYABORT; (yyval.i) = 0; }
     break;
 
   case 5:
-
-/* Line 1455 of yacc.c  */
-#line 1163 "compilers/imcc/imcc.y"
+#line 1179 "compilers/imcc/imcc.y"
     { (yyval.i) = (yyvsp[(1) - (1)].i); }
     break;
 
   case 6:
-
-/* Line 1455 of yacc.c  */
-#line 1164 "compilers/imcc/imcc.y"
+#line 1180 "compilers/imcc/imcc.y"
     { (yyval.i) = (yyvsp[(1) - (1)].i); }
     break;
 
   case 7:
-
-/* Line 1455 of yacc.c  */
-#line 1166 "compilers/imcc/imcc.y"
+#line 1182 "compilers/imcc/imcc.y"
     {
            (yyval.i) = (yyvsp[(1) - (1)].i);
            imc_close_unit(interp, IMCC_INFO(interp)->cur_unit);
@@ -3270,9 +3266,7 @@
     break;
 
   case 8:
-
-/* Line 1455 of yacc.c  */
-#line 1172 "compilers/imcc/imcc.y"
+#line 1188 "compilers/imcc/imcc.y"
     {
            (yyval.i) = (yyvsp[(1) - (1)].i);
            imc_close_unit(interp, IMCC_INFO(interp)->cur_unit);
@@ -3281,44 +3275,32 @@
     break;
 
   case 9:
-
-/* Line 1455 of yacc.c  */
-#line 1177 "compilers/imcc/imcc.y"
+#line 1193 "compilers/imcc/imcc.y"
     { (yyval.i) = 0; }
     break;
 
   case 10:
-
-/* Line 1455 of yacc.c  */
-#line 1178 "compilers/imcc/imcc.y"
+#line 1194 "compilers/imcc/imcc.y"
     { (yyval.i) = 0; }
     break;
 
   case 11:
-
-/* Line 1455 of yacc.c  */
-#line 1179 "compilers/imcc/imcc.y"
+#line 1195 "compilers/imcc/imcc.y"
     { (yyval.i) = 0; }
     break;
 
   case 12:
-
-/* Line 1455 of yacc.c  */
-#line 1180 "compilers/imcc/imcc.y"
+#line 1196 "compilers/imcc/imcc.y"
     { (yyval.i) = 0; }
     break;
 
   case 13:
-
-/* Line 1455 of yacc.c  */
-#line 1184 "compilers/imcc/imcc.y"
+#line 1200 "compilers/imcc/imcc.y"
     { (yyval.i) = 0; }
     break;
 
   case 14:
-
-/* Line 1455 of yacc.c  */
-#line 1186 "compilers/imcc/imcc.y"
+#line 1202 "compilers/imcc/imcc.y"
     {
            (yyval.i) = 0;
            do_loadlib(interp, (yyvsp[(2) - (3)].s));
@@ -3327,9 +3309,7 @@
     break;
 
   case 15:
-
-/* Line 1455 of yacc.c  */
-#line 1195 "compilers/imcc/imcc.y"
+#line 1211 "compilers/imcc/imcc.y"
     {
            IMCC_INFO(interp)->line = atoi((yyvsp[(2) - (5)].s));
            /* set_filename() frees the STRINGC */
@@ -3338,9 +3318,7 @@
     break;
 
   case 16:
-
-/* Line 1455 of yacc.c  */
-#line 1201 "compilers/imcc/imcc.y"
+#line 1217 "compilers/imcc/imcc.y"
     {
            /* set_filename() frees the STRINGC */
            set_filename(interp, (yyvsp[(2) - (3)].s));
@@ -3348,9 +3326,7 @@
     break;
 
   case 17:
-
-/* Line 1455 of yacc.c  */
-#line 1209 "compilers/imcc/imcc.y"
+#line 1225 "compilers/imcc/imcc.y"
     {
           /* We'll want to store an entry while emitting instructions, so just
            * store annotation like it's an instruction. */
@@ -3361,9 +3337,7 @@
     break;
 
   case 18:
-
-/* Line 1455 of yacc.c  */
-#line 1221 "compilers/imcc/imcc.y"
+#line 1237 "compilers/imcc/imcc.y"
     {
             STRING * const hll_name = Parrot_str_unescape(interp, (yyvsp[(2) - (2)].s) + 1, '"', NULL);
             Parrot_pcc_set_HLL(interp, CURRENT_CONTEXT(interp),
@@ -3376,16 +3350,12 @@
     break;
 
   case 19:
-
-/* Line 1455 of yacc.c  */
-#line 1233 "compilers/imcc/imcc.y"
+#line 1249 "compilers/imcc/imcc.y"
     { IMCC_INFO(interp)->is_def = 1; }
     break;
 
   case 20:
-
-/* Line 1455 of yacc.c  */
-#line 1234 "compilers/imcc/imcc.y"
+#line 1250 "compilers/imcc/imcc.y"
     {
              mk_const_ident(interp, (yyvsp[(4) - (6)].s), (yyvsp[(3) - (6)].t), (yyvsp[(6) - (6)].sr), 1);
              mem_sys_free((yyvsp[(4) - (6)].s));
@@ -3394,16 +3364,12 @@
     break;
 
   case 21:
-
-/* Line 1455 of yacc.c  */
-#line 1242 "compilers/imcc/imcc.y"
+#line 1258 "compilers/imcc/imcc.y"
     { IMCC_INFO(interp)->is_def = 1; }
     break;
 
   case 22:
-
-/* Line 1455 of yacc.c  */
-#line 1243 "compilers/imcc/imcc.y"
+#line 1259 "compilers/imcc/imcc.y"
     {
            (yyval.i) = mk_pmc_const(interp, IMCC_INFO(interp)->cur_unit, (yyvsp[(3) - (6)].s), (yyvsp[(4) - (6)].sr), (yyvsp[(6) - (6)].s));
            mem_sys_free((yyvsp[(6) - (6)].s));
@@ -3412,16 +3378,12 @@
     break;
 
   case 23:
-
-/* Line 1455 of yacc.c  */
-#line 1249 "compilers/imcc/imcc.y"
+#line 1265 "compilers/imcc/imcc.y"
     { IMCC_INFO(interp)->is_def = 1; }
     break;
 
   case 24:
-
-/* Line 1455 of yacc.c  */
-#line 1250 "compilers/imcc/imcc.y"
+#line 1266 "compilers/imcc/imcc.y"
     {
            (yyval.i) = mk_pmc_const_named(interp, IMCC_INFO(interp)->cur_unit, (yyvsp[(3) - (6)].s), (yyvsp[(4) - (6)].sr), (yyvsp[(6) - (6)].s));
            mem_sys_free((yyvsp[(3) - (6)].s));
@@ -3431,51 +3393,37 @@
     break;
 
   case 29:
-
-/* Line 1455 of yacc.c  */
-#line 1268 "compilers/imcc/imcc.y"
+#line 1284 "compilers/imcc/imcc.y"
     { (yyval.i) = 0;  }
     break;
 
   case 30:
-
-/* Line 1455 of yacc.c  */
-#line 1269 "compilers/imcc/imcc.y"
+#line 1285 "compilers/imcc/imcc.y"
     { (yyval.i) = 0;  }
     break;
 
   case 31:
-
-/* Line 1455 of yacc.c  */
-#line 1270 "compilers/imcc/imcc.y"
+#line 1286 "compilers/imcc/imcc.y"
     { (yyval.i) = 0;  }
     break;
 
   case 32:
-
-/* Line 1455 of yacc.c  */
-#line 1271 "compilers/imcc/imcc.y"
+#line 1287 "compilers/imcc/imcc.y"
     { (yyval.i) = 0;  }
     break;
 
   case 33:
-
-/* Line 1455 of yacc.c  */
-#line 1272 "compilers/imcc/imcc.y"
+#line 1288 "compilers/imcc/imcc.y"
     { (yyval.i) = (yyvsp[(1) - (1)].i); }
     break;
 
   case 36:
-
-/* Line 1455 of yacc.c  */
-#line 1277 "compilers/imcc/imcc.y"
+#line 1293 "compilers/imcc/imcc.y"
     { clear_state(interp); }
     break;
 
   case 37:
-
-/* Line 1455 of yacc.c  */
-#line 1279 "compilers/imcc/imcc.y"
+#line 1295 "compilers/imcc/imcc.y"
     {
            (yyval.i) = INS(interp, IMCC_INFO(interp)->cur_unit,
                     (yyvsp[(2) - (3)].s), 0, IMCC_INFO(interp)->regs,
@@ -3485,9 +3433,7 @@
     break;
 
   case 38:
-
-/* Line 1455 of yacc.c  */
-#line 1286 "compilers/imcc/imcc.y"
+#line 1302 "compilers/imcc/imcc.y"
     {
            imc_close_unit(interp, IMCC_INFO(interp)->cur_unit);
            IMCC_INFO(interp)->cur_unit = imc_open_unit(interp, IMC_PASM);
@@ -3495,9 +3441,7 @@
     break;
 
   case 39:
-
-/* Line 1455 of yacc.c  */
-#line 1291 "compilers/imcc/imcc.y"
+#line 1307 "compilers/imcc/imcc.y"
     {
            (yyval.i) = iSUBROUTINE(interp,
                     IMCC_INFO(interp)->cur_unit,
@@ -3508,18 +3452,14 @@
     break;
 
   case 40:
-
-/* Line 1455 of yacc.c  */
-#line 1299 "compilers/imcc/imcc.y"
+#line 1315 "compilers/imcc/imcc.y"
     {
            (yyval.i) = MK_I(interp, IMCC_INFO(interp)->cur_unit, "null", 1, (yyvsp[(2) - (2)].sr));
          }
     break;
 
   case 41:
-
-/* Line 1455 of yacc.c  */
-#line 1303 "compilers/imcc/imcc.y"
+#line 1319 "compilers/imcc/imcc.y"
     {
            char   *name = mem_sys_strdup((yyvsp[(2) - (4)].s) + 1);
            SymReg *r    = mk_pasm_reg(interp, (yyvsp[(4) - (4)].s));
@@ -3535,23 +3475,17 @@
     break;
 
   case 42:
-
-/* Line 1455 of yacc.c  */
-#line 1315 "compilers/imcc/imcc.y"
+#line 1331 "compilers/imcc/imcc.y"
     { (yyval.i) = 0;}
     break;
 
   case 44:
-
-/* Line 1455 of yacc.c  */
-#line 1323 "compilers/imcc/imcc.y"
+#line 1339 "compilers/imcc/imcc.y"
     { IMCC_INFO(interp)->cur_unit = imc_open_unit(interp, IMC_PASM); }
     break;
 
   case 45:
-
-/* Line 1455 of yacc.c  */
-#line 1326 "compilers/imcc/imcc.y"
+#line 1342 "compilers/imcc/imcc.y"
     {
            /* if (optimizer_level & OPT_PASM)
                          imc_compile_unit(interp, IMCC_INFO(interp)->cur_unit);
@@ -3562,9 +3496,7 @@
     break;
 
   case 48:
-
-/* Line 1455 of yacc.c  */
-#line 1342 "compilers/imcc/imcc.y"
+#line 1358 "compilers/imcc/imcc.y"
     {
            int re_open = 0;
            (yyval.i) = 0;
@@ -3579,43 +3511,33 @@
     break;
 
   case 49:
-
-/* Line 1455 of yacc.c  */
-#line 1357 "compilers/imcc/imcc.y"
+#line 1373 "compilers/imcc/imcc.y"
     {
             (yyval.sr) = (yyvsp[(2) - (3)].sr);
         }
     break;
 
   case 50:
-
-/* Line 1455 of yacc.c  */
-#line 1360 "compilers/imcc/imcc.y"
+#line 1376 "compilers/imcc/imcc.y"
     { (yyval.sr) = NULL; }
     break;
 
   case 51:
-
-/* Line 1455 of yacc.c  */
-#line 1365 "compilers/imcc/imcc.y"
+#line 1381 "compilers/imcc/imcc.y"
     {
            IMCC_INFO(interp)->cur_unit = imc_open_unit(interp, IMC_PCCSUB);
          }
     break;
 
   case 52:
-
-/* Line 1455 of yacc.c  */
-#line 1369 "compilers/imcc/imcc.y"
+#line 1385 "compilers/imcc/imcc.y"
     {
            iSUBROUTINE(interp, IMCC_INFO(interp)->cur_unit, (yyvsp[(3) - (3)].sr));
          }
     break;
 
   case 53:
-
-/* Line 1455 of yacc.c  */
-#line 1373 "compilers/imcc/imcc.y"
+#line 1389 "compilers/imcc/imcc.y"
     {
           IMCC_INFO(interp)->cur_call->pcc_sub->pragma = (yyvsp[(5) - (6)].t);
           if (!IMCC_INFO(interp)->cur_unit->instructions->symregs[0]->subid) {
@@ -3626,59 +3548,45 @@
     break;
 
   case 54:
-
-/* Line 1455 of yacc.c  */
-#line 1381 "compilers/imcc/imcc.y"
+#line 1397 "compilers/imcc/imcc.y"
     { (yyval.i) = 0; IMCC_INFO(interp)->cur_call = NULL; }
     break;
 
   case 55:
-
-/* Line 1455 of yacc.c  */
-#line 1385 "compilers/imcc/imcc.y"
+#line 1401 "compilers/imcc/imcc.y"
     { (yyval.sr) = 0; }
     break;
 
   case 56:
-
-/* Line 1455 of yacc.c  */
-#line 1386 "compilers/imcc/imcc.y"
+#line 1402 "compilers/imcc/imcc.y"
     { (yyval.sr) = 0; }
     break;
 
   case 57:
-
-/* Line 1455 of yacc.c  */
-#line 1388 "compilers/imcc/imcc.y"
+#line 1404 "compilers/imcc/imcc.y"
     {
            if (IMCC_INFO(interp)->adv_named_id) {
-                 add_pcc_named_param(IMCC_INFO(interp)->cur_call,
+                 add_pcc_named_param(interp, IMCC_INFO(interp)->cur_call,
                                      IMCC_INFO(interp)->adv_named_id, (yyvsp[(2) - (3)].sr));
                  IMCC_INFO(interp)->adv_named_id = NULL;
            }
            else
-               add_pcc_arg(IMCC_INFO(interp)->cur_call, (yyvsp[(2) - (3)].sr));
+               add_pcc_arg(interp, IMCC_INFO(interp)->cur_call, (yyvsp[(2) - (3)].sr));
          }
     break;
 
   case 58:
-
-/* Line 1455 of yacc.c  */
-#line 1400 "compilers/imcc/imcc.y"
+#line 1416 "compilers/imcc/imcc.y"
     { IMCC_INFO(interp)->is_def = 1; }
     break;
 
   case 59:
-
-/* Line 1455 of yacc.c  */
-#line 1400 "compilers/imcc/imcc.y"
+#line 1416 "compilers/imcc/imcc.y"
     { (yyval.sr) = (yyvsp[(3) - (3)].sr); IMCC_INFO(interp)->is_def = 0; }
     break;
 
   case 60:
-
-/* Line 1455 of yacc.c  */
-#line 1405 "compilers/imcc/imcc.y"
+#line 1421 "compilers/imcc/imcc.y"
     {
            if ((yyvsp[(3) - (3)].t) & VT_UNIQUE_REG)
                (yyval.sr) = mk_ident_ur(interp, (yyvsp[(2) - (3)].s), (yyvsp[(1) - (3)].t));
@@ -3702,16 +3610,12 @@
     break;
 
   case 61:
-
-/* Line 1455 of yacc.c  */
-#line 1430 "compilers/imcc/imcc.y"
+#line 1446 "compilers/imcc/imcc.y"
     { (yyval.t) = 0; }
     break;
 
   case 62:
-
-/* Line 1455 of yacc.c  */
-#line 1435 "compilers/imcc/imcc.y"
+#line 1451 "compilers/imcc/imcc.y"
     {
            (yyval.t) = 0;
            IMCC_INFO(interp)->cur_unit->outer = mk_sub_address_fromc(interp, (yyvsp[(3) - (4)].s));
@@ -3720,9 +3624,7 @@
     break;
 
   case 63:
-
-/* Line 1455 of yacc.c  */
-#line 1441 "compilers/imcc/imcc.y"
+#line 1457 "compilers/imcc/imcc.y"
     {
            (yyval.t) = 0;
            IMCC_INFO(interp)->cur_unit->outer = mk_const(interp, (yyvsp[(3) - (4)].s), 'S');
@@ -3731,9 +3633,7 @@
     break;
 
   case 64:
-
-/* Line 1455 of yacc.c  */
-#line 1450 "compilers/imcc/imcc.y"
+#line 1466 "compilers/imcc/imcc.y"
     {
            (yyval.t) = P_VTABLE;
            IMCC_INFO(interp)->cur_unit->vtable_name      = NULL;
@@ -3742,9 +3642,7 @@
     break;
 
   case 65:
-
-/* Line 1455 of yacc.c  */
-#line 1456 "compilers/imcc/imcc.y"
+#line 1472 "compilers/imcc/imcc.y"
     {
            (yyval.t) = P_VTABLE;
            IMCC_INFO(interp)->cur_unit->vtable_name      = (yyvsp[(3) - (4)].s);
@@ -3753,9 +3651,7 @@
     break;
 
   case 66:
-
-/* Line 1455 of yacc.c  */
-#line 1465 "compilers/imcc/imcc.y"
+#line 1481 "compilers/imcc/imcc.y"
     {
            (yyval.t) = P_METHOD;
            IMCC_INFO(interp)->cur_unit->method_name = NULL;
@@ -3764,9 +3660,7 @@
     break;
 
   case 67:
-
-/* Line 1455 of yacc.c  */
-#line 1471 "compilers/imcc/imcc.y"
+#line 1487 "compilers/imcc/imcc.y"
     {
            (yyval.t) = P_METHOD;
            IMCC_INFO(interp)->cur_unit->method_name = (yyvsp[(3) - (4)].s);
@@ -3775,9 +3669,7 @@
     break;
 
   case 68:
-
-/* Line 1455 of yacc.c  */
-#line 1480 "compilers/imcc/imcc.y"
+#line 1496 "compilers/imcc/imcc.y"
     {
            (yyval.t) = 0;
            IMCC_INFO(interp)->cur_unit->ns_entry_name     = NULL;
@@ -3786,9 +3678,7 @@
     break;
 
   case 69:
-
-/* Line 1455 of yacc.c  */
-#line 1486 "compilers/imcc/imcc.y"
+#line 1502 "compilers/imcc/imcc.y"
     {
            (yyval.t) = 0;
            IMCC_INFO(interp)->cur_unit->ns_entry_name = (yyvsp[(3) - (4)].s);
@@ -3797,9 +3687,7 @@
     break;
 
   case 70:
-
-/* Line 1455 of yacc.c  */
-#line 1495 "compilers/imcc/imcc.y"
+#line 1511 "compilers/imcc/imcc.y"
     {
            (yyval.t) = 0;
            IMCC_INFO(interp)->cur_unit->instance_of = (yyvsp[(3) - (4)].s);
@@ -3807,9 +3695,7 @@
     break;
 
   case 71:
-
-/* Line 1455 of yacc.c  */
-#line 1503 "compilers/imcc/imcc.y"
+#line 1519 "compilers/imcc/imcc.y"
     {
            (yyval.t) = 0;
            IMCC_INFO(interp)->cur_unit->subid = NULL;
@@ -3817,9 +3703,7 @@
     break;
 
   case 72:
-
-/* Line 1455 of yacc.c  */
-#line 1508 "compilers/imcc/imcc.y"
+#line 1524 "compilers/imcc/imcc.y"
     {
            (yyval.t) = 0;
            IMCC_INFO(interp)->cur_unit->subid = mk_const(interp, (yyvsp[(3) - (4)].s), 'S');
@@ -3829,66 +3713,50 @@
     break;
 
   case 73:
-
-/* Line 1455 of yacc.c  */
-#line 1518 "compilers/imcc/imcc.y"
+#line 1534 "compilers/imcc/imcc.y"
     {
-           add_pcc_multi(IMCC_INFO(interp)->cur_call, NULL);
+           add_pcc_multi(interp, IMCC_INFO(interp)->cur_call, NULL);
          }
     break;
 
   case 74:
-
-/* Line 1455 of yacc.c  */
-#line 1522 "compilers/imcc/imcc.y"
+#line 1538 "compilers/imcc/imcc.y"
     {
            (yyval.t) = 0;
-           add_pcc_multi(IMCC_INFO(interp)->cur_call, (yyvsp[(3) - (3)].sr));
+           add_pcc_multi(interp, IMCC_INFO(interp)->cur_call, (yyvsp[(3) - (3)].sr));
          }
     break;
 
   case 75:
-
-/* Line 1455 of yacc.c  */
-#line 1527 "compilers/imcc/imcc.y"
+#line 1543 "compilers/imcc/imcc.y"
     {
            (yyval.t) = 0;
-           add_pcc_multi(IMCC_INFO(interp)->cur_call, (yyvsp[(1) - (1)].sr));
+           add_pcc_multi(interp, IMCC_INFO(interp)->cur_call, (yyvsp[(1) - (1)].sr));
          }
     break;
 
   case 76:
-
-/* Line 1455 of yacc.c  */
-#line 1534 "compilers/imcc/imcc.y"
+#line 1550 "compilers/imcc/imcc.y"
     { (yyval.sr) = mk_const(interp, "INTVAL",   'S'); }
     break;
 
   case 77:
-
-/* Line 1455 of yacc.c  */
-#line 1535 "compilers/imcc/imcc.y"
+#line 1551 "compilers/imcc/imcc.y"
     { (yyval.sr) = mk_const(interp, "FLOATVAL", 'S'); }
     break;
 
   case 78:
-
-/* Line 1455 of yacc.c  */
-#line 1536 "compilers/imcc/imcc.y"
+#line 1552 "compilers/imcc/imcc.y"
     { (yyval.sr) = mk_const(interp, "PMC",      'S'); }
     break;
 
   case 79:
-
-/* Line 1455 of yacc.c  */
-#line 1537 "compilers/imcc/imcc.y"
+#line 1553 "compilers/imcc/imcc.y"
     { (yyval.sr) = mk_const(interp, "STRING",   'S'); }
     break;
 
   case 80:
-
-/* Line 1455 of yacc.c  */
-#line 1539 "compilers/imcc/imcc.y"
+#line 1555 "compilers/imcc/imcc.y"
     {
            SymReg *r;
            if (strcmp((yyvsp[(1) - (1)].s), "_") != 0)
@@ -3902,9 +3770,7 @@
     break;
 
   case 81:
-
-/* Line 1455 of yacc.c  */
-#line 1550 "compilers/imcc/imcc.y"
+#line 1566 "compilers/imcc/imcc.y"
     {
            SymReg *r;
            if (strcmp((yyvsp[(1) - (1)].s), "_") != 0)
@@ -3918,16 +3784,12 @@
     break;
 
   case 82:
-
-/* Line 1455 of yacc.c  */
-#line 1560 "compilers/imcc/imcc.y"
+#line 1576 "compilers/imcc/imcc.y"
     { (yyval.sr) = (yyvsp[(2) - (3)].sr); }
     break;
 
   case 85:
-
-/* Line 1455 of yacc.c  */
-#line 1570 "compilers/imcc/imcc.y"
+#line 1586 "compilers/imcc/imcc.y"
     {
            char name[128];
            SymReg *r, *r1;
@@ -3954,114 +3816,82 @@
     break;
 
   case 86:
-
-/* Line 1455 of yacc.c  */
-#line 1598 "compilers/imcc/imcc.y"
+#line 1614 "compilers/imcc/imcc.y"
     { (yyval.i) = 0; IMCC_INFO(interp)->cur_call = NULL; }
     break;
 
   case 87:
-
-/* Line 1455 of yacc.c  */
-#line 1602 "compilers/imcc/imcc.y"
+#line 1618 "compilers/imcc/imcc.y"
     { (yyval.i) = NULL; IMCC_INFO(interp)->cur_call->pcc_sub->label = 0; }
     break;
 
   case 88:
-
-/* Line 1455 of yacc.c  */
-#line 1603 "compilers/imcc/imcc.y"
+#line 1619 "compilers/imcc/imcc.y"
     { (yyval.i) = NULL; IMCC_INFO(interp)->cur_call->pcc_sub->label = 1; }
     break;
 
   case 89:
-
-/* Line 1455 of yacc.c  */
-#line 1607 "compilers/imcc/imcc.y"
+#line 1623 "compilers/imcc/imcc.y"
     { (yyval.i) = NULL; }
     break;
 
   case 90:
-
-/* Line 1455 of yacc.c  */
-#line 1608 "compilers/imcc/imcc.y"
+#line 1624 "compilers/imcc/imcc.y"
     { (yyval.i) = NULL;  IMCC_INFO(interp)->cur_call->pcc_sub->object = (yyvsp[(2) - (3)].sr); }
     break;
 
   case 91:
-
-/* Line 1455 of yacc.c  */
-#line 1612 "compilers/imcc/imcc.y"
+#line 1628 "compilers/imcc/imcc.y"
     { (yyval.t) = 0; }
     break;
 
   case 93:
-
-/* Line 1455 of yacc.c  */
-#line 1617 "compilers/imcc/imcc.y"
+#line 1633 "compilers/imcc/imcc.y"
     { (yyval.t) = (yyvsp[(1) - (1)].t); }
     break;
 
   case 94:
-
-/* Line 1455 of yacc.c  */
-#line 1618 "compilers/imcc/imcc.y"
+#line 1634 "compilers/imcc/imcc.y"
     { (yyval.t) = (yyvsp[(1) - (2)].t) | (yyvsp[(2) - (2)].t); }
     break;
 
   case 95:
-
-/* Line 1455 of yacc.c  */
-#line 1622 "compilers/imcc/imcc.y"
+#line 1638 "compilers/imcc/imcc.y"
     { (yyval.t) = P_LOAD; }
     break;
 
   case 96:
-
-/* Line 1455 of yacc.c  */
-#line 1623 "compilers/imcc/imcc.y"
+#line 1639 "compilers/imcc/imcc.y"
     { (yyval.t) = P_INIT; }
     break;
 
   case 97:
-
-/* Line 1455 of yacc.c  */
-#line 1624 "compilers/imcc/imcc.y"
+#line 1640 "compilers/imcc/imcc.y"
     { (yyval.t) = P_MAIN; }
     break;
 
   case 98:
-
-/* Line 1455 of yacc.c  */
-#line 1625 "compilers/imcc/imcc.y"
+#line 1641 "compilers/imcc/imcc.y"
     { (yyval.t) = P_IMMEDIATE; }
     break;
 
   case 99:
-
-/* Line 1455 of yacc.c  */
-#line 1626 "compilers/imcc/imcc.y"
+#line 1642 "compilers/imcc/imcc.y"
     { (yyval.t) = P_POSTCOMP; }
     break;
 
   case 100:
-
-/* Line 1455 of yacc.c  */
-#line 1627 "compilers/imcc/imcc.y"
+#line 1643 "compilers/imcc/imcc.y"
     { (yyval.t) = P_ANON; }
     break;
 
   case 101:
-
-/* Line 1455 of yacc.c  */
-#line 1628 "compilers/imcc/imcc.y"
+#line 1644 "compilers/imcc/imcc.y"
     { (yyval.t) = P_NEED_LEX; }
     break;
 
   case 109:
-
-/* Line 1455 of yacc.c  */
-#line 1640 "compilers/imcc/imcc.y"
+#line 1656 "compilers/imcc/imcc.y"
     {
            add_pcc_sub(IMCC_INFO(interp)->cur_call, (yyvsp[(2) - (5)].sr));
            add_pcc_cc(IMCC_INFO(interp)->cur_call, (yyvsp[(4) - (5)].sr));
@@ -4069,18 +3899,14 @@
     break;
 
   case 110:
-
-/* Line 1455 of yacc.c  */
-#line 1645 "compilers/imcc/imcc.y"
+#line 1661 "compilers/imcc/imcc.y"
     {
            add_pcc_sub(IMCC_INFO(interp)->cur_call, (yyvsp[(2) - (3)].sr));
          }
     break;
 
   case 111:
-
-/* Line 1455 of yacc.c  */
-#line 1649 "compilers/imcc/imcc.y"
+#line 1665 "compilers/imcc/imcc.y"
     {
            add_pcc_sub(IMCC_INFO(interp)->cur_call, (yyvsp[(2) - (3)].sr));
            IMCC_INFO(interp)->cur_call->pcc_sub->flags |= isNCI;
@@ -4088,27 +3914,21 @@
     break;
 
   case 112:
-
-/* Line 1455 of yacc.c  */
-#line 1654 "compilers/imcc/imcc.y"
+#line 1670 "compilers/imcc/imcc.y"
     {
            add_pcc_sub(IMCC_INFO(interp)->cur_call, (yyvsp[(2) - (3)].sr));
          }
     break;
 
   case 113:
-
-/* Line 1455 of yacc.c  */
-#line 1658 "compilers/imcc/imcc.y"
+#line 1674 "compilers/imcc/imcc.y"
     {
            add_pcc_sub(IMCC_INFO(interp)->cur_call, mk_const(interp, (yyvsp[(2) - (3)].s), 'S'));
          }
     break;
 
   case 114:
-
-/* Line 1455 of yacc.c  */
-#line 1662 "compilers/imcc/imcc.y"
+#line 1678 "compilers/imcc/imcc.y"
     {
            add_pcc_sub(IMCC_INFO(interp)->cur_call, (yyvsp[(2) - (5)].sr));
            add_pcc_cc(IMCC_INFO(interp)->cur_call, (yyvsp[(4) - (5)].sr));
@@ -4116,9 +3936,7 @@
     break;
 
   case 115:
-
-/* Line 1455 of yacc.c  */
-#line 1667 "compilers/imcc/imcc.y"
+#line 1683 "compilers/imcc/imcc.y"
     {
            add_pcc_sub(IMCC_INFO(interp)->cur_call, mk_const(interp, (yyvsp[(2) - (5)].s), 'S'));
            add_pcc_cc(IMCC_INFO(interp)->cur_call, (yyvsp[(4) - (5)].sr));
@@ -4126,61 +3944,45 @@
     break;
 
   case 116:
-
-/* Line 1455 of yacc.c  */
-#line 1675 "compilers/imcc/imcc.y"
+#line 1691 "compilers/imcc/imcc.y"
     { (yyval.sr) = 0; }
     break;
 
   case 117:
-
-/* Line 1455 of yacc.c  */
-#line 1676 "compilers/imcc/imcc.y"
-    { add_pcc_arg(IMCC_INFO(interp)->cur_call, (yyvsp[(2) - (3)].sr)); }
+#line 1692 "compilers/imcc/imcc.y"
+    { add_pcc_arg(interp, IMCC_INFO(interp)->cur_call, (yyvsp[(2) - (3)].sr)); }
     break;
 
   case 118:
-
-/* Line 1455 of yacc.c  */
-#line 1680 "compilers/imcc/imcc.y"
+#line 1696 "compilers/imcc/imcc.y"
     { (yyval.sr) = (yyvsp[(2) - (2)].sr); }
     break;
 
   case 119:
-
-/* Line 1455 of yacc.c  */
-#line 1685 "compilers/imcc/imcc.y"
+#line 1701 "compilers/imcc/imcc.y"
     { (yyval.sr) = 0; }
     break;
 
   case 120:
-
-/* Line 1455 of yacc.c  */
-#line 1687 "compilers/imcc/imcc.y"
+#line 1703 "compilers/imcc/imcc.y"
     {
            if ((yyvsp[(2) - (3)].sr))
-               add_pcc_result(IMCC_INFO(interp)->cur_call, (yyvsp[(2) - (3)].sr));
+               add_pcc_result(interp, IMCC_INFO(interp)->cur_call, (yyvsp[(2) - (3)].sr));
          }
     break;
 
   case 121:
-
-/* Line 1455 of yacc.c  */
-#line 1694 "compilers/imcc/imcc.y"
+#line 1710 "compilers/imcc/imcc.y"
     { (yyval.sr) = (yyvsp[(2) - (3)].sr); (yyval.sr)->type |= (yyvsp[(3) - (3)].t); }
     break;
 
   case 122:
-
-/* Line 1455 of yacc.c  */
-#line 1695 "compilers/imcc/imcc.y"
+#line 1711 "compilers/imcc/imcc.y"
     { IMCC_INFO(interp)->is_def = 1; }
     break;
 
   case 123:
-
-/* Line 1455 of yacc.c  */
-#line 1696 "compilers/imcc/imcc.y"
+#line 1712 "compilers/imcc/imcc.y"
     {
            IdList * const l = (yyvsp[(4) - (4)].idlist);
            SymReg *ignored;
@@ -4195,93 +3997,67 @@
     break;
 
   case 124:
-
-/* Line 1455 of yacc.c  */
-#line 1710 "compilers/imcc/imcc.y"
+#line 1726 "compilers/imcc/imcc.y"
     { (yyval.t) = 0; }
     break;
 
   case 125:
-
-/* Line 1455 of yacc.c  */
-#line 1711 "compilers/imcc/imcc.y"
+#line 1727 "compilers/imcc/imcc.y"
     { (yyval.t) = (yyvsp[(1) - (2)].t) | (yyvsp[(2) - (2)].t); }
     break;
 
   case 126:
-
-/* Line 1455 of yacc.c  */
-#line 1715 "compilers/imcc/imcc.y"
+#line 1731 "compilers/imcc/imcc.y"
     { (yyval.t) = VT_FLAT;   }
     break;
 
   case 127:
-
-/* Line 1455 of yacc.c  */
-#line 1716 "compilers/imcc/imcc.y"
+#line 1732 "compilers/imcc/imcc.y"
     { (yyval.t) = VT_OPTIONAL; }
     break;
 
   case 128:
-
-/* Line 1455 of yacc.c  */
-#line 1717 "compilers/imcc/imcc.y"
+#line 1733 "compilers/imcc/imcc.y"
     { (yyval.t) = VT_OPT_FLAG; }
     break;
 
   case 129:
-
-/* Line 1455 of yacc.c  */
-#line 1718 "compilers/imcc/imcc.y"
+#line 1734 "compilers/imcc/imcc.y"
     { (yyval.t) = VT_NAMED; }
     break;
 
   case 130:
-
-/* Line 1455 of yacc.c  */
-#line 1719 "compilers/imcc/imcc.y"
+#line 1735 "compilers/imcc/imcc.y"
     { adv_named_set(interp, (yyvsp[(3) - (4)].s));   (yyval.t) = 0; mem_sys_free((yyvsp[(3) - (4)].s)); }
     break;
 
   case 131:
-
-/* Line 1455 of yacc.c  */
-#line 1720 "compilers/imcc/imcc.y"
+#line 1736 "compilers/imcc/imcc.y"
     { adv_named_set_u(interp, (yyvsp[(3) - (4)].s)); (yyval.t) = 0; mem_sys_free((yyvsp[(3) - (4)].s)); }
     break;
 
   case 132:
-
-/* Line 1455 of yacc.c  */
-#line 1721 "compilers/imcc/imcc.y"
+#line 1737 "compilers/imcc/imcc.y"
     { (yyval.t) = VT_UNIQUE_REG; }
     break;
 
   case 133:
-
-/* Line 1455 of yacc.c  */
-#line 1722 "compilers/imcc/imcc.y"
+#line 1738 "compilers/imcc/imcc.y"
     { (yyval.t) = VT_CALL_SIG; }
     break;
 
   case 134:
-
-/* Line 1455 of yacc.c  */
-#line 1727 "compilers/imcc/imcc.y"
+#line 1743 "compilers/imcc/imcc.y"
     { begin_return_or_yield(interp, 0); }
     break;
 
   case 135:
-
-/* Line 1455 of yacc.c  */
-#line 1729 "compilers/imcc/imcc.y"
+#line 1745 "compilers/imcc/imcc.y"
     { (yyval.i) = 0; IMCC_INFO(interp)->asm_state = AsmDefault; }
     break;
 
   case 136:
-
-/* Line 1455 of yacc.c  */
-#line 1731 "compilers/imcc/imcc.y"
+#line 1747 "compilers/imcc/imcc.y"
     {
            IMCC_INFO(interp)->asm_state = AsmDefault;
            (yyval.i) = 0;
@@ -4289,91 +4065,69 @@
     break;
 
   case 137:
-
-/* Line 1455 of yacc.c  */
-#line 1738 "compilers/imcc/imcc.y"
+#line 1754 "compilers/imcc/imcc.y"
     { begin_return_or_yield(interp, 1); }
     break;
 
   case 138:
-
-/* Line 1455 of yacc.c  */
-#line 1740 "compilers/imcc/imcc.y"
+#line 1756 "compilers/imcc/imcc.y"
     { (yyval.i) = 0; IMCC_INFO(interp)->asm_state = AsmDefault; }
     break;
 
   case 139:
-
-/* Line 1455 of yacc.c  */
-#line 1744 "compilers/imcc/imcc.y"
+#line 1760 "compilers/imcc/imcc.y"
     { (yyval.sr) = 0; }
     break;
 
   case 140:
-
-/* Line 1455 of yacc.c  */
-#line 1746 "compilers/imcc/imcc.y"
+#line 1762 "compilers/imcc/imcc.y"
     {
            if ((yyvsp[(1) - (2)].sr))
-               add_pcc_result(IMCC_INFO(interp)->sr_return, (yyvsp[(1) - (2)].sr));
+               add_pcc_result(interp, IMCC_INFO(interp)->sr_return, (yyvsp[(1) - (2)].sr));
          }
     break;
 
   case 141:
-
-/* Line 1455 of yacc.c  */
-#line 1751 "compilers/imcc/imcc.y"
+#line 1767 "compilers/imcc/imcc.y"
     {
            if ((yyvsp[(2) - (3)].sr))
-               add_pcc_result(IMCC_INFO(interp)->sr_return, (yyvsp[(2) - (3)].sr));
+               add_pcc_result(interp, IMCC_INFO(interp)->sr_return, (yyvsp[(2) - (3)].sr));
          }
     break;
 
   case 142:
-
-/* Line 1455 of yacc.c  */
-#line 1758 "compilers/imcc/imcc.y"
+#line 1774 "compilers/imcc/imcc.y"
     { (yyval.sr) = 0; }
     break;
 
   case 143:
-
-/* Line 1455 of yacc.c  */
-#line 1760 "compilers/imcc/imcc.y"
+#line 1776 "compilers/imcc/imcc.y"
     {
            if ((yyvsp[(1) - (2)].sr))
-               add_pcc_result(IMCC_INFO(interp)->sr_return, (yyvsp[(1) - (2)].sr));
+               add_pcc_result(interp, IMCC_INFO(interp)->sr_return, (yyvsp[(1) - (2)].sr));
          }
     break;
 
   case 144:
-
-/* Line 1455 of yacc.c  */
-#line 1765 "compilers/imcc/imcc.y"
+#line 1781 "compilers/imcc/imcc.y"
     {
            if ((yyvsp[(2) - (3)].sr))
-               add_pcc_result(IMCC_INFO(interp)->sr_return, (yyvsp[(2) - (3)].sr));
+               add_pcc_result(interp, IMCC_INFO(interp)->sr_return, (yyvsp[(2) - (3)].sr));
          }
     break;
 
   case 145:
-
-/* Line 1455 of yacc.c  */
-#line 1772 "compilers/imcc/imcc.y"
+#line 1788 "compilers/imcc/imcc.y"
     { (yyval.sr) = (yyvsp[(2) - (3)].sr); (yyval.sr)->type |= (yyvsp[(3) - (3)].t); }
     break;
 
   case 146:
-
-/* Line 1455 of yacc.c  */
-#line 1776 "compilers/imcc/imcc.y"
+#line 1792 "compilers/imcc/imcc.y"
     { (yyval.sr) = (yyvsp[(2) - (3)].sr); (yyval.sr)->type |= (yyvsp[(3) - (3)].t); }
     break;
 
   case 147:
-
-/* Line 1455 of yacc.c  */
-#line 1781 "compilers/imcc/imcc.y"
+#line 1797 "compilers/imcc/imcc.y"
     {
           if (IMCC_INFO(interp)->asm_state == AsmDefault)
               begin_return_or_yield(interp, (yyvsp[(1) - (2)].t));
@@ -4381,9 +4135,7 @@
     break;
 
   case 148:
-
-/* Line 1455 of yacc.c  */
-#line 1786 "compilers/imcc/imcc.y"
+#line 1802 "compilers/imcc/imcc.y"
     {
           IMCC_INFO(interp)->asm_state = AsmDefault;
           (yyval.t) = 0;
@@ -4391,136 +4143,104 @@
     break;
 
   case 149:
-
-/* Line 1455 of yacc.c  */
-#line 1793 "compilers/imcc/imcc.y"
+#line 1809 "compilers/imcc/imcc.y"
     { (yyval.t) = 0; }
     break;
 
   case 150:
-
-/* Line 1455 of yacc.c  */
-#line 1794 "compilers/imcc/imcc.y"
+#line 1810 "compilers/imcc/imcc.y"
     { (yyval.t) = 1; }
     break;
 
   case 151:
-
-/* Line 1455 of yacc.c  */
-#line 1798 "compilers/imcc/imcc.y"
+#line 1814 "compilers/imcc/imcc.y"
     { (yyval.i) = 0; }
     break;
 
   case 152:
-
-/* Line 1455 of yacc.c  */
-#line 1800 "compilers/imcc/imcc.y"
+#line 1816 "compilers/imcc/imcc.y"
     {
            if (IMCC_INFO(interp)->adv_named_id) {
-               add_pcc_named_return(IMCC_INFO(interp)->sr_return,
+               add_pcc_named_return(interp, IMCC_INFO(interp)->sr_return,
                                     IMCC_INFO(interp)->adv_named_id, (yyvsp[(1) - (1)].sr));
                IMCC_INFO(interp)->adv_named_id = NULL;
            }
            else
-               add_pcc_result(IMCC_INFO(interp)->sr_return, (yyvsp[(1) - (1)].sr));
+               add_pcc_result(interp, IMCC_INFO(interp)->sr_return, (yyvsp[(1) - (1)].sr));
          }
     break;
 
   case 153:
-
-/* Line 1455 of yacc.c  */
-#line 1810 "compilers/imcc/imcc.y"
+#line 1826 "compilers/imcc/imcc.y"
     {
             SymReg * const name = mk_const(interp, (yyvsp[(1) - (3)].s), 'S');
-            add_pcc_named_return(IMCC_INFO(interp)->sr_return, name, (yyvsp[(3) - (3)].sr));
+            add_pcc_named_return(interp, IMCC_INFO(interp)->sr_return, name, (yyvsp[(3) - (3)].sr));
          }
     break;
 
   case 154:
-
-/* Line 1455 of yacc.c  */
-#line 1815 "compilers/imcc/imcc.y"
+#line 1831 "compilers/imcc/imcc.y"
     {
            if (IMCC_INFO(interp)->adv_named_id) {
-               add_pcc_named_return(IMCC_INFO(interp)->sr_return,
+               add_pcc_named_return(interp, IMCC_INFO(interp)->sr_return,
                                     IMCC_INFO(interp)->adv_named_id, (yyvsp[(3) - (3)].sr));
                IMCC_INFO(interp)->adv_named_id = NULL;
              }
              else
-                 add_pcc_result(IMCC_INFO(interp)->sr_return, (yyvsp[(3) - (3)].sr));
+                 add_pcc_result(interp, IMCC_INFO(interp)->sr_return, (yyvsp[(3) - (3)].sr));
          }
     break;
 
   case 155:
-
-/* Line 1455 of yacc.c  */
-#line 1825 "compilers/imcc/imcc.y"
+#line 1841 "compilers/imcc/imcc.y"
     {
            SymReg * const name = mk_const(interp, (yyvsp[(3) - (5)].s), 'S');
-           add_pcc_named_return(IMCC_INFO(interp)->sr_return, name, (yyvsp[(5) - (5)].sr));
+           add_pcc_named_return(interp, IMCC_INFO(interp)->sr_return, name, (yyvsp[(5) - (5)].sr));
          }
     break;
 
   case 158:
-
-/* Line 1455 of yacc.c  */
-#line 1846 "compilers/imcc/imcc.y"
+#line 1862 "compilers/imcc/imcc.y"
     { clear_state(interp); }
     break;
 
   case 159:
-
-/* Line 1455 of yacc.c  */
-#line 1851 "compilers/imcc/imcc.y"
+#line 1867 "compilers/imcc/imcc.y"
     { (yyval.i) = (yyvsp[(2) - (2)].i); }
     break;
 
   case 160:
-
-/* Line 1455 of yacc.c  */
-#line 1852 "compilers/imcc/imcc.y"
+#line 1868 "compilers/imcc/imcc.y"
     { (yyval.i) = 0; }
     break;
 
   case 161:
-
-/* Line 1455 of yacc.c  */
-#line 1853 "compilers/imcc/imcc.y"
+#line 1869 "compilers/imcc/imcc.y"
     { (yyval.i) = 0; }
     break;
 
   case 162:
-
-/* Line 1455 of yacc.c  */
-#line 1854 "compilers/imcc/imcc.y"
+#line 1870 "compilers/imcc/imcc.y"
     { (yyval.i) = 0; }
     break;
 
   case 163:
-
-/* Line 1455 of yacc.c  */
-#line 1855 "compilers/imcc/imcc.y"
+#line 1871 "compilers/imcc/imcc.y"
     { (yyval.i) = 0; }
     break;
 
   case 164:
-
-/* Line 1455 of yacc.c  */
-#line 1856 "compilers/imcc/imcc.y"
+#line 1872 "compilers/imcc/imcc.y"
     { (yyval.i) = (yyvsp[(1) - (1)].i); }
     break;
 
   case 165:
-
-/* Line 1455 of yacc.c  */
-#line 1860 "compilers/imcc/imcc.y"
+#line 1876 "compilers/imcc/imcc.y"
     { (yyval.i) = NULL; }
     break;
 
   case 169:
-
-/* Line 1455 of yacc.c  */
-#line 1871 "compilers/imcc/imcc.y"
+#line 1887 "compilers/imcc/imcc.y"
     {
              Instruction * const i = iLABEL(interp, IMCC_INFO(interp)->cur_unit, mk_local_label(interp, (yyvsp[(1) - (1)].s)));
              mem_sys_free((yyvsp[(1) - (1)].s));
@@ -4529,16 +4249,12 @@
     break;
 
   case 170:
-
-/* Line 1455 of yacc.c  */
-#line 1881 "compilers/imcc/imcc.y"
+#line 1897 "compilers/imcc/imcc.y"
     { (yyval.i) = (yyvsp[(2) - (3)].i); }
     break;
 
   case 171:
-
-/* Line 1455 of yacc.c  */
-#line 1883 "compilers/imcc/imcc.y"
+#line 1899 "compilers/imcc/imcc.y"
     {
            if (yynerrs >= PARROT_MAX_RECOVER_ERRORS) {
                IMCC_warning(interp, "Too many errors. Correct some first.\n");
@@ -4549,9 +4265,7 @@
     break;
 
   case 172:
-
-/* Line 1455 of yacc.c  */
-#line 1894 "compilers/imcc/imcc.y"
+#line 1910 "compilers/imcc/imcc.y"
     {
            IdList* const l = (yyvsp[(1) - (1)].idlist);
            l->next = NULL;
@@ -4560,9 +4274,7 @@
     break;
 
   case 173:
-
-/* Line 1455 of yacc.c  */
-#line 1901 "compilers/imcc/imcc.y"
+#line 1917 "compilers/imcc/imcc.y"
     {
            IdList* const l = (yyvsp[(3) - (3)].idlist);
            l->next = (yyvsp[(1) - (3)].idlist);
@@ -4571,11 +4283,9 @@
     break;
 
   case 174:
-
-/* Line 1455 of yacc.c  */
-#line 1910 "compilers/imcc/imcc.y"
+#line 1926 "compilers/imcc/imcc.y"
     {
-           IdList* const l = mem_allocate_n_zeroed_typed(1, IdList);
+           IdList* const l = mem_gc_allocate_n_zeroed_typed(interp, 1, IdList);
            l->id           = (yyvsp[(1) - (2)].s);
            l->unique_reg   = (yyvsp[(2) - (2)].t);
            (yyval.idlist) = l;
@@ -4583,30 +4293,22 @@
     break;
 
   case 175:
-
-/* Line 1455 of yacc.c  */
-#line 1919 "compilers/imcc/imcc.y"
+#line 1935 "compilers/imcc/imcc.y"
     { (yyval.t) = 0; }
     break;
 
   case 176:
-
-/* Line 1455 of yacc.c  */
-#line 1920 "compilers/imcc/imcc.y"
+#line 1936 "compilers/imcc/imcc.y"
     { (yyval.t) = 1; }
     break;
 
   case 179:
-
-/* Line 1455 of yacc.c  */
-#line 1927 "compilers/imcc/imcc.y"
+#line 1943 "compilers/imcc/imcc.y"
     { IMCC_INFO(interp)->is_def = 1; }
     break;
 
   case 180:
-
-/* Line 1455 of yacc.c  */
-#line 1928 "compilers/imcc/imcc.y"
+#line 1944 "compilers/imcc/imcc.y"
     {
            IdList *l = (yyvsp[(4) - (4)].idlist);
            while (l) {
@@ -4625,9 +4327,7 @@
     break;
 
   case 181:
-
-/* Line 1455 of yacc.c  */
-#line 1944 "compilers/imcc/imcc.y"
+#line 1960 "compilers/imcc/imcc.y"
     {
             if ((yyvsp[(4) - (4)].sr)->set != 'P') {
                 mem_sys_free((yyvsp[(2) - (4)].s));
@@ -4647,9 +4347,7 @@
     break;
 
   case 182:
-
-/* Line 1455 of yacc.c  */
-#line 1961 "compilers/imcc/imcc.y"
+#line 1977 "compilers/imcc/imcc.y"
     {
             if ((yyvsp[(4) - (4)].sr)->set != 'P') {
                 mem_sys_free((yyvsp[(2) - (4)].s));
@@ -4665,16 +4363,12 @@
     break;
 
   case 183:
-
-/* Line 1455 of yacc.c  */
-#line 1973 "compilers/imcc/imcc.y"
+#line 1989 "compilers/imcc/imcc.y"
     { IMCC_INFO(interp)->is_def = 1; }
     break;
 
   case 184:
-
-/* Line 1455 of yacc.c  */
-#line 1974 "compilers/imcc/imcc.y"
+#line 1990 "compilers/imcc/imcc.y"
     {
            mk_const_ident(interp, (yyvsp[(4) - (6)].s), (yyvsp[(3) - (6)].t), (yyvsp[(6) - (6)].sr), 0);
            IMCC_INFO(interp)->is_def = 0;
@@ -4683,16 +4377,12 @@
     break;
 
   case 186:
-
-/* Line 1455 of yacc.c  */
-#line 1981 "compilers/imcc/imcc.y"
+#line 1997 "compilers/imcc/imcc.y"
     { IMCC_INFO(interp)->is_def = 1; }
     break;
 
   case 187:
-
-/* Line 1455 of yacc.c  */
-#line 1982 "compilers/imcc/imcc.y"
+#line 1998 "compilers/imcc/imcc.y"
     {
            mk_const_ident(interp, (yyvsp[(4) - (6)].s), (yyvsp[(3) - (6)].t), (yyvsp[(6) - (6)].sr), 1);
            IMCC_INFO(interp)->is_def = 0;
@@ -4701,9 +4391,7 @@
     break;
 
   case 188:
-
-/* Line 1455 of yacc.c  */
-#line 1988 "compilers/imcc/imcc.y"
+#line 2004 "compilers/imcc/imcc.y"
     {
            (yyval.i) = NULL;
            IMCC_INFO(interp)->cur_call->pcc_sub->flags |= isTAIL_CALL;
@@ -4712,18 +4400,14 @@
     break;
 
   case 189:
-
-/* Line 1455 of yacc.c  */
-#line 1994 "compilers/imcc/imcc.y"
+#line 2010 "compilers/imcc/imcc.y"
     {
             (yyval.i) = MK_I(interp, IMCC_INFO(interp)->cur_unit, "branch", 1, (yyvsp[(2) - (2)].sr));
          }
     break;
 
   case 190:
-
-/* Line 1455 of yacc.c  */
-#line 1998 "compilers/imcc/imcc.y"
+#line 2014 "compilers/imcc/imcc.y"
     {
            (yyval.i) = INS(interp,
                     IMCC_INFO(interp)->cur_unit,
@@ -4738,65 +4422,47 @@
     break;
 
   case 191:
-
-/* Line 1455 of yacc.c  */
-#line 2009 "compilers/imcc/imcc.y"
+#line 2025 "compilers/imcc/imcc.y"
     { (yyval.i) = MK_I(interp, IMCC_INFO(interp)->cur_unit, "null", 1, (yyvsp[(2) - (2)].sr)); }
     break;
 
   case 192:
-
-/* Line 1455 of yacc.c  */
-#line 2010 "compilers/imcc/imcc.y"
+#line 2026 "compilers/imcc/imcc.y"
     { (yyval.i) = 0; IMCC_INFO(interp)->cur_call = NULL; }
     break;
 
   case 193:
-
-/* Line 1455 of yacc.c  */
-#line 2011 "compilers/imcc/imcc.y"
+#line 2027 "compilers/imcc/imcc.y"
     { (yyval.i) = 0; }
     break;
 
   case 196:
-
-/* Line 1455 of yacc.c  */
-#line 2014 "compilers/imcc/imcc.y"
+#line 2030 "compilers/imcc/imcc.y"
     { (yyval.i) = 0;}
     break;
 
   case 197:
-
-/* Line 1455 of yacc.c  */
-#line 2018 "compilers/imcc/imcc.y"
+#line 2034 "compilers/imcc/imcc.y"
     { (yyval.t) = 'I'; }
     break;
 
   case 198:
-
-/* Line 1455 of yacc.c  */
-#line 2019 "compilers/imcc/imcc.y"
+#line 2035 "compilers/imcc/imcc.y"
     { (yyval.t) = 'N'; }
     break;
 
   case 199:
-
-/* Line 1455 of yacc.c  */
-#line 2020 "compilers/imcc/imcc.y"
+#line 2036 "compilers/imcc/imcc.y"
     { (yyval.t) = 'S'; }
     break;
 
   case 200:
-
-/* Line 1455 of yacc.c  */
-#line 2021 "compilers/imcc/imcc.y"
+#line 2037 "compilers/imcc/imcc.y"
     { (yyval.t) = 'P'; }
     break;
 
   case 201:
-
-/* Line 1455 of yacc.c  */
-#line 2026 "compilers/imcc/imcc.y"
+#line 2042 "compilers/imcc/imcc.y"
     {
            /* there'd normally be a mem_sys_strdup() here, but the lexer already
             * copied the string, so it's safe to use directly */
@@ -4809,71 +4475,53 @@
     break;
 
   case 202:
-
-/* Line 1455 of yacc.c  */
-#line 2039 "compilers/imcc/imcc.y"
+#line 2055 "compilers/imcc/imcc.y"
     { (yyval.i) = MK_I(interp, IMCC_INFO(interp)->cur_unit, "set", 2, (yyvsp[(1) - (3)].sr), (yyvsp[(3) - (3)].sr));  }
     break;
 
   case 203:
-
-/* Line 1455 of yacc.c  */
-#line 2041 "compilers/imcc/imcc.y"
+#line 2057 "compilers/imcc/imcc.y"
     { (yyval.i) = MK_I(interp, IMCC_INFO(interp)->cur_unit, (yyvsp[(3) - (4)].s), 2, (yyvsp[(1) - (4)].sr), (yyvsp[(4) - (4)].sr));  }
     break;
 
   case 204:
-
-/* Line 1455 of yacc.c  */
-#line 2043 "compilers/imcc/imcc.y"
+#line 2059 "compilers/imcc/imcc.y"
     { (yyval.i) = MK_I(interp, IMCC_INFO(interp)->cur_unit, (yyvsp[(4) - (5)].s), 3, (yyvsp[(1) - (5)].sr), (yyvsp[(3) - (5)].sr), (yyvsp[(5) - (5)].sr)); }
     break;
 
   case 205:
-
-/* Line 1455 of yacc.c  */
-#line 2045 "compilers/imcc/imcc.y"
+#line 2061 "compilers/imcc/imcc.y"
     { (yyval.i) = iINDEXFETCH(interp, IMCC_INFO(interp)->cur_unit, (yyvsp[(1) - (6)].sr), (yyvsp[(3) - (6)].sr), (yyvsp[(5) - (6)].sr)); }
     break;
 
   case 206:
-
-/* Line 1455 of yacc.c  */
-#line 2047 "compilers/imcc/imcc.y"
+#line 2063 "compilers/imcc/imcc.y"
     { (yyval.i) = iINDEXSET(interp, IMCC_INFO(interp)->cur_unit, (yyvsp[(1) - (6)].sr), (yyvsp[(3) - (6)].sr), (yyvsp[(6) - (6)].sr)); }
     break;
 
   case 207:
-
-/* Line 1455 of yacc.c  */
-#line 2052 "compilers/imcc/imcc.y"
+#line 2068 "compilers/imcc/imcc.y"
     { (yyval.i) = iNEW(interp, IMCC_INFO(interp)->cur_unit, (yyvsp[(1) - (7)].sr), (yyvsp[(4) - (7)].s), (yyvsp[(6) - (7)].sr), 1); }
     break;
 
   case 208:
-
-/* Line 1455 of yacc.c  */
-#line 2055 "compilers/imcc/imcc.y"
+#line 2071 "compilers/imcc/imcc.y"
     {
-           add_pcc_result((yyvsp[(3) - (3)].i)->symregs[0], (yyvsp[(1) - (3)].sr));
+           add_pcc_result(interp, (yyvsp[(3) - (3)].i)->symregs[0], (yyvsp[(1) - (3)].sr));
            IMCC_INFO(interp)->cur_call = NULL;
            (yyval.i) = 0;
          }
     break;
 
   case 209:
-
-/* Line 1455 of yacc.c  */
-#line 2061 "compilers/imcc/imcc.y"
+#line 2077 "compilers/imcc/imcc.y"
     {
            (yyval.i) = IMCC_create_itcall_label(interp);
          }
     break;
 
   case 210:
-
-/* Line 1455 of yacc.c  */
-#line 2065 "compilers/imcc/imcc.y"
+#line 2081 "compilers/imcc/imcc.y"
     {
            IMCC_itcall_sub(interp, (yyvsp[(6) - (9)].sr));
            IMCC_INFO(interp)->cur_call = NULL;
@@ -4881,200 +4529,144 @@
     break;
 
   case 214:
-
-/* Line 1455 of yacc.c  */
-#line 2073 "compilers/imcc/imcc.y"
+#line 2089 "compilers/imcc/imcc.y"
     {
            (yyval.i) = MK_I(interp, IMCC_INFO(interp)->cur_unit, "null", 1, (yyvsp[(1) - (3)].sr));
          }
     break;
 
   case 215:
-
-/* Line 1455 of yacc.c  */
-#line 2080 "compilers/imcc/imcc.y"
+#line 2096 "compilers/imcc/imcc.y"
     { (yyval.s) = (char *)"not"; }
     break;
 
   case 216:
-
-/* Line 1455 of yacc.c  */
-#line 2081 "compilers/imcc/imcc.y"
+#line 2097 "compilers/imcc/imcc.y"
     { (yyval.s) = (char *)"bnot"; }
     break;
 
   case 217:
-
-/* Line 1455 of yacc.c  */
-#line 2082 "compilers/imcc/imcc.y"
+#line 2098 "compilers/imcc/imcc.y"
     { (yyval.s) = (char *)"neg"; }
     break;
 
   case 218:
-
-/* Line 1455 of yacc.c  */
-#line 2086 "compilers/imcc/imcc.y"
+#line 2102 "compilers/imcc/imcc.y"
     { (yyval.s) = (char *)"sub"; }
     break;
 
   case 219:
-
-/* Line 1455 of yacc.c  */
-#line 2087 "compilers/imcc/imcc.y"
+#line 2103 "compilers/imcc/imcc.y"
     { (yyval.s) = (char *)"add"; }
     break;
 
   case 220:
-
-/* Line 1455 of yacc.c  */
-#line 2088 "compilers/imcc/imcc.y"
+#line 2104 "compilers/imcc/imcc.y"
     { (yyval.s) = (char *)"mul"; }
     break;
 
   case 221:
-
-/* Line 1455 of yacc.c  */
-#line 2089 "compilers/imcc/imcc.y"
+#line 2105 "compilers/imcc/imcc.y"
     { (yyval.s) = (char *)"div"; }
     break;
 
   case 222:
-
-/* Line 1455 of yacc.c  */
-#line 2090 "compilers/imcc/imcc.y"
+#line 2106 "compilers/imcc/imcc.y"
     { (yyval.s) = (char *)"mod"; }
     break;
 
   case 223:
-
-/* Line 1455 of yacc.c  */
-#line 2091 "compilers/imcc/imcc.y"
+#line 2107 "compilers/imcc/imcc.y"
     { (yyval.s) = (char *)"fdiv"; }
     break;
 
   case 224:
-
-/* Line 1455 of yacc.c  */
-#line 2092 "compilers/imcc/imcc.y"
+#line 2108 "compilers/imcc/imcc.y"
     { (yyval.s) = (char *)"pow"; }
     break;
 
   case 225:
-
-/* Line 1455 of yacc.c  */
-#line 2093 "compilers/imcc/imcc.y"
+#line 2109 "compilers/imcc/imcc.y"
     { (yyval.s) = (char *)"concat"; }
     break;
 
   case 226:
-
-/* Line 1455 of yacc.c  */
-#line 2094 "compilers/imcc/imcc.y"
+#line 2110 "compilers/imcc/imcc.y"
     { (yyval.s) = (char *)"iseq"; }
     break;
 
   case 227:
-
-/* Line 1455 of yacc.c  */
-#line 2095 "compilers/imcc/imcc.y"
+#line 2111 "compilers/imcc/imcc.y"
     { (yyval.s) = (char *)"isne"; }
     break;
 
   case 228:
-
-/* Line 1455 of yacc.c  */
-#line 2096 "compilers/imcc/imcc.y"
+#line 2112 "compilers/imcc/imcc.y"
     { (yyval.s) = (char *)"isgt"; }
     break;
 
   case 229:
-
-/* Line 1455 of yacc.c  */
-#line 2097 "compilers/imcc/imcc.y"
+#line 2113 "compilers/imcc/imcc.y"
     { (yyval.s) = (char *)"isge"; }
     break;
 
   case 230:
-
-/* Line 1455 of yacc.c  */
-#line 2098 "compilers/imcc/imcc.y"
+#line 2114 "compilers/imcc/imcc.y"
     { (yyval.s) = (char *)"islt"; }
     break;
 
   case 231:
-
-/* Line 1455 of yacc.c  */
-#line 2099 "compilers/imcc/imcc.y"
+#line 2115 "compilers/imcc/imcc.y"
     { (yyval.s) = (char *)"isle"; }
     break;
 
   case 232:
-
-/* Line 1455 of yacc.c  */
-#line 2100 "compilers/imcc/imcc.y"
+#line 2116 "compilers/imcc/imcc.y"
     { (yyval.s) = (char *)"shl"; }
     break;
 
   case 233:
-
-/* Line 1455 of yacc.c  */
-#line 2101 "compilers/imcc/imcc.y"
+#line 2117 "compilers/imcc/imcc.y"
     { (yyval.s) = (char *)"shr"; }
     break;
 
   case 234:
-
-/* Line 1455 of yacc.c  */
-#line 2102 "compilers/imcc/imcc.y"
+#line 2118 "compilers/imcc/imcc.y"
     { (yyval.s) = (char *)"lsr"; }
     break;
 
   case 235:
-
-/* Line 1455 of yacc.c  */
-#line 2103 "compilers/imcc/imcc.y"
+#line 2119 "compilers/imcc/imcc.y"
     { (yyval.s) = (char *)"and"; }
     break;
 
   case 236:
-
-/* Line 1455 of yacc.c  */
-#line 2104 "compilers/imcc/imcc.y"
+#line 2120 "compilers/imcc/imcc.y"
     { (yyval.s) = (char *)"or"; }
     break;
 
   case 237:
-
-/* Line 1455 of yacc.c  */
-#line 2105 "compilers/imcc/imcc.y"
+#line 2121 "compilers/imcc/imcc.y"
     { (yyval.s) = (char *)"xor"; }
     break;
 
   case 238:
-
-/* Line 1455 of yacc.c  */
-#line 2106 "compilers/imcc/imcc.y"
+#line 2122 "compilers/imcc/imcc.y"
     { (yyval.s) = (char *)"band"; }
     break;
 
   case 239:
-
-/* Line 1455 of yacc.c  */
-#line 2107 "compilers/imcc/imcc.y"
+#line 2123 "compilers/imcc/imcc.y"
     { (yyval.s) = (char *)"bor"; }
     break;
 
   case 240:
-
-/* Line 1455 of yacc.c  */
-#line 2108 "compilers/imcc/imcc.y"
+#line 2124 "compilers/imcc/imcc.y"
     { (yyval.s) = (char *)"bxor"; }
     break;
 
   case 241:
-
-/* Line 1455 of yacc.c  */
-#line 2114 "compilers/imcc/imcc.y"
+#line 2130 "compilers/imcc/imcc.y"
     {
            (yyval.i) = IMCC_create_itcall_label(interp);
            (yyval.i)->type &= ~ITCALL;
@@ -5083,114 +4675,82 @@
     break;
 
   case 242:
-
-/* Line 1455 of yacc.c  */
-#line 2119 "compilers/imcc/imcc.y"
+#line 2135 "compilers/imcc/imcc.y"
     {  (yyval.i) = 0; }
     break;
 
   case 243:
-
-/* Line 1455 of yacc.c  */
-#line 2126 "compilers/imcc/imcc.y"
+#line 2142 "compilers/imcc/imcc.y"
     { (yyval.i) = MK_I(interp, IMCC_INFO(interp)->cur_unit, (yyvsp[(2) - (3)].s), 2, (yyvsp[(1) - (3)].sr), (yyvsp[(3) - (3)].sr)); }
     break;
 
   case 244:
-
-/* Line 1455 of yacc.c  */
-#line 2130 "compilers/imcc/imcc.y"
+#line 2146 "compilers/imcc/imcc.y"
     { (yyval.s) = (char *)"add"; }
     break;
 
   case 245:
-
-/* Line 1455 of yacc.c  */
-#line 2131 "compilers/imcc/imcc.y"
+#line 2147 "compilers/imcc/imcc.y"
     { (yyval.s) = (char *)"sub"; }
     break;
 
   case 246:
-
-/* Line 1455 of yacc.c  */
-#line 2132 "compilers/imcc/imcc.y"
+#line 2148 "compilers/imcc/imcc.y"
     { (yyval.s) = (char *)"mul"; }
     break;
 
   case 247:
-
-/* Line 1455 of yacc.c  */
-#line 2133 "compilers/imcc/imcc.y"
+#line 2149 "compilers/imcc/imcc.y"
     { (yyval.s) = (char *)"div"; }
     break;
 
   case 248:
-
-/* Line 1455 of yacc.c  */
-#line 2134 "compilers/imcc/imcc.y"
+#line 2150 "compilers/imcc/imcc.y"
     { (yyval.s) = (char *)"mod"; }
     break;
 
   case 249:
-
-/* Line 1455 of yacc.c  */
-#line 2135 "compilers/imcc/imcc.y"
+#line 2151 "compilers/imcc/imcc.y"
     { (yyval.s) = (char *)"fdiv"; }
     break;
 
   case 250:
-
-/* Line 1455 of yacc.c  */
-#line 2136 "compilers/imcc/imcc.y"
+#line 2152 "compilers/imcc/imcc.y"
     { (yyval.s) = (char *)"concat"; }
     break;
 
   case 251:
-
-/* Line 1455 of yacc.c  */
-#line 2137 "compilers/imcc/imcc.y"
+#line 2153 "compilers/imcc/imcc.y"
     { (yyval.s) = (char *)"band"; }
     break;
 
   case 252:
-
-/* Line 1455 of yacc.c  */
-#line 2138 "compilers/imcc/imcc.y"
+#line 2154 "compilers/imcc/imcc.y"
     { (yyval.s) = (char *)"bor"; }
     break;
 
   case 253:
-
-/* Line 1455 of yacc.c  */
-#line 2139 "compilers/imcc/imcc.y"
+#line 2155 "compilers/imcc/imcc.y"
     { (yyval.s) = (char *)"bxor"; }
     break;
 
   case 254:
-
-/* Line 1455 of yacc.c  */
-#line 2140 "compilers/imcc/imcc.y"
+#line 2156 "compilers/imcc/imcc.y"
     { (yyval.s) = (char *)"shr"; }
     break;
 
   case 255:
-
-/* Line 1455 of yacc.c  */
-#line 2141 "compilers/imcc/imcc.y"
+#line 2157 "compilers/imcc/imcc.y"
     { (yyval.s) = (char *)"shl"; }
     break;
 
   case 256:
-
-/* Line 1455 of yacc.c  */
-#line 2142 "compilers/imcc/imcc.y"
+#line 2158 "compilers/imcc/imcc.y"
     { (yyval.s) = (char *)"lsr"; }
     break;
 
   case 257:
-
-/* Line 1455 of yacc.c  */
-#line 2148 "compilers/imcc/imcc.y"
+#line 2164 "compilers/imcc/imcc.y"
     {
         (yyval.i) = func_ins(interp, IMCC_INFO(interp)->cur_unit, (yyvsp[(1) - (4)].sr), (yyvsp[(3) - (4)].s),
                       IMCC_INFO(interp) -> regs,
@@ -5201,30 +4761,22 @@
     break;
 
   case 258:
-
-/* Line 1455 of yacc.c  */
-#line 2158 "compilers/imcc/imcc.y"
+#line 2174 "compilers/imcc/imcc.y"
     { (yyval.sr) = mk_sub_address(interp, (yyvsp[(1) - (1)].s));       mem_sys_free((yyvsp[(1) - (1)].s)); }
     break;
 
   case 259:
-
-/* Line 1455 of yacc.c  */
-#line 2159 "compilers/imcc/imcc.y"
+#line 2175 "compilers/imcc/imcc.y"
     { (yyval.sr) = mk_sub_address_fromc(interp, (yyvsp[(1) - (1)].s)); mem_sys_free((yyvsp[(1) - (1)].s)); }
     break;
 
   case 260:
-
-/* Line 1455 of yacc.c  */
-#line 2160 "compilers/imcc/imcc.y"
+#line 2176 "compilers/imcc/imcc.y"
     { (yyval.sr) = mk_sub_address_u(interp, (yyvsp[(1) - (1)].s));     mem_sys_free((yyvsp[(1) - (1)].s)); }
     break;
 
   case 261:
-
-/* Line 1455 of yacc.c  */
-#line 2162 "compilers/imcc/imcc.y"
+#line 2178 "compilers/imcc/imcc.y"
     {
            (yyval.sr) = (yyvsp[(1) - (1)].sr);
            if ((yyvsp[(1) - (1)].sr)->set != 'P')
@@ -5233,9 +4785,7 @@
     break;
 
   case 262:
-
-/* Line 1455 of yacc.c  */
-#line 2168 "compilers/imcc/imcc.y"
+#line 2184 "compilers/imcc/imcc.y"
     {
             /* disallow bareword method names; SREG name constants are fine */
             const char * const name = (yyvsp[(3) - (3)].sr)->name;
@@ -5252,9 +4802,7 @@
     break;
 
   case 263:
-
-/* Line 1455 of yacc.c  */
-#line 2182 "compilers/imcc/imcc.y"
+#line 2198 "compilers/imcc/imcc.y"
     {
             IMCC_INFO(interp)->cur_obj = (yyvsp[(1) - (3)].sr);
             (yyval.sr)                         = mk_const(interp, (yyvsp[(3) - (3)].s), 'U');
@@ -5263,9 +4811,7 @@
     break;
 
   case 264:
-
-/* Line 1455 of yacc.c  */
-#line 2188 "compilers/imcc/imcc.y"
+#line 2204 "compilers/imcc/imcc.y"
     {
             IMCC_INFO(interp)->cur_obj = (yyvsp[(1) - (3)].sr);
             (yyval.sr)                         = mk_const(interp, (yyvsp[(3) - (3)].s), 'S');
@@ -5274,16 +4820,12 @@
     break;
 
   case 265:
-
-/* Line 1455 of yacc.c  */
-#line 2193 "compilers/imcc/imcc.y"
+#line 2209 "compilers/imcc/imcc.y"
     { IMCC_INFO(interp)->cur_obj = (yyvsp[(1) - (3)].sr); (yyval.sr) = (yyvsp[(3) - (3)].sr); }
     break;
 
   case 266:
-
-/* Line 1455 of yacc.c  */
-#line 2199 "compilers/imcc/imcc.y"
+#line 2215 "compilers/imcc/imcc.y"
     {
            (yyval.i) = IMCC_create_itcall_label(interp);
            IMCC_itcall_sub(interp, (yyvsp[(1) - (1)].sr));
@@ -5291,360 +4833,276 @@
     break;
 
   case 267:
-
-/* Line 1455 of yacc.c  */
-#line 2203 "compilers/imcc/imcc.y"
+#line 2219 "compilers/imcc/imcc.y"
     { (yyval.i) = (yyvsp[(2) - (5)].i); }
     break;
 
   case 268:
-
-/* Line 1455 of yacc.c  */
-#line 2207 "compilers/imcc/imcc.y"
+#line 2223 "compilers/imcc/imcc.y"
     { (yyval.sr) = 0; }
     break;
 
   case 269:
-
-/* Line 1455 of yacc.c  */
-#line 2209 "compilers/imcc/imcc.y"
+#line 2225 "compilers/imcc/imcc.y"
     {
            (yyval.sr) = 0;
            if (IMCC_INFO(interp)->adv_named_id) {
-               add_pcc_named_arg(IMCC_INFO(interp)->cur_call, IMCC_INFO(interp)->adv_named_id, (yyvsp[(3) - (3)].sr));
+               add_pcc_named_arg(interp, IMCC_INFO(interp)->cur_call, IMCC_INFO(interp)->adv_named_id, (yyvsp[(3) - (3)].sr));
                IMCC_INFO(interp)->adv_named_id = NULL;
            }
            else
-               add_pcc_arg(IMCC_INFO(interp)->cur_call, (yyvsp[(3) - (3)].sr));
+               add_pcc_arg(interp, IMCC_INFO(interp)->cur_call, (yyvsp[(3) - (3)].sr));
          }
     break;
 
   case 270:
-
-/* Line 1455 of yacc.c  */
-#line 2219 "compilers/imcc/imcc.y"
+#line 2235 "compilers/imcc/imcc.y"
     {
            (yyval.sr) = 0;
            if (IMCC_INFO(interp)->adv_named_id) {
-               add_pcc_named_arg(IMCC_INFO(interp)->cur_call, IMCC_INFO(interp)->adv_named_id, (yyvsp[(1) - (1)].sr));
+               add_pcc_named_arg(interp, IMCC_INFO(interp)->cur_call, IMCC_INFO(interp)->adv_named_id, (yyvsp[(1) - (1)].sr));
                IMCC_INFO(interp)->adv_named_id = NULL;
            }
            else
-               add_pcc_arg(IMCC_INFO(interp)->cur_call, (yyvsp[(1) - (1)].sr));
+               add_pcc_arg(interp, IMCC_INFO(interp)->cur_call, (yyvsp[(1) - (1)].sr));
          }
     break;
 
   case 271:
-
-/* Line 1455 of yacc.c  */
-#line 2229 "compilers/imcc/imcc.y"
+#line 2245 "compilers/imcc/imcc.y"
     {
            (yyval.sr) = 0;
-           add_pcc_named_arg(IMCC_INFO(interp)->cur_call,
+           add_pcc_named_arg(interp, IMCC_INFO(interp)->cur_call,
                 mk_const(interp, (yyvsp[(3) - (5)].s), 'S'), (yyvsp[(5) - (5)].sr));
            mem_sys_free((yyvsp[(3) - (5)].s));
          }
     break;
 
   case 272:
-
-/* Line 1455 of yacc.c  */
-#line 2236 "compilers/imcc/imcc.y"
+#line 2252 "compilers/imcc/imcc.y"
     {
            (yyval.sr) = 0;
-           add_pcc_named_arg_var(IMCC_INFO(interp)->cur_call, (yyvsp[(1) - (3)].sr), (yyvsp[(3) - (3)].sr));
+           add_pcc_named_arg_var(interp, IMCC_INFO(interp)->cur_call, (yyvsp[(1) - (3)].sr), (yyvsp[(3) - (3)].sr));
          }
     break;
 
   case 273:
-
-/* Line 1455 of yacc.c  */
-#line 2241 "compilers/imcc/imcc.y"
+#line 2257 "compilers/imcc/imcc.y"
     {
            (yyval.sr) = 0;
-           add_pcc_named_arg(IMCC_INFO(interp)->cur_call,
+           add_pcc_named_arg(interp, IMCC_INFO(interp)->cur_call,
                 mk_const(interp, (yyvsp[(1) - (3)].s), 'S'), (yyvsp[(3) - (3)].sr));
            mem_sys_free((yyvsp[(1) - (3)].s));
          }
     break;
 
   case 274:
-
-/* Line 1455 of yacc.c  */
-#line 2250 "compilers/imcc/imcc.y"
+#line 2266 "compilers/imcc/imcc.y"
     { (yyval.sr) = (yyvsp[(1) - (2)].sr); (yyval.sr)->type |= (yyvsp[(2) - (2)].t); }
     break;
 
   case 275:
-
-/* Line 1455 of yacc.c  */
-#line 2254 "compilers/imcc/imcc.y"
+#line 2270 "compilers/imcc/imcc.y"
     { (yyval.t) = 0; }
     break;
 
   case 276:
-
-/* Line 1455 of yacc.c  */
-#line 2255 "compilers/imcc/imcc.y"
+#line 2271 "compilers/imcc/imcc.y"
     { (yyval.t) = (yyvsp[(1) - (2)].t) | (yyvsp[(2) - (2)].t); }
     break;
 
   case 277:
-
-/* Line 1455 of yacc.c  */
-#line 2259 "compilers/imcc/imcc.y"
+#line 2275 "compilers/imcc/imcc.y"
     { (yyval.t) = VT_FLAT;     }
     break;
 
   case 278:
-
-/* Line 1455 of yacc.c  */
-#line 2260 "compilers/imcc/imcc.y"
+#line 2276 "compilers/imcc/imcc.y"
     { (yyval.t) = VT_NAMED;    }
     break;
 
   case 279:
-
-/* Line 1455 of yacc.c  */
-#line 2261 "compilers/imcc/imcc.y"
+#line 2277 "compilers/imcc/imcc.y"
     { (yyval.t) = VT_CALL_SIG; }
     break;
 
   case 280:
-
-/* Line 1455 of yacc.c  */
-#line 2264 "compilers/imcc/imcc.y"
+#line 2280 "compilers/imcc/imcc.y"
     { adv_named_set_u(interp, (yyvsp[(3) - (4)].s)); (yyval.t) = 0; }
     break;
 
   case 281:
-
-/* Line 1455 of yacc.c  */
-#line 2265 "compilers/imcc/imcc.y"
+#line 2281 "compilers/imcc/imcc.y"
     { adv_named_set(interp, (yyvsp[(3) - (4)].s));   (yyval.t) = 0; }
     break;
 
   case 282:
-
-/* Line 1455 of yacc.c  */
-#line 2269 "compilers/imcc/imcc.y"
+#line 2285 "compilers/imcc/imcc.y"
     { (yyval.sr) = (yyvsp[(1) - (2)].sr); (yyval.sr)->type |= (yyvsp[(2) - (2)].t); }
     break;
 
   case 283:
-
-/* Line 1455 of yacc.c  */
-#line 2274 "compilers/imcc/imcc.y"
+#line 2290 "compilers/imcc/imcc.y"
     {
            (yyval.sr) = 0;
            if (IMCC_INFO(interp)->adv_named_id) {
-               add_pcc_named_result(IMCC_INFO(interp)->cur_call, IMCC_INFO(interp)->adv_named_id, (yyvsp[(3) - (3)].sr));
+               add_pcc_named_result(interp, IMCC_INFO(interp)->cur_call, IMCC_INFO(interp)->adv_named_id, (yyvsp[(3) - (3)].sr));
                IMCC_INFO(interp)->adv_named_id = NULL;
            }
            else
-               add_pcc_result(IMCC_INFO(interp)->cur_call, (yyvsp[(3) - (3)].sr));
+               add_pcc_result(interp, IMCC_INFO(interp)->cur_call, (yyvsp[(3) - (3)].sr));
          }
     break;
 
   case 284:
-
-/* Line 1455 of yacc.c  */
-#line 2284 "compilers/imcc/imcc.y"
+#line 2300 "compilers/imcc/imcc.y"
     {
-            add_pcc_named_result(IMCC_INFO(interp)->cur_call,
-            mk_const(interp, (yyvsp[(3) - (5)].s), 'S'), (yyvsp[(5) - (5)].sr));
+            add_pcc_named_result(interp, IMCC_INFO(interp)->cur_call,
+                    mk_const(interp, (yyvsp[(3) - (5)].s), 'S'), (yyvsp[(5) - (5)].sr));
             mem_sys_free((yyvsp[(3) - (5)].s));
          }
     break;
 
   case 285:
-
-/* Line 1455 of yacc.c  */
-#line 2290 "compilers/imcc/imcc.y"
+#line 2306 "compilers/imcc/imcc.y"
     {
            (yyval.sr) = 0;
            if (IMCC_INFO(interp)->adv_named_id) {
-               add_pcc_named_result(IMCC_INFO(interp)->cur_call, IMCC_INFO(interp)->adv_named_id, (yyvsp[(1) - (1)].sr));
+               add_pcc_named_result(interp, IMCC_INFO(interp)->cur_call, IMCC_INFO(interp)->adv_named_id, (yyvsp[(1) - (1)].sr));
                IMCC_INFO(interp)->adv_named_id = NULL;
            }
            else
-               add_pcc_result(IMCC_INFO(interp)->cur_call, (yyvsp[(1) - (1)].sr));
+               add_pcc_result(interp, IMCC_INFO(interp)->cur_call, (yyvsp[(1) - (1)].sr));
          }
     break;
 
   case 286:
-
-/* Line 1455 of yacc.c  */
-#line 2300 "compilers/imcc/imcc.y"
+#line 2316 "compilers/imcc/imcc.y"
     {
-           add_pcc_named_result(IMCC_INFO(interp)->cur_call, mk_const(interp, (yyvsp[(1) - (3)].s), 'S'), (yyvsp[(3) - (3)].sr));
+           add_pcc_named_result(interp, IMCC_INFO(interp)->cur_call, mk_const(interp, (yyvsp[(1) - (3)].s), 'S'), (yyvsp[(3) - (3)].sr));
            mem_sys_free((yyvsp[(1) - (3)].s));
          }
     break;
 
   case 287:
-
-/* Line 1455 of yacc.c  */
-#line 2304 "compilers/imcc/imcc.y"
+#line 2320 "compilers/imcc/imcc.y"
     { (yyval.sr) = 0; }
     break;
 
   case 288:
-
-/* Line 1455 of yacc.c  */
-#line 2308 "compilers/imcc/imcc.y"
+#line 2324 "compilers/imcc/imcc.y"
     { (yyval.i) = (yyvsp[(1) - (1)].i); }
     break;
 
   case 289:
-
-/* Line 1455 of yacc.c  */
-#line 2309 "compilers/imcc/imcc.y"
+#line 2325 "compilers/imcc/imcc.y"
     { (yyval.i) = (yyvsp[(1) - (1)].i); }
     break;
 
   case 290:
-
-/* Line 1455 of yacc.c  */
-#line 2314 "compilers/imcc/imcc.y"
+#line 2330 "compilers/imcc/imcc.y"
     {
            (yyval.i) =MK_I(interp, IMCC_INFO(interp)->cur_unit, inv_op((yyvsp[(3) - (6)].s)), 3, (yyvsp[(2) - (6)].sr), (yyvsp[(4) - (6)].sr), (yyvsp[(6) - (6)].sr));
          }
     break;
 
   case 291:
-
-/* Line 1455 of yacc.c  */
-#line 2318 "compilers/imcc/imcc.y"
+#line 2334 "compilers/imcc/imcc.y"
     {
            (yyval.i) = MK_I(interp, IMCC_INFO(interp)->cur_unit, "unless_null", 2, (yyvsp[(3) - (5)].sr), (yyvsp[(5) - (5)].sr));
          }
     break;
 
   case 292:
-
-/* Line 1455 of yacc.c  */
-#line 2322 "compilers/imcc/imcc.y"
+#line 2338 "compilers/imcc/imcc.y"
     {
            (yyval.i) = MK_I(interp, IMCC_INFO(interp)->cur_unit, "unless", 2, (yyvsp[(2) - (4)].sr), (yyvsp[(4) - (4)].sr));
          }
     break;
 
   case 293:
-
-/* Line 1455 of yacc.c  */
-#line 2329 "compilers/imcc/imcc.y"
+#line 2345 "compilers/imcc/imcc.y"
     {
            (yyval.i) = MK_I(interp, IMCC_INFO(interp)->cur_unit, "if", 2, (yyvsp[(2) - (4)].sr), (yyvsp[(4) - (4)].sr));
          }
     break;
 
   case 294:
-
-/* Line 1455 of yacc.c  */
-#line 2333 "compilers/imcc/imcc.y"
+#line 2349 "compilers/imcc/imcc.y"
     {
            (yyval.i) =MK_I(interp, IMCC_INFO(interp)->cur_unit, (yyvsp[(3) - (6)].s), 3, (yyvsp[(2) - (6)].sr), (yyvsp[(4) - (6)].sr), (yyvsp[(6) - (6)].sr));
          }
     break;
 
   case 295:
-
-/* Line 1455 of yacc.c  */
-#line 2337 "compilers/imcc/imcc.y"
+#line 2353 "compilers/imcc/imcc.y"
     {
            (yyval.i) = MK_I(interp, IMCC_INFO(interp)->cur_unit, "if_null", 2, (yyvsp[(3) - (5)].sr), (yyvsp[(5) - (5)].sr));
          }
     break;
 
   case 296:
-
-/* Line 1455 of yacc.c  */
-#line 2343 "compilers/imcc/imcc.y"
+#line 2359 "compilers/imcc/imcc.y"
     { (yyval.t) = 0; }
     break;
 
   case 297:
-
-/* Line 1455 of yacc.c  */
-#line 2344 "compilers/imcc/imcc.y"
+#line 2360 "compilers/imcc/imcc.y"
     { (yyval.t) = 0; }
     break;
 
   case 298:
-
-/* Line 1455 of yacc.c  */
-#line 2348 "compilers/imcc/imcc.y"
+#line 2364 "compilers/imcc/imcc.y"
     { (yyval.s) = (char *)"eq"; }
     break;
 
   case 299:
-
-/* Line 1455 of yacc.c  */
-#line 2349 "compilers/imcc/imcc.y"
+#line 2365 "compilers/imcc/imcc.y"
     { (yyval.s) = (char *)"ne"; }
     break;
 
   case 300:
-
-/* Line 1455 of yacc.c  */
-#line 2350 "compilers/imcc/imcc.y"
+#line 2366 "compilers/imcc/imcc.y"
     { (yyval.s) = (char *)"gt"; }
     break;
 
   case 301:
-
-/* Line 1455 of yacc.c  */
-#line 2351 "compilers/imcc/imcc.y"
+#line 2367 "compilers/imcc/imcc.y"
     { (yyval.s) = (char *)"ge"; }
     break;
 
   case 302:
-
-/* Line 1455 of yacc.c  */
-#line 2352 "compilers/imcc/imcc.y"
+#line 2368 "compilers/imcc/imcc.y"
     { (yyval.s) = (char *)"lt"; }
     break;
 
   case 303:
-
-/* Line 1455 of yacc.c  */
-#line 2353 "compilers/imcc/imcc.y"
+#line 2369 "compilers/imcc/imcc.y"
     { (yyval.s) = (char *)"le"; }
     break;
 
   case 306:
-
-/* Line 1455 of yacc.c  */
-#line 2362 "compilers/imcc/imcc.y"
+#line 2378 "compilers/imcc/imcc.y"
     { (yyval.sr) = NULL; }
     break;
 
   case 307:
-
-/* Line 1455 of yacc.c  */
-#line 2363 "compilers/imcc/imcc.y"
+#line 2379 "compilers/imcc/imcc.y"
     { (yyval.sr) = (yyvsp[(1) - (1)].sr); }
     break;
 
   case 308:
-
-/* Line 1455 of yacc.c  */
-#line 2367 "compilers/imcc/imcc.y"
+#line 2383 "compilers/imcc/imcc.y"
     { (yyval.sr) = IMCC_INFO(interp)->regs[0]; }
     break;
 
   case 310:
-
-/* Line 1455 of yacc.c  */
-#line 2372 "compilers/imcc/imcc.y"
+#line 2388 "compilers/imcc/imcc.y"
     { IMCC_INFO(interp)->regs[IMCC_INFO(interp)->nargs++] = (yyvsp[(1) - (1)].sr); }
     break;
 
   case 311:
-
-/* Line 1455 of yacc.c  */
-#line 2374 "compilers/imcc/imcc.y"
+#line 2390 "compilers/imcc/imcc.y"
     {
            IMCC_INFO(interp) -> regs[IMCC_INFO(interp)->nargs++] = (yyvsp[(1) - (4)].sr);
            IMCC_INFO(interp) -> keyvec |= KEY_BIT(IMCC_INFO(interp)->nargs);
@@ -5654,9 +5112,7 @@
     break;
 
   case 312:
-
-/* Line 1455 of yacc.c  */
-#line 2381 "compilers/imcc/imcc.y"
+#line 2397 "compilers/imcc/imcc.y"
     {
            IMCC_INFO(interp) -> regs[IMCC_INFO(interp)->nargs++] = (yyvsp[(2) - (3)].sr);
            (yyval.sr) = (yyvsp[(2) - (3)].sr);
@@ -5664,60 +5120,44 @@
     break;
 
   case 314:
-
-/* Line 1455 of yacc.c  */
-#line 2388 "compilers/imcc/imcc.y"
+#line 2404 "compilers/imcc/imcc.y"
     { (yyval.sr) = mk_sub_address_fromc(interp, (yyvsp[(1) - (1)].s)); mem_sys_free((yyvsp[(1) - (1)].s)); }
     break;
 
   case 315:
-
-/* Line 1455 of yacc.c  */
-#line 2389 "compilers/imcc/imcc.y"
+#line 2405 "compilers/imcc/imcc.y"
     { (yyval.sr) = mk_sub_address_u(interp, (yyvsp[(1) - (1)].s));  mem_sys_free((yyvsp[(1) - (1)].s)); }
     break;
 
   case 316:
-
-/* Line 1455 of yacc.c  */
-#line 2393 "compilers/imcc/imcc.y"
+#line 2409 "compilers/imcc/imcc.y"
     { (yyval.sr) = mk_sub_address(interp, (yyvsp[(1) - (1)].s)); mem_sys_free((yyvsp[(1) - (1)].s)); }
     break;
 
   case 317:
-
-/* Line 1455 of yacc.c  */
-#line 2394 "compilers/imcc/imcc.y"
+#line 2410 "compilers/imcc/imcc.y"
     { (yyval.sr) = mk_sub_address(interp, (yyvsp[(1) - (1)].s)); mem_sys_free((yyvsp[(1) - (1)].s)); }
     break;
 
   case 318:
-
-/* Line 1455 of yacc.c  */
-#line 2398 "compilers/imcc/imcc.y"
+#line 2414 "compilers/imcc/imcc.y"
     { (yyval.sr) = mk_label_address(interp, (yyvsp[(1) - (1)].s)); mem_sys_free((yyvsp[(1) - (1)].s)); }
     break;
 
   case 319:
-
-/* Line 1455 of yacc.c  */
-#line 2399 "compilers/imcc/imcc.y"
+#line 2415 "compilers/imcc/imcc.y"
     { (yyval.sr) = mk_label_address(interp, (yyvsp[(1) - (1)].s)); mem_sys_free((yyvsp[(1) - (1)].s)); }
     break;
 
   case 324:
-
-/* Line 1455 of yacc.c  */
-#line 2413 "compilers/imcc/imcc.y"
+#line 2429 "compilers/imcc/imcc.y"
     {
            IMCC_INFO(interp)->nkeys    = 0;
          }
     break;
 
   case 325:
-
-/* Line 1455 of yacc.c  */
-#line 2417 "compilers/imcc/imcc.y"
+#line 2433 "compilers/imcc/imcc.y"
     {
            (yyval.sr) = link_keys(interp,
                           IMCC_INFO(interp)->nkeys,
@@ -5726,18 +5166,14 @@
     break;
 
   case 326:
-
-/* Line 1455 of yacc.c  */
-#line 2425 "compilers/imcc/imcc.y"
+#line 2441 "compilers/imcc/imcc.y"
     {
            IMCC_INFO(interp)->nkeys = 0;
          }
     break;
 
   case 327:
-
-/* Line 1455 of yacc.c  */
-#line 2429 "compilers/imcc/imcc.y"
+#line 2445 "compilers/imcc/imcc.y"
     {
            (yyval.sr) = link_keys(interp,
                           IMCC_INFO(interp)->nkeys,
@@ -5746,16 +5182,12 @@
     break;
 
   case 328:
-
-/* Line 1455 of yacc.c  */
-#line 2437 "compilers/imcc/imcc.y"
+#line 2453 "compilers/imcc/imcc.y"
     { IMCC_INFO(interp)->keys[IMCC_INFO(interp)->nkeys++] = (yyvsp[(1) - (1)].sr); }
     break;
 
   case 329:
-
-/* Line 1455 of yacc.c  */
-#line 2439 "compilers/imcc/imcc.y"
+#line 2455 "compilers/imcc/imcc.y"
     {
            IMCC_INFO(interp)->keys[IMCC_INFO(interp)->nkeys++] = (yyvsp[(3) - (3)].sr);
            (yyval.sr) = IMCC_INFO(interp)->keys[0];
@@ -5763,81 +5195,60 @@
     break;
 
   case 330:
-
-/* Line 1455 of yacc.c  */
-#line 2447 "compilers/imcc/imcc.y"
+#line 2463 "compilers/imcc/imcc.y"
     {
            (yyval.sr) = (yyvsp[(1) - (1)].sr);
          }
     break;
 
   case 331:
-
-/* Line 1455 of yacc.c  */
-#line 2453 "compilers/imcc/imcc.y"
+#line 2469 "compilers/imcc/imcc.y"
     { (yyval.sr) = mk_symreg(interp, (yyvsp[(1) - (1)].s), 'I'); }
     break;
 
   case 332:
-
-/* Line 1455 of yacc.c  */
-#line 2454 "compilers/imcc/imcc.y"
+#line 2470 "compilers/imcc/imcc.y"
     { (yyval.sr) = mk_symreg(interp, (yyvsp[(1) - (1)].s), 'N'); }
     break;
 
   case 333:
-
-/* Line 1455 of yacc.c  */
-#line 2455 "compilers/imcc/imcc.y"
+#line 2471 "compilers/imcc/imcc.y"
     { (yyval.sr) = mk_symreg(interp, (yyvsp[(1) - (1)].s), 'S'); }
     break;
 
   case 334:
-
-/* Line 1455 of yacc.c  */
-#line 2456 "compilers/imcc/imcc.y"
+#line 2472 "compilers/imcc/imcc.y"
     { (yyval.sr) = mk_symreg(interp, (yyvsp[(1) - (1)].s), 'P'); }
     break;
 
   case 335:
-
-/* Line 1455 of yacc.c  */
-#line 2457 "compilers/imcc/imcc.y"
+#line 2473 "compilers/imcc/imcc.y"
     { (yyval.sr) = mk_pasm_reg(interp, (yyvsp[(1) - (1)].s)); mem_sys_free((yyvsp[(1) - (1)].s)); }
     break;
 
   case 336:
-
-/* Line 1455 of yacc.c  */
-#line 2461 "compilers/imcc/imcc.y"
+#line 2477 "compilers/imcc/imcc.y"
     { (yyval.sr) = mk_const(interp, (yyvsp[(1) - (1)].s), 'I'); mem_sys_free((yyvsp[(1) - (1)].s)); }
     break;
 
   case 337:
-
-/* Line 1455 of yacc.c  */
-#line 2462 "compilers/imcc/imcc.y"
+#line 2478 "compilers/imcc/imcc.y"
     { (yyval.sr) = mk_const(interp, (yyvsp[(1) - (1)].s), 'N'); mem_sys_free((yyvsp[(1) - (1)].s)); }
     break;
 
   case 338:
-
-/* Line 1455 of yacc.c  */
-#line 2463 "compilers/imcc/imcc.y"
+#line 2479 "compilers/imcc/imcc.y"
     { (yyval.sr) = mk_const(interp, (yyvsp[(1) - (1)].s), 'S'); mem_sys_free((yyvsp[(1) - (1)].s)); }
     break;
 
   case 339:
-
-/* Line 1455 of yacc.c  */
-#line 2464 "compilers/imcc/imcc.y"
+#line 2480 "compilers/imcc/imcc.y"
     { (yyval.sr) = mk_const(interp, (yyvsp[(1) - (1)].s), 'U'); mem_sys_free((yyvsp[(1) - (1)].s)); }
     break;
 
 
-
-/* Line 1455 of yacc.c  */
-#line 5830 "compilers/imcc/imcparser.c"
+/* Line 1267 of yacc.c.  */
+#line 5241 "compilers/imcc/imcparser.c"
       default: break;
     }
   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -5848,6 +5259,7 @@
 
   *++yyvsp = yyval;
 
+
   /* Now `shift' the result of the reduction.  Determine what state
      that goes to, based on the state we popped back to and the rule
      number reduced by.  */
@@ -5912,7 +5324,7 @@
 
   if (yyerrstatus == 3)
     {
-      /* If just tried and failed to reuse lookahead token after an
+      /* If just tried and failed to reuse look-ahead token after an
 	 error, discard it.  */
 
       if (yychar <= YYEOF)
@@ -5929,7 +5341,7 @@
 	}
     }
 
-  /* Else will try to reuse lookahead token after shifting the error
+  /* Else will try to reuse look-ahead token after shifting the error
      token.  */
   goto yyerrlab1;
 
@@ -5986,6 +5398,9 @@
       YY_STACK_PRINT (yyss, yyssp);
     }
 
+  if (yyn == YYFINAL)
+    YYACCEPT;
+
   *++yyvsp = yylval;
 
 
@@ -6010,7 +5425,7 @@
   yyresult = 1;
   goto yyreturn;
 
-#if !defined(yyoverflow) || YYERROR_VERBOSE
+#ifndef yyoverflow
 /*-------------------------------------------------.
 | yyexhaustedlab -- memory exhaustion comes here.  |
 `-------------------------------------------------*/
@@ -6021,7 +5436,7 @@
 #endif
 
 yyreturn:
-  if (yychar != YYEMPTY)
+  if (yychar != YYEOF && yychar != YYEMPTY)
      yydestruct ("Cleanup: discarding lookahead",
 		 yytoken, &yylval, yyscanner, interp);
   /* Do not reclaim the symbols of the rule which action triggered
@@ -6047,9 +5462,7 @@
 }
 
 
-
-/* Line 1675 of yacc.c  */
-#line 2470 "compilers/imcc/imcc.y"
+#line 2486 "compilers/imcc/imcc.y"
 
 
 /* I need this prototype somewhere... */

Modified: trunk/compilers/imcc/imcparser.h
==============================================================================
--- trunk/compilers/imcc/imcparser.h	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/compilers/imcc/imcparser.h	Mon Feb 22 09:28:39 2010	(r44291)
@@ -9,26 +9,27 @@
  */
 /* HEADERIZER HFILE: none */
 /* HEADERIZER STOP */
-
-/* A Bison parser, made by GNU Bison 2.4.1.  */
+/* A Bison parser, made by GNU Bison 2.3.  */
 
 /* Skeleton interface for Bison's Yacc-like parsers in C
-   
-      Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+
+   Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
    Free Software Foundation, Inc.
-   
-   This program is free software: you can redistribute it and/or modify
+
+   This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
-   the Free Software Foundation, either version 3 of the License, or
-   (at your option) any later version.
-   
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
-   
+
    You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street, Fifth Floor,
+   Boston, MA 02110-1301, USA.  */
 
 /* As a special exception, you may create a larger work that contains
    part or all of the Bison parser skeleton and distribute that work
@@ -39,11 +40,10 @@
    special exception, which will cause the skeleton and the resulting
    Bison output files to be licensed under the GNU General Public
    License without this special exception.
-   
+
    This special exception was added by the Free Software Foundation in
    version 2.2 of Bison.  */
 
-
 /* Tokens.  */
 #ifndef YYTOKENTYPE
 # define YYTOKENTYPE
@@ -297,27 +297,21 @@
 
 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
 typedef union YYSTYPE
+#line 1075 "compilers/imcc/imcc.y"
 {
-
-/* Line 1676 of yacc.c  */
-#line 1059 "compilers/imcc/imcc.y"
-
     IdList * idlist;
     int t;
     char * s;
     SymReg * sr;
     Instruction *i;
-
-
-
-/* Line 1676 of yacc.c  */
-#line 304 "compilers/imcc/imcparser.h"
-} YYSTYPE;
-# define YYSTYPE_IS_TRIVIAL 1
+}
+/* Line 1489 of yacc.c.  */
+#line 299 "compilers/imcc/imcparser.h"
+	YYSTYPE;
 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
 # define YYSTYPE_IS_DECLARED 1
+# define YYSTYPE_IS_TRIVIAL 1
 #endif
 
 
 
-

Modified: trunk/compilers/imcc/instructions.c
==============================================================================
--- trunk/compilers/imcc/instructions.c	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/compilers/imcc/instructions.c	Mon Feb 22 09:28:39 2010	(r44291)
@@ -149,7 +149,7 @@
     if (!w_special[0]) {
         size_t i;
         for (i = 0; i < N_ELEMENTS(writes); i++) {
-            const int n = interp->op_lib->op_code(writes[i], 1);
+            const int n = interp->op_lib->op_code(interp, writes[i], 1);
             PARROT_ASSERT(n);
             w_special[i] = n;
         }

Modified: trunk/compilers/imcc/optimizer.c
==============================================================================
--- trunk/compilers/imcc/optimizer.c	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/compilers/imcc/optimizer.c	Mon Feb 22 09:28:39 2010	(r44291)
@@ -802,7 +802,7 @@
     int i;
     op_info_t *op_info;
 
-    opnum = interp->op_lib->op_code(op, 1);
+    opnum = interp->op_lib->op_code(interp, op, 1);
     if (opnum < 0)
         IMCC_fatal(interp, 1, "eval_ins: op '%s' not found\n", op);
     op_info = interp->op_info_table + opnum;

Modified: trunk/compilers/imcc/parser_util.c
==============================================================================
--- trunk/compilers/imcc/parser_util.c	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/compilers/imcc/parser_util.c	Mon Feb 22 09:28:39 2010	(r44291)
@@ -285,7 +285,7 @@
     ASSERT_ARGS(check_op)
     op_fullname(fullname, name, r, narg, keyvec);
 
-    return interp->op_lib->op_code(fullname, 1);
+    return interp->op_lib->op_code(interp, fullname, 1);
 }
 
 /*
@@ -303,8 +303,8 @@
 is_op(PARROT_INTERP, ARGIN(const char *name))
 {
     ASSERT_ARGS(is_op)
-    return interp->op_lib->op_code(name, 0) >= 0
-        || interp->op_lib->op_code(name, 1) >= 0;
+    return interp->op_lib->op_code(interp, name, 0) >= 0
+        || interp->op_lib->op_code(interp, name, 1) >= 0;
 }
 
 /*
@@ -341,7 +341,7 @@
     r[0]->pmc_type = enum_class_FixedIntegerArray;
 
     op_fullname(fullname, name, r, 1, 0);
-    op = interp->op_lib->op_code(fullname, 1);
+    op = interp->op_lib->op_code(interp, fullname, 1);
 
     PARROT_ASSERT(op >= 0);
 
@@ -404,11 +404,11 @@
         return var_arg_ins(interp, unit, name, r, n, emit);
 
     op_fullname(fullname, name, r, n, keyvec);
-    op = interp->op_lib->op_code(fullname, 1);
+    op = interp->op_lib->op_code(interp, fullname, 1);
 
     /* maybe we have a fullname */
     if (op < 0)
-        op = interp->op_lib->op_code(name, 1);
+        op = interp->op_lib->op_code(interp, name, 1);
 
     /* still wrong, try reverse compare */
     if (op < 0) {
@@ -416,7 +416,7 @@
         if (n_name) {
             name = n_name;
             op_fullname(fullname, name, r, n, keyvec);
-            op   = interp->op_lib->op_code(fullname, 1);
+            op   = interp->op_lib->op_code(interp, fullname, 1);
         }
     }
 
@@ -638,7 +638,7 @@
 
     if (IMCC_INFO(interp)->last_unit) {
         /* a reentrant compile */
-        imc_info          = mem_allocate_zeroed_typed(imc_info_t);
+        imc_info          = mem_gc_allocate_zeroed_typed(interp, imc_info_t);
         imc_info->ghash   = IMCC_INFO(interp)->ghash;
         imc_info->prev    = IMCC_INFO(interp);
         IMCC_INFO(interp) = imc_info;
@@ -907,7 +907,7 @@
 
     if (IMCC_INFO(interp)->last_unit) {
         /* a reentrant compile */
-        imc_info          = mem_allocate_zeroed_typed(imc_info_t);
+        imc_info          = mem_gc_allocate_zeroed_typed(interp, imc_info_t);
         imc_info->prev    = IMCC_INFO(interp);
         imc_info->ghash   = IMCC_INFO(interp)->ghash;
         IMCC_INFO(interp) = imc_info;
@@ -1193,7 +1193,7 @@
 
     if (changed) {
         op_fullname(fullname, name, r, n, keyvec);
-        return interp->op_lib->op_code(fullname, 1);
+        return interp->op_lib->op_code(interp, fullname, 1);
     }
 
     return -1;

Modified: trunk/compilers/imcc/pbc.c
==============================================================================
--- trunk/compilers/imcc/pbc.c	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/compilers/imcc/pbc.c	Mon Feb 22 09:28:39 2010	(r44291)
@@ -357,11 +357,11 @@
     /* Update the constant count and reallocate */
     if (interp->code->const_table->constants)
         interp->code->const_table->constants =
-            mem_realloc_n_typed(interp->code->const_table->constants,
+            mem_gc_realloc_n_typed(interp, interp->code->const_table->constants,
                 newcount, PackFile_Constant *);
     else
         interp->code->const_table->constants =
-            mem_allocate_n_typed(newcount, PackFile_Constant *);
+            mem_gc_allocate_n_typed(interp, newcount, PackFile_Constant *);
 
     interp->code->const_table->constants[oldcount] = new_constant;
     interp->code->const_table->const_count         = newcount;
@@ -432,10 +432,10 @@
 e_pbc_open(PARROT_INTERP, SHIM(void *param))
 {
     ASSERT_ARGS(e_pbc_open)
-    code_segment_t * const cs = mem_allocate_zeroed_typed(code_segment_t);
+    code_segment_t * const cs = mem_gc_allocate_zeroed_typed(interp, code_segment_t);
 
     if (!IMCC_INFO(interp)->globals)
-        IMCC_INFO(interp)->globals = mem_allocate_zeroed_typed(imcc_globals);
+        IMCC_INFO(interp)->globals = mem_gc_allocate_zeroed_typed(interp, imcc_globals);
 
     if (IMCC_INFO(interp)->globals->cs)
         clear_sym_hash(&IMCC_INFO(interp)->globals->cs->key_consts);
@@ -445,7 +445,7 @@
     }
 
     /* free previous cached key constants if any */
-    create_symhash(&cs->key_consts);
+    create_symhash(interp, &cs->key_consts);
 
     cs->next     = NULL;
     cs->prev     = IMCC_INFO(interp)->globals->cs;
@@ -496,7 +496,7 @@
 make_new_sub(PARROT_INTERP, ARGIN(IMC_Unit *unit))
 {
     ASSERT_ARGS(make_new_sub)
-    subs_t * const s = mem_allocate_zeroed_typed(subs_t);
+    subs_t * const s = mem_gc_allocate_zeroed_typed(interp, subs_t);
 
     s->prev          = IMCC_INFO(interp)->globals->cs->subs;
     s->unit          = unit;
@@ -510,7 +510,7 @@
 
     IMCC_INFO(interp)->globals->cs->subs = s;
 
-    create_symhash(&s->fixup);
+    create_symhash(interp, &s->fixup);
 }
 
 
@@ -615,7 +615,7 @@
 {
     ASSERT_ARGS(store_key_const)
     SymReg * const c =
-        _mk_const(&IMCC_INFO(interp)->globals->cs->key_consts, str, 0);
+        _mk_const(interp, &IMCC_INFO(interp)->globals->cs->key_consts, str, 0);
     c->color = idx;
 }
 
@@ -826,7 +826,7 @@
                     SymReg * const nam = mk_const(interp, fixup->name,
                             fixup->type & VT_ENCODED ? 'U' : 'S');
 
-                    const int op = interp->op_lib->op_code("find_sub_not_null_p_sc", 1);
+                    const int op = interp->op_lib->op_code(interp, "find_sub_not_null_p_sc", 1);
                     PARROT_ASSERT(op);
 
                     interp->code->base.data[addr] = op;
@@ -1478,7 +1478,7 @@
     if (r)
         return r->color;
 
-    pfc = mem_allocate_typed(PackFile_Constant);
+    pfc = mem_gc_allocate_typed(interp, PackFile_Constant);
     rc  = PackFile_Constant_unpack_key(interp,
             interp->code->const_table, pfc, key);
 
@@ -2188,7 +2188,7 @@
             /* need a dummy to hold register usage */
             SymReg * const r = mk_sub_label(interp, "(null)");
             r->type          = VT_PCC_SUB;
-            r->pcc_sub       = mem_allocate_zeroed_typed(pcc_sub_t);
+            r->pcc_sub       = mem_gc_allocate_zeroed_typed(interp, pcc_sub_t);
 
             add_const_pmc_sub(interp, r, oldsize, oldsize + code_size);
         }

Modified: trunk/compilers/imcc/pcc.c
==============================================================================
--- trunk/compilers/imcc/pcc.c	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/compilers/imcc/pcc.c	Mon Feb 22 09:28:39 2010	(r44291)
@@ -108,9 +108,12 @@
         __attribute__nonnull__(3)
         __attribute__nonnull__(4);
 
-static void unshift_self(ARGIN(SymReg *sub), ARGIN(SymReg *obj))
+static void unshift_self(PARROT_INTERP,
+    ARGIN(SymReg *sub),
+    ARGIN(SymReg *obj))
         __attribute__nonnull__(1)
-        __attribute__nonnull__(2);
+        __attribute__nonnull__(2)
+        __attribute__nonnull__(3);
 
 #define ASSERT_ARGS_insert_tail_call __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp) \
@@ -143,7 +146,8 @@
     , PARROT_ASSERT_ARG(ins) \
     , PARROT_ASSERT_ARG(sub))
 #define ASSERT_ARGS_unshift_self __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(sub) \
+       PARROT_ASSERT_ARG(interp) \
+    , PARROT_ASSERT_ARG(sub) \
     , PARROT_ASSERT_ARG(obj))
 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END.  Your changes will be lost. */
 /* HEADERIZER END: static */
@@ -267,15 +271,15 @@
     SymReg *regcache[PCC_GET_ARGS_LIMIT + 1];
     char bufcache[sizeof (pref) + sizeof (item) * PCC_GET_ARGS_LIMIT + sizeof (subf)];
 
-    SymReg ** const regs  = n < PCC_GET_ARGS_LIMIT ?
-        regcache :
-        mem_allocate_n_zeroed_typed(n + 1, SymReg *);
+    SymReg ** const regs  = n < PCC_GET_ARGS_LIMIT
+                                ? regcache
+                                : mem_gc_allocate_n_zeroed_typed(interp, n + 1, SymReg *);
 
     unsigned int  bufpos  = 0;
     unsigned int  bufsize = lenpref + lenitem * n + lensubf;
-    char         *buf     = n < PCC_GET_ARGS_LIMIT ?
-        bufcache :
-        mem_allocate_n_typed(bufsize, char);
+    char         *buf     = n < PCC_GET_ARGS_LIMIT
+                                ? bufcache
+                                : mem_gc_allocate_n_typed(interp, bufsize, char);
 
     memcpy(buf, pref, lenpref);
     bufpos += lenpref;
@@ -362,7 +366,7 @@
 
 /*
 
-=item C<static void unshift_self(SymReg *sub, SymReg *obj)>
+=item C<static void unshift_self(PARROT_INTERP, SymReg *sub, SymReg *obj)>
 
 prepend the object to args or self to params
 
@@ -371,15 +375,15 @@
 */
 
 static void
-unshift_self(ARGIN(SymReg *sub), ARGIN(SymReg *obj))
+unshift_self(PARROT_INTERP, ARGIN(SymReg *sub), ARGIN(SymReg *obj))
 {
     ASSERT_ARGS(unshift_self)
     struct pcc_sub_t * const pcc_sub = sub->pcc_sub;
     const int                n       = pcc_sub->nargs;
     int                      i;
 
-    mem_realloc_n_typed(pcc_sub->args,      n + 1, SymReg *);
-    mem_realloc_n_typed(pcc_sub->arg_flags, n + 1, int);
+    pcc_sub->args       = mem_gc_realloc_n_typed(interp, pcc_sub->args,      n + 1, SymReg *);
+    pcc_sub->arg_flags  = mem_gc_realloc_n_typed(interp, pcc_sub->arg_flags, n + 1, int);
 
     for (i = n; i; --i) {
         pcc_sub->args[i]      = pcc_sub->args[i - 1];
@@ -419,7 +423,7 @@
             self->type = VTIDENTIFIER;
         }
 
-        unshift_self(sub, self);
+        unshift_self(interp, sub, self);
     }
 
     /* Don't generate any parameter checking code if there
@@ -821,7 +825,7 @@
     }
 
     if (sub->pcc_sub->object)
-        unshift_self(sub, sub->pcc_sub->object);
+        unshift_self(interp, sub, sub->pcc_sub->object);
 
     /* insert arguments */
     n   = sub->pcc_sub->nargs;

Modified: trunk/compilers/imcc/reg_alloc.c
==============================================================================
--- trunk/compilers/imcc/reg_alloc.c	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/compilers/imcc/reg_alloc.c	Mon Feb 22 09:28:39 2010	(r44291)
@@ -59,7 +59,8 @@
         __attribute__nonnull__(2)
         FUNC_MODIFIES(*unit);
 
-static void build_reglist(NULLOK_INTERP, ARGMOD(IMC_Unit *unit))
+static void build_reglist(PARROT_INTERP, ARGMOD(IMC_Unit *unit))
+        __attribute__nonnull__(1)
         __attribute__nonnull__(2)
         FUNC_MODIFIES(*unit);
 
@@ -73,11 +74,12 @@
         FUNC_MODIFIES(*r);
 
 PARROT_WARN_UNUSED_RESULT
-static unsigned int first_avail(
+static unsigned int first_avail(PARROT_INTERP,
     ARGIN(const IMC_Unit *unit),
     int reg_set,
     ARGOUT_NULLOK(Set **avail))
         __attribute__nonnull__(1)
+        __attribute__nonnull__(2)
         FUNC_MODIFIES(*avail);
 
 PARROT_WARN_UNUSED_RESULT
@@ -162,7 +164,8 @@
         __attribute__nonnull__(1)
         __attribute__nonnull__(2);
 
-static void vanilla_reg_alloc(SHIM_INTERP, ARGMOD(IMC_Unit *unit))
+static void vanilla_reg_alloc(PARROT_INTERP, ARGMOD(IMC_Unit *unit))
+        __attribute__nonnull__(1)
         __attribute__nonnull__(2)
         FUNC_MODIFIES(*unit);
 
@@ -179,14 +182,16 @@
        PARROT_ASSERT_ARG(interp) \
     , PARROT_ASSERT_ARG(unit))
 #define ASSERT_ARGS_build_reglist __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(unit))
+       PARROT_ASSERT_ARG(interp) \
+    , PARROT_ASSERT_ARG(unit))
 #define ASSERT_ARGS_compute_du_chain __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(unit))
 #define ASSERT_ARGS_compute_one_du_chain __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(r) \
     , PARROT_ASSERT_ARG(unit))
 #define ASSERT_ARGS_first_avail __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(unit))
+       PARROT_ASSERT_ARG(interp) \
+    , PARROT_ASSERT_ARG(unit))
 #define ASSERT_ARGS_ig_allocate __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
 #define ASSERT_ARGS_ig_find_color __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(unit) \
@@ -223,7 +228,8 @@
        PARROT_ASSERT_ARG(interp) \
     , PARROT_ASSERT_ARG(unit))
 #define ASSERT_ARGS_vanilla_reg_alloc __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(unit))
+       PARROT_ASSERT_ARG(interp) \
+    , PARROT_ASSERT_ARG(unit))
 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END.  Your changes will be lost. */
 /* HEADERIZER END: static */
 
@@ -636,7 +642,7 @@
 
 /*
 
-=item C<static void build_reglist(NULLOK_INTERP, IMC_Unit *unit)>
+=item C<static void build_reglist(PARROT_INTERP, IMC_Unit *unit)>
 
 make a linear list of IDENTs and VARs, set n_symbols
 TODO
@@ -654,7 +660,7 @@
 */
 
 static void
-build_reglist(NULLOK_INTERP, ARGMOD(IMC_Unit *unit))
+build_reglist(PARROT_INTERP, ARGMOD(IMC_Unit *unit))
 {
     ASSERT_ARGS(build_reglist)
     SymHash  const *hsh = &unit->hash;
@@ -670,7 +676,7 @@
     if (count == 0)
         return;
 
-    unit->reglist = mem_allocate_n_typed(count, SymReg *);
+    unit->reglist = mem_gc_allocate_n_typed(interp, count, SymReg *);
 
     for (i = count = 0; i < hsh->size; i++) {
         SymReg *r;
@@ -1043,7 +1049,7 @@
     if (!n)
         return;
 
-    avail = mem_allocate_n_typed(n, char);
+    avail = mem_gc_allocate_n_typed(interp, n, char);
 
     for (i = 0; i < unit->n_symbols; ++i) {
         int     already_allocated, color;
@@ -1122,8 +1128,8 @@
 
 /*
 
-=item C<static unsigned int first_avail(const IMC_Unit *unit, int reg_set, Set
-**avail)>
+=item C<static unsigned int first_avail(PARROT_INTERP, const IMC_Unit *unit, int
+reg_set, Set **avail)>
 
 find first available register of the given reg_set
 
@@ -1133,13 +1139,15 @@
 
 PARROT_WARN_UNUSED_RESULT
 static unsigned int
-first_avail(ARGIN(const IMC_Unit *unit), int reg_set, ARGOUT_NULLOK(Set **avail))
+first_avail(PARROT_INTERP,
+        ARGIN(const IMC_Unit *unit), int reg_set,
+        ARGOUT_NULLOK(Set **avail))
 {
     ASSERT_ARGS(first_avail)
     int n                     = (int)unit->n_symbols > unit->max_color
                               ? (int)unit->n_symbols
                               : unit->max_color;
-    Set         *allocated    = set_make((unsigned int)n + 1);
+    Set         *allocated    = set_make(interp, (unsigned int)n + 1);
 
     const SymHash * const hsh = &unit->hash;
 
@@ -1205,7 +1213,7 @@
                 Set         *avail     = sets[j];
                 unsigned int first_reg = avail
                                        ? set_first_zero(avail)
-                                       : first_avail(unit, (int)r->set, &avail);
+                                       : first_avail(interp, unit, (int)r->set, &avail);
                 set_add(avail, first_reg);
                 r->color = first_reg++;
 
@@ -1244,7 +1252,7 @@
 */
 
 static void
-vanilla_reg_alloc(SHIM_INTERP, ARGMOD(IMC_Unit *unit))
+vanilla_reg_alloc(PARROT_INTERP, ARGMOD(IMC_Unit *unit))
 {
     ASSERT_ARGS(vanilla_reg_alloc)
     const char   type[] = "INSP";
@@ -1266,7 +1274,7 @@
     /* Assign new colors. */
     for (j = 0; j < 4; j++) {
         reg_set   = type[j];
-        first_reg = first_avail(unit, reg_set, &avail);
+        first_reg = first_avail(interp, unit, reg_set, &avail);
 
         /* XXX Use a different loop variable that doesn't shadow outer i */
         for (i = 0; i < hsh->size; i++) {
@@ -1276,7 +1284,7 @@
                     continue;
                 if (REG_NEEDS_ALLOC(r) && (r->color == -1) && r->use_count) {
                     if (set_contains(avail, first_reg))
-                        first_reg = first_avail(unit, reg_set, NULL);
+                        first_reg = first_avail(interp, unit, reg_set, NULL);
 
                     set_add(avail, first_reg);
                     r->color = first_reg++;

Modified: trunk/compilers/imcc/sets.c
==============================================================================
--- trunk/compilers/imcc/sets.c	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/compilers/imcc/sets.c	Mon Feb 22 09:28:39 2010	(r44291)
@@ -38,7 +38,7 @@
 
 /*
 
-=item C<Set* set_make(unsigned int length)>
+=item C<Set* set_make(PARROT_INTERP, unsigned int length)>
 
 Creates a new Set object.
 
@@ -49,13 +49,13 @@
 PARROT_MALLOC
 PARROT_CANNOT_RETURN_NULL
 Set*
-set_make(unsigned int length)
+set_make(PARROT_INTERP, unsigned int length)
 {
     ASSERT_ARGS(set_make)
-    Set * const s = mem_allocate_zeroed_typed(Set);
+    Set * const s = mem_gc_allocate_zeroed_typed(interp, Set);
     s->length     = length;
-    s->bmp        = mem_allocate_n_zeroed_typed(NUM_BYTES(length),
-                        unsigned char);
+    s->bmp        = mem_gc_allocate_n_zeroed_typed(interp,
+                            NUM_BYTES(length), unsigned char);
 
     return s;
 }
@@ -63,7 +63,7 @@
 
 /*
 
-=item C<Set* set_make_full(unsigned int length)>
+=item C<Set* set_make_full(PARROT_INTERP, unsigned int length)>
 
 Creates a new Set object of C<length> items, setting them all to full.
 
@@ -74,10 +74,10 @@
 PARROT_MALLOC
 PARROT_CANNOT_RETURN_NULL
 Set*
-set_make_full(unsigned int length)
+set_make_full(PARROT_INTERP, unsigned int length)
 {
     ASSERT_ARGS(set_make_full)
-    Set * const s      = set_make(length);
+    Set * const s      = set_make(interp, length);
     const size_t bytes = NUM_BYTES(length);
 
     if (bytes)
@@ -128,7 +128,7 @@
 
 /*
 
-=item C<Set* set_copy(const Set *s)>
+=item C<Set* set_copy(PARROT_INTERP, const Set *s)>
 
 Copies the set C<s>, returning a new set pointer.
 
@@ -139,10 +139,10 @@
 PARROT_MALLOC
 PARROT_CANNOT_RETURN_NULL
 Set*
-set_copy(ARGIN(const Set *s))
+set_copy(PARROT_INTERP, ARGIN(const Set *s))
 {
     ASSERT_ARGS(set_copy)
-    Set * const d = set_make(s->length);
+    Set * const d = set_make(interp, s->length);
 
     memcpy(d->bmp, s->bmp, NUM_BYTES(d->length));
     return d;
@@ -286,7 +286,7 @@
 
 /*
 
-=item C<Set * set_union(const Set *s1, const Set *s2)>
+=item C<Set * set_union(PARROT_INTERP, const Set *s1, const Set *s2)>
 
 Computes the union of the two Set arguments, returning it as a new Set.
 
@@ -299,11 +299,11 @@
 PARROT_MALLOC
 PARROT_CANNOT_RETURN_NULL
 Set *
-set_union(ARGIN(const Set *s1), ARGIN(const Set *s2))
+set_union(PARROT_INTERP, ARGIN(const Set *s1), ARGIN(const Set *s2))
 {
     ASSERT_ARGS(set_union)
     unsigned int i;
-    Set * const s = set_make(s1->length);
+    Set * const s = set_make(interp, s1->length);
 
     if (s1->length != s2->length)
         fatal(1, "set_union", "Sets don't have the same length\n");
@@ -318,7 +318,7 @@
 
 /*
 
-=item C<Set * set_intersec(const Set *s1, const Set *s2)>
+=item C<Set * set_intersec(PARROT_INTERP, const Set *s1, const Set *s2)>
 
 Creates a new Set object that is the intersection of the Set arguments (defined
 through the binary C<and> operator.)
@@ -332,11 +332,11 @@
 PARROT_MALLOC
 PARROT_CANNOT_RETURN_NULL
 Set *
-set_intersec(ARGIN(const Set *s1), ARGIN(const Set *s2))
+set_intersec(PARROT_INTERP, ARGIN(const Set *s1), ARGIN(const Set *s2))
 {
     ASSERT_ARGS(set_intersec)
     unsigned int i;
-    Set * const  s = set_make(s1->length);
+    Set * const  s = set_make(interp, s1->length);
 
     if (s1->length != s2->length)
         fatal(1, "set_intersec", "Sets don't have the same length\n");

Modified: trunk/compilers/imcc/sets.h
==============================================================================
--- trunk/compilers/imcc/sets.h	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/compilers/imcc/sets.h	Mon Feb 22 09:28:39 2010	(r44291)
@@ -29,8 +29,9 @@
 
 PARROT_MALLOC
 PARROT_CANNOT_RETURN_NULL
-Set* set_copy(ARGIN(const Set *s))
-        __attribute__nonnull__(1);
+Set* set_copy(PARROT_INTERP, ARGIN(const Set *s))
+        __attribute__nonnull__(1)
+        __attribute__nonnull__(2);
 
 int set_equal(ARGIN(const Set *s1), ARGIN(const Set *s2))
         __attribute__nonnull__(1)
@@ -47,9 +48,12 @@
 
 PARROT_MALLOC
 PARROT_CANNOT_RETURN_NULL
-Set * set_intersec(ARGIN(const Set *s1), ARGIN(const Set *s2))
+Set * set_intersec(PARROT_INTERP,
+    ARGIN(const Set *s1),
+    ARGIN(const Set *s2))
         __attribute__nonnull__(1)
-        __attribute__nonnull__(2);
+        __attribute__nonnull__(2)
+        __attribute__nonnull__(3);
 
 void set_intersec_inplace(ARGMOD(Set *s1), ARGIN(const Set *s2))
         __attribute__nonnull__(1)
@@ -58,17 +62,20 @@
 
 PARROT_MALLOC
 PARROT_CANNOT_RETURN_NULL
-Set* set_make(unsigned int length);
+Set* set_make(PARROT_INTERP, unsigned int length)
+        __attribute__nonnull__(1);
 
 PARROT_MALLOC
 PARROT_CANNOT_RETURN_NULL
-Set* set_make_full(unsigned int length);
+Set* set_make_full(PARROT_INTERP, unsigned int length)
+        __attribute__nonnull__(1);
 
 PARROT_MALLOC
 PARROT_CANNOT_RETURN_NULL
-Set * set_union(ARGIN(const Set *s1), ARGIN(const Set *s2))
+Set * set_union(PARROT_INTERP, ARGIN(const Set *s1), ARGIN(const Set *s2))
         __attribute__nonnull__(1)
-        __attribute__nonnull__(2);
+        __attribute__nonnull__(2)
+        __attribute__nonnull__(3);
 
 #define ASSERT_ARGS_set_add __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(s))
@@ -77,7 +84,8 @@
 #define ASSERT_ARGS_set_contains __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(s))
 #define ASSERT_ARGS_set_copy __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(s))
+       PARROT_ASSERT_ARG(interp) \
+    , PARROT_ASSERT_ARG(s))
 #define ASSERT_ARGS_set_equal __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(s1) \
     , PARROT_ASSERT_ARG(s2))
@@ -86,15 +94,19 @@
 #define ASSERT_ARGS_set_free __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(s))
 #define ASSERT_ARGS_set_intersec __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(s1) \
+       PARROT_ASSERT_ARG(interp) \
+    , PARROT_ASSERT_ARG(s1) \
     , PARROT_ASSERT_ARG(s2))
 #define ASSERT_ARGS_set_intersec_inplace __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(s1) \
     , PARROT_ASSERT_ARG(s2))
-#define ASSERT_ARGS_set_make __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
-#define ASSERT_ARGS_set_make_full __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
+#define ASSERT_ARGS_set_make __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+       PARROT_ASSERT_ARG(interp))
+#define ASSERT_ARGS_set_make_full __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+       PARROT_ASSERT_ARG(interp))
 #define ASSERT_ARGS_set_union __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(s1) \
+       PARROT_ASSERT_ARG(interp) \
+    , PARROT_ASSERT_ARG(s1) \
     , PARROT_ASSERT_ARG(s2))
 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END.  Your changes will be lost. */
 /* HEADERIZER END: compilers/imcc/sets.c */

Modified: trunk/compilers/imcc/symreg.c
==============================================================================
--- trunk/compilers/imcc/symreg.c	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/compilers/imcc/symreg.c	Mon Feb 22 09:28:39 2010	(r44291)
@@ -48,19 +48,21 @@
 PARROT_WARN_UNUSED_RESULT
 PARROT_CANNOT_RETURN_NULL
 PARROT_MALLOC
-static char * _mk_fullname(
+static char * _mk_fullname(PARROT_INTERP,
     ARGIN_NULLOK(const Namespace *ns),
     ARGIN(const char *name))
-        __attribute__nonnull__(2);
+        __attribute__nonnull__(1)
+        __attribute__nonnull__(3);
 
 PARROT_WARN_UNUSED_RESULT
 PARROT_CANNOT_RETURN_NULL
-static SymReg * _mk_symreg(
+static SymReg * _mk_symreg(PARROT_INTERP,
     ARGMOD(SymHash *hsh),
     ARGIN(const char *name),
     int t)
         __attribute__nonnull__(1)
         __attribute__nonnull__(2)
+        __attribute__nonnull__(3)
         FUNC_MODIFIES(*hsh);
 
 PARROT_WARN_UNUSED_RESULT
@@ -95,17 +97,20 @@
         FUNC_MODIFIES(*unit)
         FUNC_MODIFIES(*rhs);
 
-static void resize_symhash(ARGMOD(SymHash *hsh))
+static void resize_symhash(PARROT_INTERP, ARGMOD(SymHash *hsh))
         __attribute__nonnull__(1)
+        __attribute__nonnull__(2)
         FUNC_MODIFIES(*hsh);
 
 #define ASSERT_ARGS__get_sym_typed __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(hsh) \
     , PARROT_ASSERT_ARG(name))
 #define ASSERT_ARGS__mk_fullname __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(name))
+       PARROT_ASSERT_ARG(interp) \
+    , PARROT_ASSERT_ARG(name))
 #define ASSERT_ARGS__mk_symreg __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(hsh) \
+       PARROT_ASSERT_ARG(interp) \
+    , PARROT_ASSERT_ARG(hsh) \
     , PARROT_ASSERT_ARG(name))
 #define ASSERT_ARGS_add_ns __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp) \
@@ -121,7 +126,8 @@
     , PARROT_ASSERT_ARG(left) \
     , PARROT_ASSERT_ARG(rhs))
 #define ASSERT_ARGS_resize_symhash __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(hsh))
+       PARROT_ASSERT_ARG(interp) \
+    , PARROT_ASSERT_ARG(hsh))
 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END.  Your changes will be lost. */
 /* HEADERIZER END: static */
 
@@ -139,7 +145,7 @@
 push_namespace(PARROT_INTERP, ARGIN(const char *name))
 {
     ASSERT_ARGS(push_namespace)
-    Namespace * const ns = mem_allocate_zeroed_typed(Namespace);
+    Namespace * const ns = mem_gc_allocate_zeroed_typed(interp, Namespace);
 
     ns->parent = IMCC_INFO(interp)->namespace_stack;
     ns->name   = mem_sys_strdup(name);
@@ -244,7 +250,8 @@
 
 /*
 
-=item C<static SymReg * _mk_symreg(SymHash *hsh, const char *name, int t)>
+=item C<static SymReg * _mk_symreg(PARROT_INTERP, SymHash *hsh, const char
+*name, int t)>
 
 Makes a new SymReg in the given SymHash from a varname and type.
 
@@ -255,20 +262,20 @@
 PARROT_WARN_UNUSED_RESULT
 PARROT_CANNOT_RETURN_NULL
 static SymReg *
-_mk_symreg(ARGMOD(SymHash *hsh), ARGIN(const char *name), int t)
+_mk_symreg(PARROT_INTERP, ARGMOD(SymHash *hsh), ARGIN(const char *name), int t)
 {
     ASSERT_ARGS(_mk_symreg)
     SymReg * r = _get_sym_typed(hsh, name, t);
 
     if (!r) {
-        r             = mem_allocate_zeroed_typed(SymReg);
+        r             = mem_gc_allocate_zeroed_typed(interp, SymReg);
         r->set        = t;
         r->type       = VTREG;
         r->name       = mem_sys_strdup(name);
         r->color      = -1;
         r->want_regno = -1;
 
-        _store_symreg(hsh, r);
+        _store_symreg(interp, hsh, r);
     }
 
     return r;
@@ -296,7 +303,7 @@
     /* Check for the condition that fires up a segfault in TT #162 */
     PARROT_ASSERT(unit != NULL);
 
-    return _mk_symreg(&unit->hash, name, t);
+    return _mk_symreg(interp, &unit->hash, name, t);
 }
 
 
@@ -386,10 +393,10 @@
 {
     ASSERT_ARGS(mk_pcc_sub)
     IMC_Unit * const unit = IMCC_INFO(interp)->last_unit;
-    SymReg   * const r    = _mk_symreg(&unit->hash, name, proto);
+    SymReg   * const r    = _mk_symreg(interp, &unit->hash, name, proto);
 
     r->type    = VT_PCC_SUB;
-    r->pcc_sub = mem_allocate_zeroed_typed(pcc_sub_t);
+    r->pcc_sub = mem_gc_allocate_zeroed_typed(interp, pcc_sub_t);
 
     return r;
 }
@@ -420,7 +427,7 @@
     if (unit->prev && unit->prev->_namespace == ns)
         unit->_namespace = ns;
     else {
-        SymReg * const g = dup_sym(ns);
+        SymReg * const g = dup_sym(interp, ns);
         SymReg * const r = _get_sym(&IMCC_INFO(interp)->ghash, g->name);
 
         unit->_namespace     = g;
@@ -430,7 +437,7 @@
         /* this unit should free its namespace only if it's the only thing
          * holding onto it */
         if (!r || r->type != VT_CONSTP) {
-            _store_symreg(&IMCC_INFO(interp)->ghash, g);
+            _store_symreg(interp, &IMCC_INFO(interp)->ghash, g);
             unit->owns_namespace = 0;
         }
         else
@@ -441,7 +448,7 @@
 
 /*
 
-=item C<void add_pcc_arg(SymReg *r, SymReg *arg)>
+=item C<void add_pcc_arg(PARROT_INTERP, SymReg *r, SymReg *arg)>
 
 Adds a register or constant to the function arg list.
 
@@ -450,14 +457,14 @@
 */
 
 void
-add_pcc_arg(ARGMOD(SymReg *r), ARGMOD(SymReg *arg))
+add_pcc_arg(PARROT_INTERP, ARGMOD(SymReg *r), ARGMOD(SymReg *arg))
 {
     ASSERT_ARGS(add_pcc_arg)
     pcc_sub_t * const sub = r->pcc_sub;
     const int         n   = sub->nargs;
 
-    mem_realloc_n_typed(sub->args,      n + 1, SymReg *);
-    mem_realloc_n_typed(sub->arg_flags, n + 1, int);
+    sub->args       = mem_gc_realloc_n_typed(interp, sub->args,      n + 1, SymReg *);
+    sub->arg_flags  = mem_gc_realloc_n_typed(interp, sub->arg_flags, n + 1, int);
 
     sub->args[n]      = arg;
     sub->arg_flags[n] = arg->type;
@@ -470,7 +477,7 @@
 
 /*
 
-=item C<void add_pcc_result(SymReg *r, SymReg *arg)>
+=item C<void add_pcc_result(PARROT_INTERP, SymReg *r, SymReg *arg)>
 
 Adds a register or constant to the function's return list.
 
@@ -479,14 +486,14 @@
 */
 
 void
-add_pcc_result(ARGMOD(SymReg *r), ARGMOD(SymReg *arg))
+add_pcc_result(PARROT_INTERP, ARGMOD(SymReg *r), ARGMOD(SymReg *arg))
 {
     ASSERT_ARGS(add_pcc_result)
     pcc_sub_t * const sub = r->pcc_sub;
     const int         n   = sub->nret;
 
-    mem_realloc_n_typed(sub->ret,       n + 1, SymReg *);
-    mem_realloc_n_typed(sub->ret_flags, n + 1, int);
+    sub->ret        = mem_gc_realloc_n_typed(interp, sub->ret,       n + 1, SymReg *);
+    sub->ret_flags  = mem_gc_realloc_n_typed(interp, sub->ret_flags, n + 1, int);
 
     /* we can't keep the flags in the SymReg as the SymReg
      * maybe used with different flags for different calls */
@@ -501,7 +508,7 @@
 
 /*
 
-=item C<void add_pcc_multi(SymReg *r, SymReg *arg)>
+=item C<void add_pcc_multi(PARROT_INTERP, SymReg *r, SymReg *arg)>
 
 Adds a :multi signature to the sub.
 
@@ -510,13 +517,13 @@
 */
 
 void
-add_pcc_multi(ARGMOD(SymReg *r), ARGIN_NULLOK(SymReg *arg))
+add_pcc_multi(PARROT_INTERP, ARGMOD(SymReg *r), ARGIN_NULLOK(SymReg *arg))
 {
     ASSERT_ARGS(add_pcc_multi)
     pcc_sub_t * const sub = r->pcc_sub;
     const int n           = sub->nmulti;
 
-    mem_realloc_n_typed(sub->multi, n + 1, SymReg *);
+    sub->multi = mem_gc_realloc_n_typed(interp, sub->multi, n + 1, SymReg *);
     sub->multi[n] = arg;
     sub->nmulti++;
 }
@@ -592,7 +599,8 @@
 
 /*
 
-=item C<static char * _mk_fullname(const Namespace *ns, const char *name)>
+=item C<static char * _mk_fullname(PARROT_INTERP, const Namespace *ns, const
+char *name)>
 
 Combines the namespace and name together, separated by a C<::>.  If there's no
 namespace, the name is returned on its own.
@@ -607,12 +615,12 @@
 PARROT_CANNOT_RETURN_NULL
 PARROT_MALLOC
 static char *
-_mk_fullname(ARGIN_NULLOK(const Namespace *ns), ARGIN(const char *name))
+_mk_fullname(PARROT_INTERP, ARGIN_NULLOK(const Namespace *ns), ARGIN(const char *name))
 {
     ASSERT_ARGS(_mk_fullname)
     if (ns) {
         const size_t len = strlen(name) + strlen(ns->name) + 3;
-        char *result = (char *) mem_sys_allocate(len);
+        char *result = mem_gc_allocate_n_typed(interp, len, char);
         snprintf(result, len, "%s::%s", ns->name, name);
         return result;
     }
@@ -637,7 +645,7 @@
 mk_ident(PARROT_INTERP, ARGIN(const char *name), int t)
 {
     ASSERT_ARGS(mk_ident)
-    char   * const fullname = _mk_fullname(IMCC_INFO(interp)->namespace_stack, name);
+    char   * const fullname = _mk_fullname(interp, IMCC_INFO(interp)->namespace_stack, name);
     SymReg *r = get_sym_by_name(&(IMCC_INFO(interp)->last_unit->hash), name);
     if (r && r->set != t)
         IMCC_fataly(interp, EXCEPTION_SYNTAX_ERROR,
@@ -648,7 +656,7 @@
 
 
     if (IMCC_INFO(interp)->namespace_stack) {
-        Identifier * const ident = mem_allocate_zeroed_typed(Identifier);
+        Identifier * const ident = mem_gc_allocate_zeroed_typed(interp, Identifier);
 
         ident->name        = fullname;
         ident->next        = IMCC_INFO(interp)->namespace_stack->idents;
@@ -784,7 +792,7 @@
             IMCC_fataly(interp, EXCEPTION_SYNTAX_ERROR,
                     "global PMC constant not allowed");
 
-        r = _mk_symreg(&IMCC_INFO(interp)->ghash, name, t);
+        r = _mk_symreg(interp, &IMCC_INFO(interp)->ghash, name, t);
     }
     else {
         r = mk_ident(interp, name, t);
@@ -802,7 +810,8 @@
 
 /*
 
-=item C<SymReg * _mk_const(SymHash *hsh, const char *name, int t)>
+=item C<SymReg * _mk_const(PARROT_INTERP, SymHash *hsh, const char *name, int
+t)>
 
 Makes a new constant (internal use only).
 
@@ -813,10 +822,10 @@
 PARROT_WARN_UNUSED_RESULT
 PARROT_CANNOT_RETURN_NULL
 SymReg *
-_mk_const(ARGMOD(SymHash *hsh), ARGIN(const char *name), int t)
+_mk_const(PARROT_INTERP, ARGMOD(SymHash *hsh), ARGIN(const char *name), int t)
 {
     ASSERT_ARGS(_mk_const)
-    SymReg * const r = _mk_symreg(hsh, name, t);
+    SymReg * const r = _mk_symreg(interp, hsh, name, t);
     r->type          = VTCONST;
 
     if (t == 'U') {
@@ -902,9 +911,9 @@
     SymHash * const h = &IMCC_INFO(interp)->ghash;
 
     if (!h->data)
-        create_symhash(h);
+        create_symhash(interp, h);
 
-    return _mk_const(h, name, t);
+    return _mk_const(interp, h, name, t);
 }
 
 
@@ -981,10 +990,10 @@
         if (r && r->usage & U_LEXICAL)
             is_lexical = 1;
 
-        r       = mem_allocate_zeroed_typed(SymReg);
+        r       = mem_gc_allocate_zeroed_typed(interp, SymReg);
         r->type = VTADDRESS;
         r->name = mem_sys_strdup(name);
-        _store_symreg(hsh, r);
+        _store_symreg(interp, hsh, r);
 
         if (is_lexical)
             r->usage |= U_LEXICAL;
@@ -1011,7 +1020,7 @@
             }
         }
 
-        r       = _mk_symreg(hsh, sub_name, 0);
+        r       = _mk_symreg(interp, hsh, sub_name, 0);
         r->type = VTADDRESS;
 
         if (uniq) {
@@ -1119,7 +1128,7 @@
 
 /*
 
-=item C<SymReg * dup_sym(const SymReg *r)>
+=item C<SymReg * dup_sym(PARROT_INTERP, const SymReg *r)>
 
 Links keys to a keys structure = SymReg
 
@@ -1164,15 +1173,15 @@
 PARROT_MALLOC
 PARROT_CANNOT_RETURN_NULL
 SymReg *
-dup_sym(ARGIN(const SymReg *r))
+dup_sym(PARROT_INTERP, ARGIN(const SymReg *r))
 {
     ASSERT_ARGS(dup_sym)
-    SymReg * const new_sym = mem_allocate_zeroed_typed(SymReg);
+    SymReg * const new_sym = mem_gc_allocate_zeroed_typed(interp, SymReg);
     STRUCT_COPY(new_sym, r);
     new_sym->name = mem_sys_strdup(r->name);
 
     if (r->nextkey)
-        new_sym->nextkey = dup_sym(r->nextkey);
+        new_sym->nextkey = dup_sym(interp, r->nextkey);
 
     return new_sym;
 }
@@ -1236,7 +1245,7 @@
     }
 
     /* no, need a new one */
-    keychain       = mem_allocate_zeroed_typed(SymReg);
+    keychain       = mem_gc_allocate_zeroed_typed(interp, SymReg);
     keychain->type = VTCONST;
 
     ++keychain->use_count;
@@ -1249,7 +1258,7 @@
         if (REG_NEEDS_ALLOC(keys[i]))
             keychain->type |= VTREGKEY;
 
-        key->nextkey = dup_sym(keys[i]);
+        key->nextkey = dup_sym(interp, keys[i]);
         key          = key->nextkey;
 
         /* for registers, point ->reg to the original, needed by
@@ -1262,7 +1271,7 @@
     keychain->set   = 'K';
     keychain->color = -1;
 
-    _store_symreg(h, keychain);
+    _store_symreg(interp, h, keychain);
 
     return keychain;
 }
@@ -1316,7 +1325,7 @@
 
 /*
 
-=item C<void create_symhash(SymHash *hash)>
+=item C<void create_symhash(PARROT_INTERP, SymHash *hash)>
 
 Creates a symbol hash table with space for 16 entries.
 
@@ -1325,10 +1334,10 @@
 */
 
 void
-create_symhash(ARGOUT(SymHash *hash))
+create_symhash(PARROT_INTERP, ARGOUT(SymHash *hash))
 {
     ASSERT_ARGS(create_symhash)
-    hash->data    = mem_allocate_n_zeroed_typed(16, SymReg *);
+    hash->data    = mem_gc_allocate_n_zeroed_typed(interp, 16, SymReg *);
     hash->size    = 16;
     hash->entries = 0;
 }
@@ -1336,7 +1345,7 @@
 
 /*
 
-=item C<static void resize_symhash(SymHash *hsh)>
+=item C<static void resize_symhash(PARROT_INTERP, SymHash *hsh)>
 
 Resizes a symbol hash table.
 
@@ -1345,16 +1354,16 @@
 */
 
 static void
-resize_symhash(ARGMOD(SymHash *hsh))
+resize_symhash(PARROT_INTERP, ARGMOD(SymHash *hsh))
 {
     ASSERT_ARGS(resize_symhash)
     const int    new_size = hsh->size << 1; /* new size is twice as large */
     int          n_next   = 16;
-    SymReg     **next_r   = mem_allocate_n_zeroed_typed(n_next, SymReg *);
+    SymReg     **next_r   = mem_gc_allocate_n_zeroed_typed(interp, n_next, SymReg *);
     SymHash      nh;                        /* new symbol table */
     unsigned int i;
 
-    nh.data = mem_allocate_n_zeroed_typed(new_size, SymReg *);
+    nh.data = mem_gc_allocate_n_zeroed_typed(interp, new_size, SymReg *);
 
     for (i = 0; i < hsh->size; i++) {
         SymReg *r, *next;
@@ -1367,7 +1376,7 @@
             /* remember all the chained next pointers and clear r->next */
             if (j >= n_next) {
                 n_next <<= 1;
-                mem_realloc_n_typed(next_r, n_next, SymReg *);
+                next_r = mem_gc_realloc_n_typed(interp, next_r, n_next, SymReg *);
             }
 
             r->next     = NULL;
@@ -1396,7 +1405,7 @@
 
 /*
 
-=item C<void _store_symreg(SymHash *hsh, SymReg *r)>
+=item C<void _store_symreg(PARROT_INTERP, SymHash *hsh, SymReg *r)>
 
 Stores a symbol in the hash (internal use only).
 
@@ -1405,7 +1414,7 @@
 */
 
 void
-_store_symreg(ARGMOD(SymHash *hsh), ARGMOD(SymReg *r))
+_store_symreg(PARROT_INTERP, ARGMOD(SymHash *hsh), ARGMOD(SymReg *r))
 {
     ASSERT_ARGS(_store_symreg)
     const int i = hash_str(r->name) % hsh->size;
@@ -1418,7 +1427,7 @@
     hsh->entries++;
 
     if (hsh->entries >= hsh->size)
-        resize_symhash(hsh);
+        resize_symhash(interp, hsh);
 }
 
 
@@ -1436,7 +1445,7 @@
 store_symreg(PARROT_INTERP, ARGMOD(SymReg *r))
 {
     ASSERT_ARGS(store_symreg)
-    _store_symreg(&IMCC_INFO(interp)->cur_unit->hash, r);
+    _store_symreg(interp, &IMCC_INFO(interp)->cur_unit->hash, r);
 }
 
 
@@ -1512,7 +1521,7 @@
     SymReg          *p;
 
     for (ns = nspace; ns; ns = ns->parent) {
-        char * const fullname = _mk_fullname(ns, name);
+        char * const fullname = _mk_fullname(interp, ns, name);
         p                     = _get_sym(hsh, fullname);
 
         mem_sys_free(fullname);

Modified: trunk/compilers/imcc/symreg.h
==============================================================================
--- trunk/compilers/imcc/symreg.h	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/compilers/imcc/symreg.h	Mon Feb 22 09:28:39 2010	(r44291)
@@ -138,14 +138,19 @@
 
 PARROT_WARN_UNUSED_RESULT
 PARROT_CANNOT_RETURN_NULL
-SymReg * _mk_const(ARGMOD(SymHash *hsh), ARGIN(const char *name), int t)
+SymReg * _mk_const(PARROT_INTERP,
+    ARGMOD(SymHash *hsh),
+    ARGIN(const char *name),
+    int t)
         __attribute__nonnull__(1)
         __attribute__nonnull__(2)
+        __attribute__nonnull__(3)
         FUNC_MODIFIES(*hsh);
 
-void _store_symreg(ARGMOD(SymHash *hsh), ARGMOD(SymReg *r))
+void _store_symreg(PARROT_INTERP, ARGMOD(SymHash *hsh), ARGMOD(SymReg *r))
         __attribute__nonnull__(1)
         __attribute__nonnull__(2)
+        __attribute__nonnull__(3)
         FUNC_MODIFIES(*hsh)
         FUNC_MODIFIES(*r);
 
@@ -154,9 +159,10 @@
         __attribute__nonnull__(2)
         FUNC_MODIFIES(*unit);
 
-void add_pcc_arg(ARGMOD(SymReg *r), ARGMOD(SymReg *arg))
+void add_pcc_arg(PARROT_INTERP, ARGMOD(SymReg *r), ARGMOD(SymReg *arg))
         __attribute__nonnull__(1)
         __attribute__nonnull__(2)
+        __attribute__nonnull__(3)
         FUNC_MODIFIES(*r)
         FUNC_MODIFIES(*arg);
 
@@ -165,13 +171,17 @@
         __attribute__nonnull__(2)
         FUNC_MODIFIES(*r);
 
-void add_pcc_multi(ARGMOD(SymReg *r), ARGIN_NULLOK(SymReg *arg))
+void add_pcc_multi(PARROT_INTERP,
+    ARGMOD(SymReg *r),
+    ARGIN_NULLOK(SymReg *arg))
         __attribute__nonnull__(1)
+        __attribute__nonnull__(2)
         FUNC_MODIFIES(*r);
 
-void add_pcc_result(ARGMOD(SymReg *r), ARGMOD(SymReg *arg))
+void add_pcc_result(PARROT_INTERP, ARGMOD(SymReg *r), ARGMOD(SymReg *arg))
         __attribute__nonnull__(1)
         __attribute__nonnull__(2)
+        __attribute__nonnull__(3)
         FUNC_MODIFIES(*r)
         FUNC_MODIFIES(*arg);
 
@@ -188,8 +198,9 @@
         __attribute__nonnull__(1)
         FUNC_MODIFIES(*hsh);
 
-void create_symhash(ARGOUT(SymHash *hash))
+void create_symhash(PARROT_INTERP, ARGOUT(SymHash *hash))
         __attribute__nonnull__(1)
+        __attribute__nonnull__(2)
         FUNC_MODIFIES(*hash);
 
 void debug_dump_sym_hash(ARGIN(const SymHash *hsh))
@@ -197,8 +208,9 @@
 
 PARROT_MALLOC
 PARROT_CANNOT_RETURN_NULL
-SymReg * dup_sym(ARGIN(const SymReg *r))
-        __attribute__nonnull__(1);
+SymReg * dup_sym(PARROT_INTERP, ARGIN(const SymReg *r))
+        __attribute__nonnull__(1)
+        __attribute__nonnull__(2);
 
 PARROT_CAN_RETURN_NULL
 PARROT_WARN_UNUSED_RESULT
@@ -338,24 +350,29 @@
     , PARROT_ASSERT_ARG(hsh) \
     , PARROT_ASSERT_ARG(name))
 #define ASSERT_ARGS__mk_const __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(hsh) \
+       PARROT_ASSERT_ARG(interp) \
+    , PARROT_ASSERT_ARG(hsh) \
     , PARROT_ASSERT_ARG(name))
 #define ASSERT_ARGS__store_symreg __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(hsh) \
+       PARROT_ASSERT_ARG(interp) \
+    , PARROT_ASSERT_ARG(hsh) \
     , PARROT_ASSERT_ARG(r))
 #define ASSERT_ARGS_add_namespace __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp) \
     , PARROT_ASSERT_ARG(unit))
 #define ASSERT_ARGS_add_pcc_arg __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(r) \
+       PARROT_ASSERT_ARG(interp) \
+    , PARROT_ASSERT_ARG(r) \
     , PARROT_ASSERT_ARG(arg))
 #define ASSERT_ARGS_add_pcc_cc __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(r) \
     , PARROT_ASSERT_ARG(arg))
 #define ASSERT_ARGS_add_pcc_multi __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(r))
+       PARROT_ASSERT_ARG(interp) \
+    , PARROT_ASSERT_ARG(r))
 #define ASSERT_ARGS_add_pcc_result __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(r) \
+       PARROT_ASSERT_ARG(interp) \
+    , PARROT_ASSERT_ARG(r) \
     , PARROT_ASSERT_ARG(arg))
 #define ASSERT_ARGS_add_pcc_sub __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(r) \
@@ -366,11 +383,13 @@
 #define ASSERT_ARGS_clear_sym_hash __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(hsh))
 #define ASSERT_ARGS_create_symhash __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(hash))
+       PARROT_ASSERT_ARG(interp) \
+    , PARROT_ASSERT_ARG(hash))
 #define ASSERT_ARGS_debug_dump_sym_hash __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(hsh))
 #define ASSERT_ARGS_dup_sym __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(r))
+       PARROT_ASSERT_ARG(interp) \
+    , PARROT_ASSERT_ARG(r))
 #define ASSERT_ARGS_find_sym __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp) \
     , PARROT_ASSERT_ARG(name))

Modified: trunk/config/gen/crypto/digest_pmc.in
==============================================================================
--- trunk/config/gen/crypto/digest_pmc.in	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/config/gen/crypto/digest_pmc.in	Mon Feb 22 09:28:39 2010	(r44291)
@@ -34,7 +34,7 @@
 */
     VTABLE void init() {
 @TEMP_md_guard@
-        @TEMP_md_ctx@ *c    = mem_allocate_zeroed_typed(@TEMP_md_ctx@);
+        @TEMP_md_ctx@ *c    = mem_gc_allocate_zeroed_typed(INTERP, @TEMP_md_ctx@);
         PMC_data(SELF) = c;
         PObj_custom_destroy_SET(SELF);
 #else
@@ -54,7 +54,7 @@
 @TEMP_md_guard@
         @TEMP_md_ctx@ *c = PMC_data_typed(SELF, @TEMP_md_ctx@ *);
         if (c) {
-            mem_sys_free(c);
+            mem_gc_free(INTERP, c);
             PMC_data(SELF) = NULL;
         }
 #endif

Modified: trunk/config/gen/makefiles/root.in
==============================================================================
--- trunk/config/gen/makefiles/root.in	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/config/gen/makefiles/root.in	Mon Feb 22 09:28:39 2010	(r44291)
@@ -283,6 +283,7 @@
     $(LIBRARY_DIR)/Getopt/Obj.pbc \
     $(LIBRARY_DIR)/Iter.pbc \
     $(LIBRARY_DIR)/JSON.pbc \
+    $(LIBRARY_DIR)/data_json.pbc \
     $(LIBRARY_DIR)/Math/Rand.pbc \
     $(LIBRARY_DIR)/MIME/Base64.pbc \
     $(LIBRARY_DIR)/NCI/Utils.pbc \

Modified: trunk/config/gen/platform/generic/exec.c
==============================================================================
--- trunk/config/gen/platform/generic/exec.c	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/config/gen/platform/generic/exec.c	Mon Feb 22 09:28:39 2010	(r44291)
@@ -106,7 +106,7 @@
         int status, i;
         STRING *s;
         char   *cmd;
-        char  **argv = mem_allocate_n_typed((len+1), char*);
+        char  **argv = mem_gc_allocate_n_typed(interp, (len+1), char*);
 
         for (i = 0; i < len; ++i) {
             s = VTABLE_get_string_keyed_int(interp, cmdargs, i);

Modified: trunk/config/gen/platform/platform_interface.h
==============================================================================
--- trunk/config/gen/platform/platform_interface.h	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/config/gen/platform/platform_interface.h	Mon Feb 22 09:28:39 2010	(r44291)
@@ -44,9 +44,9 @@
 void mem_free_executable(void *, size_t);
 void *mem_realloc_executable(void *, size_t, size_t);
 #else
-#  define mem_alloc_executable mem_sys_allocate
-#  define mem_free_executable(a, b) mem_sys_free(a)
-#  define mem_realloc_executable(a, b, c) mem_sys_realloc((a), (c))
+#  define mem_alloc_executable mem_internal_allocate
+#  define mem_free_executable(a, b) mem_internal_free(a)
+#  define mem_realloc_executable(a, b, c) mem_internal_realloc((a), (c))
 #endif
 
 /*

Modified: trunk/include/parrot/charset.h
==============================================================================
--- trunk/include/parrot/charset.h	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/include/parrot/charset.h	Mon Feb 22 09:28:39 2010	(r44291)
@@ -101,7 +101,8 @@
         __attribute__nonnull__(2);
 
 PARROT_EXPORT
-void Parrot_charsets_encodings_deinit(SHIM_INTERP);
+void Parrot_charsets_encodings_deinit(PARROT_INTERP)
+        __attribute__nonnull__(1);
 
 PARROT_EXPORT
 void Parrot_charsets_encodings_init(PARROT_INTERP)
@@ -149,20 +150,23 @@
 PARROT_EXPORT
 PARROT_CAN_RETURN_NULL
 PARROT_MALLOC
-CHARSET * Parrot_new_charset(SHIM_INTERP);
+CHARSET * Parrot_new_charset(PARROT_INTERP)
+        __attribute__nonnull__(1);
 
 PARROT_EXPORT
-INTVAL Parrot_register_charset(SHIM_INTERP,
+INTVAL Parrot_register_charset(PARROT_INTERP,
     ARGIN(const char *charsetname),
     ARGIN(CHARSET *charset))
+        __attribute__nonnull__(1)
         __attribute__nonnull__(2)
         __attribute__nonnull__(3);
 
 PARROT_EXPORT
-void Parrot_register_charset_converter(SHIM_INTERP,
+void Parrot_register_charset_converter(PARROT_INTERP,
     ARGIN(const CHARSET *lhs),
     ARGIN(CHARSET *rhs),
     ARGIN(charset_converter_t func))
+        __attribute__nonnull__(1)
         __attribute__nonnull__(2)
         __attribute__nonnull__(3)
         __attribute__nonnull__(4);
@@ -175,7 +179,8 @@
 #define ASSERT_ARGS_Parrot_charset_number_of_str __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(src))
 #define ASSERT_ARGS_Parrot_charsets_encodings_deinit \
-     __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
+     __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+       PARROT_ASSERT_ARG(interp))
 #define ASSERT_ARGS_Parrot_charsets_encodings_init \
      __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp))
@@ -191,13 +196,16 @@
     , PARROT_ASSERT_ARG(charsetname))
 #define ASSERT_ARGS_Parrot_make_default_charset __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(charset))
-#define ASSERT_ARGS_Parrot_new_charset __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
+#define ASSERT_ARGS_Parrot_new_charset __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+       PARROT_ASSERT_ARG(interp))
 #define ASSERT_ARGS_Parrot_register_charset __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(charsetname) \
+       PARROT_ASSERT_ARG(interp) \
+    , PARROT_ASSERT_ARG(charsetname) \
     , PARROT_ASSERT_ARG(charset))
 #define ASSERT_ARGS_Parrot_register_charset_converter \
      __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(lhs) \
+       PARROT_ASSERT_ARG(interp) \
+    , PARROT_ASSERT_ARG(lhs) \
     , PARROT_ASSERT_ARG(rhs) \
     , PARROT_ASSERT_ARG(func))
 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END.  Your changes will be lost. */

Modified: trunk/include/parrot/debugger.h
==============================================================================
--- trunk/include/parrot/debugger.h	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/include/parrot/debugger.h	Mon Feb 22 09:28:39 2010	(r44291)
@@ -214,12 +214,13 @@
         __attribute__nonnull__(1)
         __attribute__nonnull__(2);
 
-long PDB_add_label(
+long PDB_add_label(PARROT_INTERP,
     ARGMOD(PDB_file_t *file),
     ARGIN(const opcode_t *cur_opcode),
     opcode_t offset)
         __attribute__nonnull__(1)
         __attribute__nonnull__(2)
+        __attribute__nonnull__(3)
         FUNC_MODIFIES(*file);
 
 void PDB_assign(PARROT_INTERP, ARGIN(const char *command))
@@ -251,7 +252,9 @@
         __attribute__nonnull__(1)
         __attribute__nonnull__(2);
 
-void PDB_delete_condition(SHIM_INTERP, ARGMOD(PDB_breakpoint_t *breakpoint))
+void PDB_delete_condition(PARROT_INTERP,
+    ARGMOD(PDB_breakpoint_t *breakpoint))
+        __attribute__nonnull__(1)
         __attribute__nonnull__(2)
         FUNC_MODIFIES(*breakpoint);
 
@@ -284,8 +287,9 @@
 PARROT_WARN_UNUSED_RESULT
 PARROT_CAN_RETURN_NULL
 PARROT_MALLOC
-char * PDB_escape(ARGIN(const char *string), UINTVAL length)
-        __attribute__nonnull__(1);
+char * PDB_escape(PARROT_INTERP, ARGIN(const char *string), UINTVAL length)
+        __attribute__nonnull__(1)
+        __attribute__nonnull__(2);
 
 void PDB_eval(PARROT_INTERP, ARGIN(const char *command))
         __attribute__nonnull__(1)
@@ -298,7 +302,9 @@
         __attribute__nonnull__(1)
         __attribute__nonnull__(2);
 
-void PDB_free_file(SHIM_INTERP, ARGIN_NULLOK(PDB_file_t *file));
+void PDB_free_file(PARROT_INTERP, ARGIN_NULLOK(PDB_file_t *file))
+        __attribute__nonnull__(1);
+
 void PDB_get_command(PARROT_INTERP)
         __attribute__nonnull__(1);
 
@@ -374,7 +380,8 @@
        PARROT_ASSERT_ARG(interp) \
     , PARROT_ASSERT_ARG(command))
 #define ASSERT_ARGS_PDB_add_label __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(file) \
+       PARROT_ASSERT_ARG(interp) \
+    , PARROT_ASSERT_ARG(file) \
     , PARROT_ASSERT_ARG(cur_opcode))
 #define ASSERT_ARGS_PDB_assign __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp) \
@@ -395,7 +402,8 @@
        PARROT_ASSERT_ARG(interp) \
     , PARROT_ASSERT_ARG(command))
 #define ASSERT_ARGS_PDB_delete_condition __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(breakpoint))
+       PARROT_ASSERT_ARG(interp) \
+    , PARROT_ASSERT_ARG(breakpoint))
 #define ASSERT_ARGS_PDB_disable_breakpoint __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp) \
     , PARROT_ASSERT_ARG(command))
@@ -410,14 +418,16 @@
        PARROT_ASSERT_ARG(interp) \
     , PARROT_ASSERT_ARG(command))
 #define ASSERT_ARGS_PDB_escape __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(string))
+       PARROT_ASSERT_ARG(interp) \
+    , PARROT_ASSERT_ARG(string))
 #define ASSERT_ARGS_PDB_eval __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp) \
     , PARROT_ASSERT_ARG(command))
 #define ASSERT_ARGS_PDB_find_breakpoint __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp) \
     , PARROT_ASSERT_ARG(command))
-#define ASSERT_ARGS_PDB_free_file __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
+#define ASSERT_ARGS_PDB_free_file __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+       PARROT_ASSERT_ARG(interp))
 #define ASSERT_ARGS_PDB_get_command __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp))
 #define ASSERT_ARGS_PDB_hasinstruction __attribute__unused__ int _ASSERT_ARGS_CHECK = (\

Modified: trunk/include/parrot/encoding.h
==============================================================================
--- trunk/include/parrot/encoding.h	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/include/parrot/encoding.h	Mon Feb 22 09:28:39 2010	(r44291)
@@ -143,7 +143,8 @@
 PARROT_EXPORT
 PARROT_MALLOC
 PARROT_CANNOT_RETURN_NULL
-ENCODING * Parrot_new_encoding(SHIM_INTERP);
+ENCODING * Parrot_new_encoding(PARROT_INTERP)
+        __attribute__nonnull__(1);
 
 PARROT_EXPORT
 INTVAL Parrot_register_encoding(PARROT_INTERP,
@@ -153,7 +154,9 @@
         __attribute__nonnull__(2)
         __attribute__nonnull__(3);
 
-void parrot_deinit_encodings(void);
+void parrot_deinit_encodings(PARROT_INTERP)
+        __attribute__nonnull__(1);
+
 void Parrot_str_internal_register_encoding_names(PARROT_INTERP)
         __attribute__nonnull__(1);
 
@@ -178,12 +181,14 @@
     , PARROT_ASSERT_ARG(encodingname))
 #define ASSERT_ARGS_Parrot_make_default_encoding __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(encoding))
-#define ASSERT_ARGS_Parrot_new_encoding __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
+#define ASSERT_ARGS_Parrot_new_encoding __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+       PARROT_ASSERT_ARG(interp))
 #define ASSERT_ARGS_Parrot_register_encoding __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp) \
     , PARROT_ASSERT_ARG(encodingname) \
     , PARROT_ASSERT_ARG(encoding))
-#define ASSERT_ARGS_parrot_deinit_encodings __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
+#define ASSERT_ARGS_parrot_deinit_encodings __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+       PARROT_ASSERT_ARG(interp))
 #define ASSERT_ARGS_Parrot_str_internal_register_encoding_names \
      __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp))

Modified: trunk/include/parrot/gc_api.h
==============================================================================
--- trunk/include/parrot/gc_api.h	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/include/parrot/gc_api.h	Mon Feb 22 09:28:39 2010	(r44291)
@@ -109,6 +109,22 @@
         __attribute__nonnull__(1);
 
 PARROT_EXPORT
+PARROT_CANNOT_RETURN_NULL
+void * Parrot_gc_allocate_memory_chunk(PARROT_INTERP, size_t size)
+        __attribute__nonnull__(1);
+
+PARROT_EXPORT
+PARROT_CANNOT_RETURN_NULL
+void * Parrot_gc_allocate_memory_chunk_with_interior_pointers(PARROT_INTERP,
+    size_t size)
+        __attribute__nonnull__(1);
+
+PARROT_EXPORT
+PARROT_CANNOT_RETURN_NULL
+void Parrot_gc_free_memory_chunk(PARROT_INTERP, ARGIN_NULLOK(void *data))
+        __attribute__nonnull__(1);
+
+PARROT_EXPORT
 void Parrot_gc_mark_PMC_alive_fun(PARROT_INTERP, ARGMOD_NULLOK(PMC *obj))
         __attribute__nonnull__(1)
         FUNC_MODIFIES(*obj);
@@ -126,6 +142,21 @@
         FUNC_MODIFIES(*obj);
 
 PARROT_EXPORT
+PARROT_CANNOT_RETURN_NULL
+void * Parrot_gc_reallocate_memory_chunk(PARROT_INTERP,
+    ARGFREE(void *data),
+    size_t newsize)
+        __attribute__nonnull__(1);
+
+PARROT_EXPORT
+PARROT_CANNOT_RETURN_NULL
+void * Parrot_gc_reallocate_memory_chunk_with_interior_pointers(PARROT_INTERP,
+    ARGFREE(void *data),
+    size_t newsize,
+    size_t oldsize)
+        __attribute__nonnull__(1);
+
+PARROT_EXPORT
 unsigned int Parrot_is_blocked_GC_mark(PARROT_INTERP)
         __attribute__nonnull__(1);
 
@@ -305,6 +336,14 @@
        PARROT_ASSERT_ARG(interp))
 #define ASSERT_ARGS_Parrot_block_GC_sweep __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp))
+#define ASSERT_ARGS_Parrot_gc_allocate_memory_chunk \
+     __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+       PARROT_ASSERT_ARG(interp))
+#define ASSERT_ARGS_Parrot_gc_allocate_memory_chunk_with_interior_pointers \
+     __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+       PARROT_ASSERT_ARG(interp))
+#define ASSERT_ARGS_Parrot_gc_free_memory_chunk __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+       PARROT_ASSERT_ARG(interp))
 #define ASSERT_ARGS_Parrot_gc_mark_PMC_alive_fun __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp))
 #define ASSERT_ARGS_Parrot_gc_mark_PObj_alive __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
@@ -313,6 +352,12 @@
 #define ASSERT_ARGS_Parrot_gc_mark_STRING_alive_fun \
      __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp))
+#define ASSERT_ARGS_Parrot_gc_reallocate_memory_chunk \
+     __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+       PARROT_ASSERT_ARG(interp))
+#define ASSERT_ARGS_Parrot_gc_reallocate_memory_chunk_with_interior_pointers \
+     __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+       PARROT_ASSERT_ARG(interp))
 #define ASSERT_ARGS_Parrot_is_blocked_GC_mark __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp))
 #define ASSERT_ARGS_Parrot_is_blocked_GC_sweep __attribute__unused__ int _ASSERT_ARGS_CHECK = (\

Modified: trunk/include/parrot/memory.h
==============================================================================
--- trunk/include/parrot/memory.h	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/include/parrot/memory.h	Mon Feb 22 09:28:39 2010	(r44291)
@@ -1,5 +1,5 @@
 /* memory.h
- *  Copyright (C) 2001-2008, Parrot Foundation.
+ *  Copyright (C) 2001-2010, Parrot Foundation.
  *  SVN Info
  *     $Id$
  *  Overview:
@@ -24,22 +24,39 @@
     __FILE__, __LINE__)
 #define mem_internal_allocate_zeroed_typed(type) \
     (type *)mem__internal_allocate_zeroed(sizeof (type), __FILE__, __LINE__)
+#define mem_internal_allocate_n_zeroed_typed(n, type) \
+    (type *)mem__internal_allocate_zeroed((n) * sizeof (type), __FILE__, __LINE__)
 
 #define mem_internal_realloc(x, y) mem__internal_realloc((x), (y), __FILE__, __LINE__)
 #define mem_internal_realloc_zeroed(p, x, y) mem__internal_realloc_zeroed((p), (x), (y), __FILE__, __LINE__)
+#define mem_internal_realloc_n_zeroed_typed(p, x, y, type) (type *)mem__internal_realloc_zeroed((p), (x) * sizeof (type), (y) * sizeof (type), __FILE__, __LINE__)
 #define mem_internal_free(x) mem__internal_free((x), __FILE__, __LINE__)
 
-#define mem_allocate_new_stash() NULL
-#define mem_allocate_new_stack() NULL
 #define mem_sys_memcopy memcpy
 #define mem_sys_memmove memmove
 
 #define mem_allocate_typed(type)            (type *)mem_sys_allocate(sizeof (type))
-#define mem_allocate_n_typed(n, type)       (type *)mem_sys_allocate((n) * sizeof(type))
+#define mem_allocate_n_typed(n, type)       (type *)mem_sys_allocate((n) * sizeof (type))
 #define mem_allocate_zeroed_typed(type)     (type *)mem_sys_allocate_zeroed(sizeof (type))
-#define mem_allocate_n_zeroed_typed(n, type) (type *)mem_sys_allocate_zeroed((n) * sizeof(type))
-#define mem_realloc_n_typed(p, n, type)     (p) = (type *)mem_sys_realloc((p), (n)*sizeof(type))
-#define mem_copy_n_typed(dest, src, n, type) memcpy((dest), (src), (n)*sizeof(type))
+#define mem_allocate_n_zeroed_typed(n, type) (type *)mem_sys_allocate_zeroed((n) * sizeof (type))
+#define mem_realloc_n_typed(p, n, type)     (p) = (type *)mem_sys_realloc((p), (n) * sizeof (type))
+
+#define mem_gc_allocate_typed(i, type) \
+        (type *)Parrot_gc_allocate_memory_chunk((i), sizeof (type))
+#define mem_gc_allocate_n_typed(i, n, type) \
+        (type *)Parrot_gc_allocate_memory_chunk((i), (n) * sizeof (type))
+#define mem_gc_realloc_n_typed(i, p, n, type) \
+        (type *)Parrot_gc_reallocate_memory_chunk((i), (p), (n) * sizeof (type))
+#define mem_gc_allocate_zeroed_typed(i, type) \
+        (type *)Parrot_gc_allocate_memory_chunk_with_interior_pointers((i), sizeof (type))
+#define mem_gc_allocate_n_zeroed_typed(i, n, type) \
+        (type *)Parrot_gc_allocate_memory_chunk_with_interior_pointers((i), (n) * sizeof (type))
+#define mem_gc_realloc_n_typed_zeroed(i, p, n, o, type) \
+        (type *)Parrot_gc_reallocate_memory_chunk_with_interior_pointers((i), (p), (n) * sizeof (type), (o) * sizeof (type))
+#define mem_gc_free(i, p) \
+        Parrot_gc_free_memory_chunk((i), (p))
+
+#define mem_copy_n_typed(dest, src, n, type) memcpy((dest), (src), (n)*sizeof (type))
 
 /* HEADERIZER BEGIN: src/gc/alloc_memory.c */
 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END.  Your changes will be lost. */

Modified: trunk/include/parrot/oplib.h
==============================================================================
--- trunk/include/parrot/oplib.h	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/include/parrot/oplib.h	Mon Feb 22 09:28:39 2010	(r44291)
@@ -32,7 +32,7 @@
     size_t      op_count;
     op_info_t * op_info_table;
     op_func_t * op_func_table;
-    int (*op_code)(const char * name, int full);
+    int (*op_code)(PARROT_INTERP, const char * name, int full);
 } op_lib_t;
 
 typedef enum {

Modified: trunk/include/parrot/packfile.h
==============================================================================
--- trunk/include/parrot/packfile.h	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/include/parrot/packfile.h	Mon Feb 22 09:28:39 2010	(r44291)
@@ -451,9 +451,10 @@
         __attribute__nonnull__(2);
 
 PARROT_EXPORT
-void PackFile_add_segment(SHIM_INTERP,
+void PackFile_add_segment(PARROT_INTERP,
     ARGMOD(PackFile_Directory *dir),
     ARGIN(PackFile_Segment *seg))
+        __attribute__nonnull__(1)
         __attribute__nonnull__(2)
         __attribute__nonnull__(3)
         FUNC_MODIFIES(*dir);
@@ -470,28 +471,32 @@
         FUNC_MODIFIES(*self);
 
 PARROT_EXPORT
-void PackFile_Annotations_add_group(SHIM_INTERP,
+void PackFile_Annotations_add_group(PARROT_INTERP,
     ARGMOD(PackFile_Annotations *self),
     opcode_t offset)
+        __attribute__nonnull__(1)
         __attribute__nonnull__(2)
         FUNC_MODIFIES(*self);
 
 PARROT_EXPORT
 PARROT_CANNOT_RETURN_NULL
-PackFile_Segment * PackFile_Annotations_new(SHIM_INTERP,
+PackFile_Segment * PackFile_Annotations_new(PARROT_INTERP,
     SHIM(struct PackFile *pf),
     SHIM(STRING *name),
-    NULLOK(int add));
+    NULLOK(int add))
+        __attribute__nonnull__(1);
 
 PARROT_EXPORT
-void PackFile_Constant_destroy(SHIM_INTERP,
+void PackFile_Constant_destroy(PARROT_INTERP,
     ARGMOD_NULLOK(PackFile_Constant *self))
+        __attribute__nonnull__(1)
         FUNC_MODIFIES(*self);
 
 PARROT_EXPORT
 PARROT_MALLOC
 PARROT_CANNOT_RETURN_NULL
-PackFile_Constant * PackFile_Constant_new(SHIM_INTERP);
+PackFile_Constant * PackFile_Constant_new(PARROT_INTERP)
+        __attribute__nonnull__(1);
 
 PARROT_EXPORT
 PARROT_WARN_UNUSED_RESULT
@@ -655,10 +660,11 @@
 PARROT_EXPORT
 PARROT_WARN_UNUSED_RESULT
 PARROT_CANNOT_RETURN_NULL
-PackFile_Segment * PackFile_Segment_new(SHIM_INTERP,
+PackFile_Segment * PackFile_Segment_new(PARROT_INTERP,
     SHIM(PackFile *pf),
     SHIM(STRING *name),
-    NULLOK(int add));
+    NULLOK(int add))
+        __attribute__nonnull__(1);
 
 PARROT_EXPORT
 PARROT_WARN_UNUSED_RESULT
@@ -781,8 +787,9 @@
 void mark_const_subs(PARROT_INTERP)
         __attribute__nonnull__(1);
 
-void PackFile_Annotations_destroy(SHIM_INTERP,
+void PackFile_Annotations_destroy(PARROT_INTERP,
     ARGMOD(PackFile_Segment *seg))
+        __attribute__nonnull__(1)
         __attribute__nonnull__(2)
         FUNC_MODIFIES(*seg);
 
@@ -830,7 +837,8 @@
        PARROT_ASSERT_ARG(interp) \
     , PARROT_ASSERT_ARG(self))
 #define ASSERT_ARGS_PackFile_add_segment __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(dir) \
+       PARROT_ASSERT_ARG(interp) \
+    , PARROT_ASSERT_ARG(dir) \
     , PARROT_ASSERT_ARG(seg))
 #define ASSERT_ARGS_PackFile_Annotations_add_entry \
      __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
@@ -838,10 +846,14 @@
     , PARROT_ASSERT_ARG(self))
 #define ASSERT_ARGS_PackFile_Annotations_add_group \
      __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(self))
-#define ASSERT_ARGS_PackFile_Annotations_new __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
-#define ASSERT_ARGS_PackFile_Constant_destroy __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
-#define ASSERT_ARGS_PackFile_Constant_new __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
+       PARROT_ASSERT_ARG(interp) \
+    , PARROT_ASSERT_ARG(self))
+#define ASSERT_ARGS_PackFile_Annotations_new __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+       PARROT_ASSERT_ARG(interp))
+#define ASSERT_ARGS_PackFile_Constant_destroy __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+       PARROT_ASSERT_ARG(interp))
+#define ASSERT_ARGS_PackFile_Constant_new __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+       PARROT_ASSERT_ARG(interp))
 #define ASSERT_ARGS_PackFile_Constant_pack_size __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp) \
     , PARROT_ASSERT_ARG(self))
@@ -904,7 +916,8 @@
 #define ASSERT_ARGS_PackFile_Segment_dump __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp) \
     , PARROT_ASSERT_ARG(self))
-#define ASSERT_ARGS_PackFile_Segment_new __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
+#define ASSERT_ARGS_PackFile_Segment_new __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+       PARROT_ASSERT_ARG(interp))
 #define ASSERT_ARGS_PackFile_Segment_new_seg __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp) \
     , PARROT_ASSERT_ARG(dir) \
@@ -954,7 +967,8 @@
 #define ASSERT_ARGS_mark_const_subs __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp))
 #define ASSERT_ARGS_PackFile_Annotations_destroy __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(seg))
+       PARROT_ASSERT_ARG(interp) \
+    , PARROT_ASSERT_ARG(seg))
 #define ASSERT_ARGS_PackFile_Annotations_dump __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp) \
     , PARROT_ASSERT_ARG(seg))
@@ -1025,9 +1039,12 @@
 
 PARROT_MALLOC
 PARROT_CANNOT_RETURN_NULL
-char * PF_fetch_cstring(ARGIN(PackFile *pf), ARGIN(const opcode_t **cursor))
+char * PF_fetch_cstring(PARROT_INTERP,
+    ARGIN(PackFile *pf),
+    ARGIN(const opcode_t **cursor))
         __attribute__nonnull__(1)
-        __attribute__nonnull__(2);
+        __attribute__nonnull__(2)
+        __attribute__nonnull__(3);
 
 PARROT_WARN_UNUSED_RESULT
 INTVAL PF_fetch_integer(
@@ -1112,7 +1129,8 @@
 #define ASSERT_ARGS_PackFile_assign_transforms __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(pf))
 #define ASSERT_ARGS_PF_fetch_cstring __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(pf) \
+       PARROT_ASSERT_ARG(interp) \
+    , PARROT_ASSERT_ARG(pf) \
     , PARROT_ASSERT_ARG(cursor))
 #define ASSERT_ARGS_PF_fetch_integer __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(stream))

Modified: trunk/lib/Parrot/Ops2c/Utils.pm
==============================================================================
--- trunk/lib/Parrot/Ops2c/Utils.pm	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/lib/Parrot/Ops2c/Utils.pm	Mon Feb 22 09:28:39 2010	(r44291)
@@ -197,7 +197,7 @@
 
     my ( $op_info, $op_func, $getop );
     $op_info = $op_func = 'NULL';
-    $getop = '( int (*)(const char *, int) )NULL';
+    $getop = '( int (*)(PARROT_INTERP, const char *, int) )NULL';
 
     if ($self->{suffix} eq '') {
         $op_func = $self->{bs} . "op_func_table";
@@ -559,7 +559,7 @@
 
     if ( $self->{suffix} eq '' && !$self->{flag}->{dynamic} ) {
         print $fh <<END_C_2;
-static int get_op(const char * name, int full);
+static int get_op(PARROT_INTERP, const char * name, int full);
 
 END_C_2
     }
@@ -892,9 +892,9 @@
 } HOP;
 static HOP **hop;
 
-static void hop_init(void);
+static void hop_init(PARROT_INTERP);
 static size_t hash_str(const char *str);
-static void store_op(op_info_t *info, int full);
+static void store_op(PARROT_INTERP, op_info_t *info, int full);
 
 /* XXX on changing interpreters, this should be called,
    through a hook */
@@ -923,8 +923,8 @@
     return key;
 }
 
-static void store_op(op_info_t *info, int full) {
-    HOP * const p     = mem_allocate_typed(HOP);
+static void store_op(PARROT_INTERP, op_info_t *info, int full) {
+    HOP * const p     = mem_gc_allocate_zeroed_typed(interp, HOP);
     const size_t hidx =
         hash_str(full ? info->full_name : info->name) % OP_HASH_SIZE;
 
@@ -932,12 +932,12 @@
     p->next   = hop[hidx];
     hop[hidx] = p;
 }
-static int get_op(const char * name, int full) {
+static int get_op(PARROT_INTERP, const char * name, int full) {
     const HOP * p;
     const size_t hidx = hash_str(name) % OP_HASH_SIZE;
     if (!hop) {
-        hop = mem_allocate_n_zeroed_typed(OP_HASH_SIZE,HOP *);
-        hop_init();
+        hop = mem_gc_allocate_n_zeroed_typed(interp, OP_HASH_SIZE,HOP *);
+        hop_init(interp);
     }
     for (p = hop[hidx]; p; p = p->next) {
         if(STREQ(name, full ? p->info->full_name : p->info->name))
@@ -945,16 +945,16 @@
     }
     return -1;
 }
-static void hop_init(void) {
+static void hop_init(PARROT_INTERP) {
     size_t i;
     op_info_t * const info = $self->{bs}op_lib.op_info_table;
     /* store full names */
     for (i = 0; i < $self->{bs}op_lib.op_count; i++)
-        store_op(info + i, 1);
+        store_op(interp, info + i, 1);
     /* plus one short name */
     for (i = 0; i < $self->{bs}op_lib.op_count; i++)
-        if (get_op(info[i].name, 0) == -1)
-            store_op(info + i, 0);
+        if (get_op(interp, info[i].name, 0) == -1)
+            store_op(interp, info + i, 0);
 }
 static void hop_deinit(void)
 {

Modified: trunk/src/call/args.c
==============================================================================
--- trunk/src/call/args.c	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/src/call/args.c	Mon Feb 22 09:28:39 2010	(r44291)
@@ -2861,7 +2861,7 @@
         if (cur == 8) {
             void * const old_values = values;
 
-            values     = mem_allocate_n_typed(8, void *);
+            values     = mem_gc_allocate_n_typed(interp, 8, void *);
             memcpy(values, old_values, 8 * sizeof (void *));
             Parrot_gc_free_fixed_size_storage(interp,
                 8 * sizeof (void *), old_values);
@@ -2875,7 +2875,8 @@
             cur          &= ~0xfff;
         }
 
-        mem_realloc_n_typed(values, cur, void *);
+        values = mem_gc_realloc_n_typed_zeroed(interp, values,
+                cur, resize_threshold, void *);
 
         SETATTR_CallContext_returns_values(interp, self, values);
         SETATTR_CallContext_returns_size(interp, self, size);

Modified: trunk/src/call/ops.c
==============================================================================
--- trunk/src/call/ops.c	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/src/call/ops.c	Mon Feb 22 09:28:39 2010	(r44291)
@@ -142,7 +142,7 @@
         interp->runloop_jmp_free_list = jump_point->prev;
     }
     else
-        jump_point = mem_allocate_typed(Parrot_runloop);
+        jump_point = mem_gc_allocate_zeroed_typed(interp, Parrot_runloop);
 
     jump_point->prev        = interp->current_runloop;
     interp->current_runloop = jump_point;

Modified: trunk/src/debug.c
==============================================================================
--- trunk/src/debug.c	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/src/debug.c	Mon Feb 22 09:28:39 2010	(r44291)
@@ -1010,7 +1010,7 @@
     TRACEDEB_MSG("Parrot_debugger_init");
 
     if (! interp->pdb) {
-        PDB_t          *pdb      = mem_allocate_zeroed_typed(PDB_t);
+        PDB_t          *pdb      = mem_gc_allocate_zeroed_typed(interp, PDB_t);
         Parrot_Interp   debugger = Parrot_new(interp);
         interp->pdb              = pdb;
         debugger->pdb            = pdb;
@@ -1018,9 +1018,9 @@
         pdb->debugger            = debugger;
 
         /* Allocate space for command line buffers, NUL terminated c strings */
-        pdb->cur_command = (char *)mem_sys_allocate_zeroed(DEBUG_CMD_BUFFER_LENGTH + 1);
-        pdb->last_command = (char *)mem_sys_allocate_zeroed(DEBUG_CMD_BUFFER_LENGTH + 1);
-        pdb->file = mem_allocate_zeroed_typed(PDB_file_t);
+        pdb->cur_command = mem_gc_allocate_n_typed(interp, DEBUG_CMD_BUFFER_LENGTH + 1, char);
+        pdb->last_command = mem_gc_allocate_n_typed(interp, DEBUG_CMD_BUFFER_LENGTH + 1, char);
+        pdb->file = mem_gc_allocate_zeroed_typed(interp, PDB_file_t);
     }
 
     /* PDB_disassemble(interp, NULL); */
@@ -1053,10 +1053,10 @@
     PARROT_ASSERT(pdb);
     PARROT_ASSERT(pdb->debugee == interp);
 
-    mem_sys_free(pdb->last_command);
-    mem_sys_free(pdb->cur_command);
+    mem_gc_free(interp, pdb->last_command);
+    mem_gc_free(interp, pdb->cur_command);
 
-    mem_sys_free(pdb);
+    mem_gc_free(interp, pdb);
     interp->pdb = NULL;
 }
 
@@ -1619,7 +1619,7 @@
     }
 
     /* Allocate new condition */
-    condition = mem_allocate_zeroed_typed(PDB_condition_t);
+    condition = mem_gc_allocate_zeroed_typed(interp, PDB_condition_t);
 
     condition->type = cond_argleft | cond_type;
 
@@ -1632,7 +1632,7 @@
 
             if (cond_argright != cond_argleft) {
                 Parrot_io_eprintf(interp->pdb->debugger, "Register types don't agree\n");
-                mem_sys_free(condition);
+                mem_gc_free(interp, condition);
                 return NULL;
             }
 
@@ -1641,28 +1641,28 @@
             reg_number = (int)get_uint(&command, 0);
             if (auxcmd == command) {
                 Parrot_io_eprintf(interp->pdb->debugger, "Invalid register\n");
-                    mem_sys_free(condition);
+                    mem_gc_free(interp, condition);
                     return NULL;
             }
 
             if (reg_number < 0) {
                 Parrot_io_eprintf(interp->pdb->debugger, "Out-of-bounds register\n");
-                mem_sys_free(condition);
+                mem_gc_free(interp, condition);
                 return NULL;
             }
 
-            condition->value         = mem_allocate_typed(int);
+            condition->value         = mem_gc_allocate_typed(interp, int);
             *(int *)condition->value = reg_number;
         }
         /* If the first argument was an integer */
         else if (condition->type & PDB_cond_int) {
             /* This must be either an integer constant or register */
-            condition->value             = mem_allocate_typed(INTVAL);
+            condition->value             = mem_gc_allocate_typed(interp, INTVAL);
             *(INTVAL *)condition->value  = (INTVAL)atoi(command);
             condition->type             |= PDB_cond_const;
         }
         else if (condition->type & PDB_cond_num) {
-            condition->value               = mem_allocate_typed(FLOATVAL);
+            condition->value               = mem_gc_allocate_typed(interp, FLOATVAL);
             *(FLOATVAL *)condition->value  = (FLOATVAL)atof(command);
             condition->type               |= PDB_cond_const;
         }
@@ -1682,7 +1682,7 @@
             /* TT #1259: Need to figure out what to do in this case.
              * For the time being, we just bail. */
             Parrot_io_eprintf(interp->pdb->debugger, "Can't compare PMC with constant\n");
-            mem_sys_free(condition);
+            mem_gc_free(interp, condition);
             return NULL;
         }
 
@@ -1805,7 +1805,7 @@
 
     TRACEDEB_MSG("PDB_set_break allocate breakpoint");
     /* Allocate the new break point */
-    newbreak = mem_allocate_zeroed_typed(PDB_breakpoint_t);
+    newbreak = mem_gc_allocate_zeroed_typed(interp, PDB_breakpoint_t);
 
     if (command) {
         /*command = skip_command(command);*/
@@ -2098,7 +2098,7 @@
         }
         bp_id = breakpoint->id;
         /* Kill the breakpoint */
-        mem_sys_free(breakpoint);
+        mem_gc_free(interp, breakpoint);
 
         Parrot_io_eprintf(interp->pdb->debugger, "Breakpoint %li deleted\n", bp_id);
     }
@@ -2115,7 +2115,7 @@
 */
 
 void
-PDB_delete_condition(SHIM_INTERP, ARGMOD(PDB_breakpoint_t *breakpoint))
+PDB_delete_condition(PARROT_INTERP, ARGMOD(PDB_breakpoint_t *breakpoint))
 {
     ASSERT_ARGS(PDB_delete_condition)
     if (breakpoint->condition->value) {
@@ -2128,12 +2128,12 @@
         }
         else {
             /* 'value' is a float or an int, so we can just free it */
-            mem_sys_free(breakpoint->condition->value);
+            mem_gc_free(interp, breakpoint->condition->value);
             breakpoint->condition->value = NULL;
         }
     }
 
-    mem_sys_free(breakpoint->condition);
+    mem_gc_free(interp, breakpoint->condition);
     breakpoint->condition = NULL;
 }
 
@@ -2391,7 +2391,7 @@
 
 /*
 
-=item C<char * PDB_escape(const char *string, UINTVAL length)>
+=item C<char * PDB_escape(PARROT_INTERP, const char *string, UINTVAL length)>
 
 Escapes C<">, C<\r>, C<\n>, C<\t>, C<\a> and C<\\>.
 
@@ -2405,7 +2405,7 @@
 PARROT_CAN_RETURN_NULL
 PARROT_MALLOC
 char *
-PDB_escape(ARGIN(const char *string), UINTVAL length)
+PDB_escape(PARROT_INTERP, ARGIN(const char *string), UINTVAL length)
 {
     ASSERT_ARGS(PDB_escape)
     const char *end;
@@ -2418,7 +2418,7 @@
     if (!string)
         return NULL;
 
-    fill = _new = (char *)mem_sys_allocate(length * 2 + 1);
+    fill = _new = mem_gc_allocate_n_typed(interp, length * 2 + 1, char);
 
     for (; string < end; string++) {
         switch (*string) {
@@ -2578,7 +2578,7 @@
                 (info->jump & PARROT_JUMP_RELATIVE)) {
                 if (file) {
                     dest[size++] = 'L';
-                    i            = PDB_add_label(file, op, op[j]);
+                    i            = PDB_add_label(interp, file, op, op[j]);
                 }
                 else if (code_start) {
                     dest[size++] = 'O';
@@ -2618,12 +2618,12 @@
                     Parrot_str_to_cstring(interp, interp->code->
                            const_table->constants[op[j]]->u.string);
                 char * const escaped =
-                    PDB_escape(unescaped, interp->code->const_table->
+                    PDB_escape(interp, unescaped, interp->code->const_table->
                            constants[op[j]]->u.string->strlen);
                 if (escaped) {
                     strcpy(&dest[size], escaped);
                     size += strlen(escaped);
-                    mem_sys_free(escaped);
+                    mem_gc_free(interp, escaped);
                 }
                 Parrot_str_free_cstring(unescaped);
             }
@@ -2849,8 +2849,8 @@
 
     TRACEDEB_MSG("PDB_disassemble");
 
-    pfile = mem_allocate_zeroed_typed(PDB_file_t);
-    pline = mem_allocate_zeroed_typed(PDB_line_t);
+    pfile = mem_gc_allocate_zeroed_typed(interp, PDB_file_t);
+    pline = mem_gc_allocate_zeroed_typed(interp, PDB_line_t);
 
     /* If we already got a source, free it */
     if (pdb->file) {
@@ -2860,7 +2860,7 @@
 
     pfile->line   = pline;
     pline->number = 1;
-    pfile->source = (char *)mem_sys_allocate(default_size);
+    pfile->source = mem_gc_allocate_n_typed(interp, default_size, char);
 
     alloced       = space = default_size;
     code_end      = pc + interp->code->base.size;
@@ -2870,7 +2870,7 @@
         if (space < default_size) {
             alloced += default_size;
             space   += default_size;
-            pfile->source = (char *)mem_sys_realloc(pfile->source, alloced);
+            pfile->source = mem_gc_realloc_n_typed(interp, pfile->source, alloced, char);
         }
 
         size = PDB_disassemble_op(interp, pfile->source + pfile->size,
@@ -2887,7 +2887,7 @@
         pc += n;
 
         /* Prepare for next line */
-        newline              = mem_allocate_typed(PDB_line_t);
+        newline              = mem_gc_allocate_zeroed_typed(interp, PDB_line_t);
         newline->label       = NULL;
         newline->next        = NULL;
         newline->number      = pline->number + 1;
@@ -2925,8 +2925,8 @@
 
 /*
 
-=item C<long PDB_add_label(PDB_file_t *file, const opcode_t *cur_opcode,
-opcode_t offset)>
+=item C<long PDB_add_label(PARROT_INTERP, PDB_file_t *file, const opcode_t
+*cur_opcode, opcode_t offset)>
 
 Add a label to the label list.
 
@@ -2935,7 +2935,8 @@
 */
 
 long
-PDB_add_label(ARGMOD(PDB_file_t *file), ARGIN(const opcode_t *cur_opcode),
+PDB_add_label(PARROT_INTERP, ARGMOD(PDB_file_t *file),
+        ARGIN(const opcode_t *cur_opcode),
         opcode_t offset)
 {
     ASSERT_ARGS(PDB_add_label)
@@ -2951,7 +2952,7 @@
 
     /* Allocate a new label */
     label        = file->label;
-    _new         = mem_allocate_typed(PDB_label_t);
+    _new         = mem_gc_allocate_zeroed_typed(interp, PDB_label_t);
     _new->opcode = cur_opcode + offset;
     _new->next   = NULL;
 
@@ -2981,7 +2982,7 @@
 */
 
 void
-PDB_free_file(SHIM_INTERP, ARGIN_NULLOK(PDB_file_t *file))
+PDB_free_file(PARROT_INTERP, ARGIN_NULLOK(PDB_file_t *file))
 {
     ASSERT_ARGS(PDB_free_file)
     while (file) {
@@ -2992,7 +2993,7 @@
 
         while (line) {
             PDB_line_t * const nline = line->next;
-            mem_sys_free(line);
+            mem_gc_free(interp, line);
             line = nline;
         }
 
@@ -3002,19 +3003,19 @@
         while (label) {
             PDB_label_t * const nlabel = label->next;
 
-            mem_sys_free(label);
+            mem_gc_free(interp, label);
             label  = nlabel;
         }
 
         /* Free the remaining allocated portions of the file structure */
         if (file->sourcefilename)
-            mem_sys_free(file->sourcefilename);
+            mem_gc_free(interp, file->sourcefilename);
 
         if (file->source)
-            mem_sys_free(file->source);
+            mem_gc_free(interp, file->source);
 
         nfile = file->next;
-        mem_sys_free(file);
+        mem_gc_free(interp, file);
         file  = nfile;
     }
 }
@@ -3070,10 +3071,10 @@
         return;
     }
 
-    pfile = mem_allocate_zeroed_typed(PDB_file_t);
-    pline = mem_allocate_zeroed_typed(PDB_line_t);
+    pfile = mem_gc_allocate_zeroed_typed(interp, PDB_file_t);
+    pline = mem_gc_allocate_zeroed_typed(interp, PDB_line_t);
 
-    pfile->source = (char *)mem_sys_allocate(1024);
+    pfile->source = mem_gc_allocate_n_typed(interp, 1024, char);
     pfile->line   = pline;
     pline->number = 1;
 
@@ -3083,8 +3084,8 @@
     while ((c = fgetc(file)) != EOF) {
         /* Grow it */
         if (++size == 1024) {
-            pfile->source = (char *)mem_sys_realloc(pfile->source,
-                                            (size_t)pfile->size + 1024);
+            pfile->source = mem_gc_realloc_n_typed(interp, pfile->source,
+                                            (size_t)pfile->size + 1024, char);
             size = 0;
         }
         pfile->source[pfile->size] = (char)c;
@@ -3094,7 +3095,7 @@
         if (c == '\n') {
             /* If the line has an opcode move to the next one,
                otherwise leave it with NULL to skip it. */
-            PDB_line_t *newline = mem_allocate_zeroed_typed(PDB_line_t);
+            PDB_line_t *newline = mem_gc_allocate_zeroed_typed(interp, PDB_line_t);
 
             if (PDB_hasinstruction(pfile->source + pline->source_offset)) {
                 size_t n      = interp->op_info_table[*pc].op_count;

Modified: trunk/src/dynext.c
==============================================================================
--- trunk/src/dynext.c	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/src/dynext.c	Mon Feb 22 09:28:39 2010	(r44291)
@@ -587,10 +587,10 @@
         if (d->n_libs != s->n_libs) {
             INTVAL i;
             if (d->all_op_libs)
-                d->all_op_libs = (op_lib_t **)mem_sys_realloc(d->all_op_libs,
+                d->all_op_libs = (op_lib_t **)mem_internal_realloc(d->all_op_libs,
                     sizeof (op_lib_t *) * s->n_libs);
             else
-                d->all_op_libs = (op_lib_t **)mem_sys_allocate(sizeof (op_lib_t *) *
+                d->all_op_libs = (op_lib_t **)mem_internal_allocate(sizeof (op_lib_t *) *
                     s->n_libs);
             for (i = d->n_libs; i < s->n_libs; ++i)
                 d->all_op_libs[i] = s->all_op_libs[i];

Modified: trunk/src/dynpmc/gdbmhash.pmc
==============================================================================
--- trunk/src/dynpmc/gdbmhash.pmc	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/src/dynpmc/gdbmhash.pmc	Mon Feb 22 09:28:39 2010	(r44291)
@@ -73,7 +73,7 @@
 }
 
 
-pmclass GDBMHash provides hash dynpmc lib gdbm {
+pmclass GDBMHash provides hash dynpmc lib gdbm auto_attrs {
     ATTR struct GDBM_FH *db_handle;
 
 /*
@@ -100,18 +100,14 @@
     }
 
     VTABLE void init() {
-        Parrot_GDBMHash_attributes *attrs =
-            mem_allocate_zeroed_typed(Parrot_GDBMHash_attributes);
-
-        attrs->db_handle = mem_allocate_zeroed_typed(GDBM_FH);
-        PMC_data(SELF)   = attrs;
+        Parrot_GDBMHash_attributes *attrs = PARROT_GDBMHASH(SELF);
+        attrs->db_handle = mem_gc_allocate_zeroed_typed(INTERP, GDBM_FH);
         PObj_custom_destroy_SET(SELF);
     }
 
     VTABLE void destroy() {
-        mem_sys_free(
-                ((Parrot_GDBMHash_attributes *)PMC_data(SELF))->db_handle);
-        mem_sys_free(PMC_data(SELF));
+        Parrot_GDBMHash_attributes *attrs = PARROT_GDBMHASH(SELF);
+        mem_gc_free(INTERP, attrs->db_handle);
         PMC_data(SELF) = NULL;
     }
 

Modified: trunk/src/dynpmc/rational.pmc
==============================================================================
--- trunk/src/dynpmc/rational.pmc	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/src/dynpmc/rational.pmc	Mon Feb 22 09:28:39 2010	(r44291)
@@ -227,7 +227,7 @@
 
 */
 
-pmclass Rational dynpmc provides scalar {
+pmclass Rational dynpmc provides scalar auto_attrs {
     ATTR struct RATIONAL *rational;
 /*
 
@@ -265,9 +265,8 @@
     VTABLE void init() {
       #ifdef PARROT_HAS_GMP
         Parrot_Rational_attributes *attrs =
-            mem_allocate_zeroed_typed(Parrot_Rational_attributes);
-        PMC_data(SELF)     = attrs;
-        PMC_rational(SELF) = (RATIONAL *)malloc(sizeof (RATIONAL));
+            PARROT_RATIONAL(SELF);
+        attrs->rational = mem_gc_allocate_zeroed_typed(INTERP, RATIONAL);
         mpq_init(RT(SELF));
         PObj_custom_destroy_SET(SELF);
       #endif
@@ -300,9 +299,7 @@
     VTABLE void destroy() {
       #ifdef PARROT_HAS_GMP
         mpq_clear(RT(SELF));
-        mem_sys_free(RT(SELF));
-        mem_sys_free(PMC_data(SELF));
-        PMC_data(SELF) = NULL;
+        mem_gc_free(INTERP, RT(SELF));
       #else
         RAISE_EXCEPTION
       #endif

Modified: trunk/src/embed.c
==============================================================================
--- trunk/src/embed.c	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/src/embed.c	Mon Feb 22 09:28:39 2010	(r44291)
@@ -465,7 +465,7 @@
         INTVAL wanted     = program_size;
         size_t read_result;
 
-        program_code = mem_allocate_n_typed(chunk_size, char);
+        program_code = mem_gc_allocate_n_typed(interp, chunk_size, char);
         cursor       = program_code;
         program_size = 0;
 
@@ -476,7 +476,8 @@
                 break;
 
             chunk_size   = 1024;
-            mem_realloc_n_typed(program_code, program_size + chunk_size, char);
+            program_code = mem_gc_realloc_n_typed(interp, program_code,
+                    program_size + chunk_size, char);
 
             if (!program_code) {
                 Parrot_io_eprintf(interp,
@@ -494,7 +495,7 @@
              "Parrot VM: Problem reading packfile from PIO:  code %d.\n",
                         ferror(io));
             fclose(io);
-            mem_sys_free(program_code);
+            mem_gc_free(interp, program_code);
             return NULL;
         }
 
@@ -982,7 +983,7 @@
 Parrot_disassemble(PARROT_INTERP, ARGIN(const char *outfile), Parrot_disassemble_options options)
 {
     PDB_line_t *line;
-    PDB_t * const pdb   = mem_allocate_zeroed_typed(PDB_t);
+    PDB_t * const pdb   = mem_gc_allocate_typed(interp, PDB_t);
     int num_mappings    = 0;
     int curr_mapping    = 0;
     int op_code_seq_num = 0;
@@ -1089,7 +1090,7 @@
     PackFile * const pf = PackFile_new(interp, 0);
     static opcode_t program_code[2];
 
-    program_code[0] = interp->op_lib->op_code("enternative", 0);
+    program_code[0] = interp->op_lib->op_code(interp, "enternative", 0);
     program_code[1] = 0; /* end */
 
     pf->cur_cs = (PackFile_ByteCode *)

Modified: trunk/src/events.c
==============================================================================
--- trunk/src/events.c	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/src/events.c	Mon Feb 22 09:28:39 2010	(r44291)
@@ -472,7 +472,7 @@
 Parrot_schedule_event(PARROT_INTERP, ARGMOD(parrot_event* ev))
 {
     ASSERT_ARGS(Parrot_schedule_event)
-    QUEUE_ENTRY * const entry = mem_allocate_typed(QUEUE_ENTRY);
+    QUEUE_ENTRY * const entry = mem_internal_allocate_typed(QUEUE_ENTRY);
     entry->next = NULL;
     ev->interp  = interp;
     entry->data = ev;
@@ -509,8 +509,8 @@
 schedule_signal_event(int signum)
 {
     ASSERT_ARGS(schedule_signal_event)
-    parrot_event* const ev    = mem_allocate_typed(parrot_event);
-    QUEUE_ENTRY * const entry = mem_allocate_typed(QUEUE_ENTRY);
+    parrot_event* const ev    = mem_internal_allocate_typed(parrot_event);
+    QUEUE_ENTRY * const entry = mem_internal_allocate_typed(QUEUE_ENTRY);
 
     entry->next  = NULL;
     entry->type  = QUEUE_ENTRY_TYPE_EVENT;
@@ -541,7 +541,7 @@
         FLOATVAL interval, int repeat, ARGIN_NULLOK(PMC *sub), parrot_event_type_enum typ)
 {
     ASSERT_ARGS(Parrot_new_timer_event)
-    parrot_event* const ev = mem_allocate_typed(parrot_event);
+    parrot_event* const ev = mem_internal_allocate_typed(parrot_event);
 
     const FLOATVAL now = Parrot_floatval_time();
 
@@ -573,8 +573,8 @@
 Parrot_new_cb_event(PARROT_INTERP, ARGIN(PMC *cbi), ARGIN(char *ext))
 {
     ASSERT_ARGS(Parrot_new_cb_event)
-    parrot_event* const ev    = mem_allocate_typed(parrot_event);
-    QUEUE_ENTRY*  const entry = mem_allocate_typed(QUEUE_ENTRY);
+    parrot_event* const ev    = mem_internal_allocate_typed(parrot_event);
+    QUEUE_ENTRY*  const entry = mem_internal_allocate_typed(QUEUE_ENTRY);
 
     entry->next = NULL;
     entry->data = ev;
@@ -636,7 +636,7 @@
 Parrot_new_terminate_event(PARROT_INTERP)
 {
     ASSERT_ARGS(Parrot_new_terminate_event)
-    parrot_event* const ev = mem_allocate_typed(parrot_event);
+    parrot_event* const ev = mem_internal_allocate_typed(parrot_event);
     ev->type = EVENT_TYPE_TERMINATE;
     Parrot_schedule_event(interp, ev);
 }
@@ -658,9 +658,9 @@
 {
     ASSERT_ARGS(Parrot_new_suspend_for_gc_event)
     QUEUE_ENTRY *qe;
-    parrot_event* const ev = mem_allocate_typed(parrot_event);
+    parrot_event* const ev = mem_internal_allocate_typed(parrot_event);
     ev->type = EVENT_TYPE_SUSPEND_FOR_GC;
-    qe = mem_allocate_typed(QUEUE_ENTRY);
+    qe = mem_internal_allocate_typed(QUEUE_ENTRY);
     qe->next = NULL;
     qe->data = ev;
     qe->type = QUEUE_ENTRY_TYPE_EVENT;
@@ -685,7 +685,7 @@
 Parrot_kill_event_loop(PARROT_INTERP)
 {
     ASSERT_ARGS(Parrot_kill_event_loop)
-    parrot_event* const ev = mem_allocate_typed(parrot_event);
+    parrot_event* const ev = mem_internal_allocate_typed(parrot_event);
     ev->type = EVENT_TYPE_EVENT_TERMINATE;
     Parrot_schedule_event(interp, ev);
 }
@@ -786,13 +786,13 @@
             }
             break;
           default:
-            mem_sys_free(entry);
-            mem_sys_free(event);
+            mem_internal_free(entry);
+            mem_internal_free(event);
         }
         break;
       default:
-        mem_sys_free(entry);
-        mem_sys_free(event);
+        mem_internal_free(entry);
+        mem_internal_free(event);
         exit_fatal(1, "Unknown event to broadcast");
         break;
     }
@@ -828,11 +828,12 @@
     ASSERT_ARGS(store_io_event)
     if (!ios->alloced) {
         ios->alloced = 16;
-        ios->events  = mem_allocate_n_zeroed_typed(ios->alloced, parrot_event *);
+        ios->events  = mem_internal_allocate_n_zeroed_typed(ios->alloced, parrot_event *);
     }
     else if (ios->n >= ios->alloced) {
+        ios->events  = mem_internal_realloc_n_zeroed_typed(ios->events,
+                ios->alloced * 2, ios->alloced, parrot_event *);
         ios->alloced *= 2;
-        mem_realloc_n_typed(ios->events, ios->alloced, parrot_event *);
     }
     ios->events[ios->n++] = ev;
 }
@@ -965,7 +966,7 @@
                                 PMC * const pio = buf.ev->u.io_event.pio;
                                 const int fd = Parrot_io_getfd(buf.ev->interp, pio);
                                 if (FD_ISSET(fd, &act_rfds)) {
-                                    mem_sys_free(buf.ev);
+                                    mem_internal_free(buf.ev);
                                     break;
                                 }
                                 FD_SET(fd, &act_rfds);
@@ -1048,7 +1049,7 @@
 {
     ASSERT_ARGS(Parrot_event_add_io_event)
     io_thread_msg buf;
-    parrot_event * const event = mem_allocate_typed(parrot_event);
+    parrot_event * const event = mem_internal_allocate_typed(parrot_event);
 
     event->type   = EVENT_TYPE_IO;
     event->interp = interp;
@@ -1093,11 +1094,11 @@
 dup_entry(ARGIN(const QUEUE_ENTRY *entry))
 {
     ASSERT_ARGS(dup_entry)
-    QUEUE_ENTRY * const new_entry = mem_allocate_typed(QUEUE_ENTRY);
+    QUEUE_ENTRY * const new_entry = mem_internal_allocate_typed(QUEUE_ENTRY);
 
     new_entry->next = NULL;
     new_entry->type = entry->type;
-    new_entry->data = mem_allocate_typed(parrot_event);
+    new_entry->data = mem_internal_allocate_typed(parrot_event);
 
     mem_sys_memcopy(new_entry->data, entry->data, sizeof (parrot_event));
     return new_entry;
@@ -1188,13 +1189,13 @@
         }
         PARROT_ASSERT(event);
         if (event->type == EVENT_TYPE_NONE) {
-            mem_sys_free(entry);
-            mem_sys_free(event);
+            mem_internal_free(entry);
+            mem_internal_free(event);
             continue;
         }
         else if (event->type == EVENT_TYPE_EVENT_TERMINATE) {
-            mem_sys_free(entry);
-            mem_sys_free(event);
+            mem_internal_free(entry);
+            mem_internal_free(event);
 
             return 0;
         }
@@ -1323,7 +1324,7 @@
         QUEUE_ENTRY  * const entry = wait_for_entry(tq);
         parrot_event * const event = (parrot_event*)entry->data;
 
-        mem_sys_free(entry);
+        mem_internal_free(entry);
         edebug((stderr, "got ev %s head : %p\n", et(event), tq->head));
         next = do_event(interp, event, next);
     }
@@ -1497,7 +1498,7 @@
         fprintf(stderr, "Unhandled event type %d\n", (int)event->type);
         break;
     }
-    mem_sys_free(event);
+    mem_internal_free(event);
     return next;
 }
 
@@ -1533,7 +1534,7 @@
         QUEUE_ENTRY  * const entry = pop_entry(tq);
         parrot_event * const event = (parrot_event*)entry->data;
 
-        mem_sys_free(entry);
+        mem_internal_free(entry);
         next = do_event(interp, event, next);
     }
 

Modified: trunk/src/exit.c
==============================================================================
--- trunk/src/exit.c	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/src/exit.c	Mon Feb 22 09:28:39 2010	(r44291)
@@ -42,7 +42,7 @@
 {
     ASSERT_ARGS(Parrot_on_exit)
 
-    handler_node_t * const new_node = mem_allocate_typed(handler_node_t);
+    handler_node_t * const new_node = mem_internal_allocate_typed(handler_node_t);
 
     new_node->function        = function;
     new_node->arg             = arg;
@@ -88,7 +88,7 @@
         handler_node_t * const next = node->next;
 
         (node->function)(interp, status, node->arg);
-        mem_sys_free(node);
+        mem_internal_free(node);
         node = next;
     }
 

Modified: trunk/src/frame_builder.c
==============================================================================
--- trunk/src/frame_builder.c	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/src/frame_builder.c	Mon Feb 22 09:28:39 2010	(r44291)
@@ -82,7 +82,7 @@
         GETATTR_ManagedStruct_custom_free_priv(interp , pmc, freepriv);
         GETATTR_ManagedStruct_custom_clone_priv(interp, pmc, clonepriv);
         if (freepriv) {
-            void *tmp = mem_sys_allocate(sizeof (struct jit_buffer_private_data));
+            void *tmp = mem_gc_allocate_zeroed_typed(interp, struct jit_buffer_private_data);
             memcpy(tmp, freepriv, sizeof (struct jit_buffer_private_data));
             SETATTR_ManagedStruct_custom_free_priv(interp, rv , tmp);
             if (clonepriv == freepriv) {
@@ -92,7 +92,7 @@
             }
         }
         if (clonepriv) {
-            void *tmp = mem_sys_allocate(sizeof (struct jit_buffer_private_data));
+            void *tmp = mem_gc_allocate_zeroed_typed(interp, struct jit_buffer_private_data);
             memcpy(tmp, clonepriv, sizeof (struct jit_buffer_private_data));
             SETATTR_ManagedStruct_custom_clone_priv(interp, rv , tmp);
         }

Modified: trunk/src/gc/alloc_memory.c
==============================================================================
--- trunk/src/gc/alloc_memory.c	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/src/gc/alloc_memory.c	Mon Feb 22 09:28:39 2010	(r44291)
@@ -1,5 +1,5 @@
 /*
-Copyright (C) 2001-2009, Parrot Foundation.
+Copyright (C) 2001-2010, Parrot Foundation.
 $Id$
 
 =head1 NAME
@@ -260,8 +260,6 @@
     return ptr;
 }
 
-#if 0
-
 /*
 
 =item C<void * mem__internal_realloc_zeroed(void *from, size_t size, size_t
@@ -284,15 +282,15 @@
 {
     ASSERT_ARGS(mem__internal_realloc_zeroed)
     void * const ptr = realloc(from, size);
-#  ifdef DETAIL_MEMORY_DEBUG
+#ifdef DETAIL_MEMORY_DEBUG
     fprintf(stderr, "internal free of %p (realloc -- %i bytes) (%s/%d)\n",
             from, size, file, line);
     fprintf(stderr, "Internal malloc %i at %p (%s/%d)\n",
             size, ptr, file, line);
-#  else
+#else
     UNUSED(file);
     UNUSED(line);
-#  endif
+#endif
     if (!ptr)
         PANIC_OUT_OF_MEM(size);
     if (size > old_size)
@@ -301,8 +299,6 @@
     return ptr;
 }
 
-#endif
-
 /*
 
 =item C<void mem_sys_free(void *from)>

Modified: trunk/src/gc/api.c
==============================================================================
--- trunk/src/gc/api.c	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/src/gc/api.c	Mon Feb 22 09:28:39 2010	(r44291)
@@ -1,5 +1,5 @@
 /*
-Copyright (C) 2001-2009, Parrot Foundation.
+Copyright (C) 2001-2010, Parrot Foundation.
 $Id$
 
 =head1 NAME
@@ -272,7 +272,54 @@
       default:
         /*die horribly because of invalid GC core specified*/
         break;
-    }
+    };
+
+    /* Assertions that GC subsystem has complete API */
+    PARROT_ASSERT(interp->gc_sys->finalize_gc_system);
+    PARROT_ASSERT(interp->gc_sys->destroy_child_interp);
+
+    PARROT_ASSERT(interp->gc_sys->do_gc_mark);
+    PARROT_ASSERT(interp->gc_sys->compact_string_pool);
+
+    PARROT_ASSERT(interp->gc_sys->mark_special);
+    PARROT_ASSERT(interp->gc_sys->pmc_needs_early_collection);
+
+    PARROT_ASSERT(interp->gc_sys->allocate_pmc_header);
+    PARROT_ASSERT(interp->gc_sys->free_pmc_header);
+
+    PARROT_ASSERT(interp->gc_sys->allocate_string_header);
+    PARROT_ASSERT(interp->gc_sys->free_string_header);
+
+    PARROT_ASSERT(interp->gc_sys->allocate_bufferlike_header);
+    PARROT_ASSERT(interp->gc_sys->free_bufferlike_header);
+
+    PARROT_ASSERT(interp->gc_sys->allocate_pmc_attributes);
+    PARROT_ASSERT(interp->gc_sys->free_pmc_attributes);
+
+    PARROT_ASSERT(interp->gc_sys->allocate_string_storage);
+    PARROT_ASSERT(interp->gc_sys->reallocate_string_storage);
+
+    PARROT_ASSERT(interp->gc_sys->allocate_buffer_storage);
+    PARROT_ASSERT(interp->gc_sys->reallocate_buffer_storage);
+
+    PARROT_ASSERT(interp->gc_sys->allocate_fixed_size_storage);
+    PARROT_ASSERT(interp->gc_sys->free_fixed_size_storage);
+
+    PARROT_ASSERT(interp->gc_sys->allocate_memory_chunk);
+    PARROT_ASSERT(interp->gc_sys->reallocate_memory_chunk);
+    PARROT_ASSERT(interp->gc_sys->allocate_memory_chunk_with_interior_pointers);
+    PARROT_ASSERT(interp->gc_sys->reallocate_memory_chunk_with_interior_pointers);
+    PARROT_ASSERT(interp->gc_sys->free_memory_chunk);
+
+    PARROT_ASSERT(interp->gc_sys->block_mark);
+    PARROT_ASSERT(interp->gc_sys->unblock_mark);
+    PARROT_ASSERT(interp->gc_sys->is_blocked_mark);
+
+    PARROT_ASSERT(interp->gc_sys->block_sweep);
+    PARROT_ASSERT(interp->gc_sys->unblock_sweep);
+    PARROT_ASSERT(interp->gc_sys->is_blocked_sweep);
+
+    PARROT_ASSERT(interp->gc_sys->get_gc_info);
 }
 
 /*
@@ -293,7 +340,7 @@
     if (interp->gc_sys->finalize_gc_system)
         interp->gc_sys->finalize_gc_system(interp);
 
-    mem_sys_free(interp->gc_sys);
+    mem_internal_free(interp->gc_sys);
     interp->gc_sys = NULL;
 }
 
@@ -392,7 +439,7 @@
     if (PMC_sync(pmc))
         return;
 
-    PMC_sync(pmc) = mem_allocate_typed(Sync);
+    PMC_sync(pmc) = mem_gc_allocate_zeroed_typed(interp, Sync);
 
     if (!PMC_sync(pmc))
         Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_ALLOCATION_ERROR,
@@ -650,6 +697,75 @@
     interp->gc_sys->free_fixed_size_storage(interp, size, data);
 }
 
+/*
+
+=item C<void * Parrot_gc_allocate_memory_chunk(PARROT_INTERP, size_t size)>
+
+=item C<void * Parrot_gc_reallocate_memory_chunk(PARROT_INTERP, void *data,
+size_t newsize)>
+
+=item C<void Parrot_gc_free_memory_chunk(PARROT_INTERP, void *data)>
+
+=item C<void *
+Parrot_gc_allocate_memory_chunk_with_interior_pointers(PARROT_INTERP, size_t
+size)>
+
+=item C<void *
+Parrot_gc_reallocate_memory_chunk_with_interior_pointers(PARROT_INTERP, void
+*data, size_t newsize, size_t oldsize)>
+
+TODO Write docu.
+
+*/
+
+PARROT_EXPORT
+PARROT_CANNOT_RETURN_NULL
+void *
+Parrot_gc_allocate_memory_chunk(PARROT_INTERP, size_t size)
+{
+    ASSERT_ARGS(Parrot_gc_allocate_memory_chunk)
+    return interp->gc_sys->allocate_memory_chunk(interp, size);
+}
+
+PARROT_EXPORT
+PARROT_CANNOT_RETURN_NULL
+void *
+Parrot_gc_reallocate_memory_chunk(PARROT_INTERP, ARGFREE(void *data), size_t newsize)
+{
+    ASSERT_ARGS(Parrot_gc_reallocate_memory_chunk)
+    return interp->gc_sys->reallocate_memory_chunk(interp, data, newsize);
+}
+
+PARROT_EXPORT
+PARROT_CANNOT_RETURN_NULL
+void
+Parrot_gc_free_memory_chunk(PARROT_INTERP, ARGIN_NULLOK(void *data))
+{
+    ASSERT_ARGS(Parrot_gc_free_memory_chunk)
+    interp->gc_sys->free_memory_chunk(interp, data);
+}
+
+
+PARROT_EXPORT
+PARROT_CANNOT_RETURN_NULL
+void *
+Parrot_gc_allocate_memory_chunk_with_interior_pointers(PARROT_INTERP, size_t size)
+{
+    ASSERT_ARGS(Parrot_gc_allocate_memory_chunk_with_interior_pointers)
+    return interp->gc_sys->allocate_memory_chunk_with_interior_pointers(interp, size);
+}
+
+PARROT_EXPORT
+PARROT_CANNOT_RETURN_NULL
+void *
+Parrot_gc_reallocate_memory_chunk_with_interior_pointers(PARROT_INTERP,
+        ARGFREE(void *data), size_t newsize, size_t oldsize)
+{
+    ASSERT_ARGS(Parrot_gc_reallocate_memory_chunk_with_interior_pointers)
+    return interp->gc_sys->reallocate_memory_chunk_with_interior_pointers(interp,
+            data, newsize, oldsize);
+}
+
 
 /*
 

Modified: trunk/src/gc/gc_inf.c
==============================================================================
--- trunk/src/gc/gc_inf.c	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/src/gc/gc_inf.c	Mon Feb 22 09:28:39 2010	(r44291)
@@ -524,7 +524,7 @@
     if (size == 0)
         return;
 
-    mem      = (char *)mem_sys_allocate(size);
+    mem      = (char *)mem_internal_allocate(size);
 
     Buffer_bufstart(str) = str->strstart = mem;
     Buffer_buflen(str)   = size;
@@ -536,7 +536,7 @@
     ASSERT_ARGS(gc_inf_reallocate_string_storage)
     char *mem;
 
-    mem      = (char *)mem_sys_realloc(Buffer_bufstart(str), size);
+    mem      = (char *)mem_internal_realloc(Buffer_bufstart(str), size);
 
     Buffer_bufstart(str) = str->strstart = mem;
     Buffer_buflen(str)   = size;
@@ -555,7 +555,7 @@
     if (size == 0)
         return;
 
-    mem      = (char *)mem_sys_allocate(size);
+    mem      = (char *)mem_internal_allocate(size);
 
     Buffer_bufstart(buffer) = mem;
     Buffer_buflen(buffer)   = size;
@@ -567,7 +567,7 @@
     ASSERT_ARGS(gc_inf_reallocate_buffer_storage)
     char *mem;
 
-    mem = (char *)mem_sys_realloc(Buffer_bufstart(buffer), size);
+    mem = (char *)mem_internal_realloc(Buffer_bufstart(buffer), size);
 
     Buffer_bufstart(buffer) = mem;
     Buffer_buflen(buffer)   = size;
@@ -586,7 +586,7 @@
 {
     ASSERT_ARGS(gc_inf_free_fixed_size_storage)
     if (data)
-        free(data);
+        mem_internal_free(data);
 }
 
 /*

Modified: trunk/src/gc/gc_ms.c
==============================================================================
--- trunk/src/gc/gc_ms.c	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/src/gc/gc_ms.c	Mon Feb 22 09:28:39 2010	(r44291)
@@ -56,6 +56,12 @@
 static Buffer * gc_ms_allocate_bufferlike_header(PARROT_INTERP, size_t size)
         __attribute__nonnull__(1);
 
+static void * gc_ms_allocate_memory_chunk(PARROT_INTERP, size_t size)
+        __attribute__nonnull__(1);
+
+static void * gc_ms_allocate_memory_chunk_zeroed(PARROT_INTERP, size_t size)
+        __attribute__nonnull__(1);
+
 PARROT_CAN_RETURN_NULL
 static PMC* gc_ms_allocate_pmc_header(PARROT_INTERP, UINTVAL flags)
         __attribute__nonnull__(1);
@@ -101,6 +107,9 @@
         __attribute__nonnull__(2)
         FUNC_MODIFIES(*obj);
 
+static void gc_ms_free_memory_chunk(PARROT_INTERP, ARGFREE(void *data))
+        __attribute__nonnull__(1);
+
 static void gc_ms_free_pmc_header(PARROT_INTERP, ARGMOD(PMC *pmc))
         __attribute__nonnull__(1)
         __attribute__nonnull__(2)
@@ -156,6 +165,17 @@
         __attribute__nonnull__(2)
         FUNC_MODIFIES(*buffer);
 
+static void * gc_ms_reallocate_memory_chunk(PARROT_INTERP,
+    ARGFREE(void *data),
+    size_t newsize)
+        __attribute__nonnull__(1);
+
+static void * gc_ms_reallocate_memory_chunk_zeroed(PARROT_INTERP,
+    ARGFREE(void *data),
+    size_t newsize,
+    size_t oldsize)
+        __attribute__nonnull__(1);
+
 static void gc_ms_reallocate_string_storage(PARROT_INTERP,
     ARGMOD(STRING *str),
     size_t newsize)
@@ -207,6 +227,11 @@
 #define ASSERT_ARGS_gc_ms_allocate_bufferlike_header \
      __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp))
+#define ASSERT_ARGS_gc_ms_allocate_memory_chunk __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+       PARROT_ASSERT_ARG(interp))
+#define ASSERT_ARGS_gc_ms_allocate_memory_chunk_zeroed \
+     __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+       PARROT_ASSERT_ARG(interp))
 #define ASSERT_ARGS_gc_ms_allocate_pmc_header __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp))
 #define ASSERT_ARGS_gc_ms_allocate_string_header __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
@@ -231,6 +256,8 @@
 #define ASSERT_ARGS_gc_ms_free_bufferlike_header __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp) \
     , PARROT_ASSERT_ARG(obj))
+#define ASSERT_ARGS_gc_ms_free_memory_chunk __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+       PARROT_ASSERT_ARG(interp))
 #define ASSERT_ARGS_gc_ms_free_pmc_header __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp) \
     , PARROT_ASSERT_ARG(pmc))
@@ -262,6 +289,11 @@
      __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp) \
     , PARROT_ASSERT_ARG(buffer))
+#define ASSERT_ARGS_gc_ms_reallocate_memory_chunk __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+       PARROT_ASSERT_ARG(interp))
+#define ASSERT_ARGS_gc_ms_reallocate_memory_chunk_zeroed \
+     __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+       PARROT_ASSERT_ARG(interp))
 #define ASSERT_ARGS_gc_ms_reallocate_string_storage \
      __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp) \
@@ -305,7 +337,7 @@
 {
     ASSERT_ARGS(Parrot_gc_ms_init)
 
-    interp->mem_pools = mem_allocate_zeroed_typed(Memory_Pools);
+    interp->mem_pools = mem_internal_allocate_zeroed_typed(Memory_Pools);
     interp->mem_pools->num_sized          = 0;
     interp->mem_pools->num_attribs        = 0;
     interp->mem_pools->attrib_pools       = NULL;
@@ -342,6 +374,15 @@
     interp->gc_sys->allocate_fixed_size_storage = gc_ms_allocate_fixed_size_storage;
     interp->gc_sys->free_fixed_size_storage     = gc_ms_free_fixed_size_storage;
 
+    /* We don't distinguish between chunk and chunk_with_pointers */
+    interp->gc_sys->allocate_memory_chunk   = gc_ms_allocate_memory_chunk;
+    interp->gc_sys->reallocate_memory_chunk = gc_ms_reallocate_memory_chunk;
+    interp->gc_sys->allocate_memory_chunk_with_interior_pointers
+                = gc_ms_allocate_memory_chunk_zeroed;
+    interp->gc_sys->reallocate_memory_chunk_with_interior_pointers
+                = gc_ms_reallocate_memory_chunk_zeroed;
+    interp->gc_sys->free_memory_chunk       = gc_ms_free_memory_chunk;
+
     interp->gc_sys->block_mark      = gc_ms_block_GC_mark;
     interp->gc_sys->unblock_mark    = gc_ms_unblock_GC_mark;
     interp->gc_sys->is_blocked_mark = gc_ms_is_blocked_GC_mark;
@@ -379,7 +420,7 @@
     Parrot_gc_destroy_memory_pools(interp, interp->mem_pools);
 
     /* mem subsystem is dead now */
-    mem_sys_free(interp->mem_pools);
+    mem_internal_free(interp->mem_pools);
     interp->mem_pools = NULL;
 }
 
@@ -721,7 +762,7 @@
     PMC_data(pmc) = attrs;
     return attrs;
 #else
-    void * const data =  mem_sys_allocate_zeroed(attr_size);
+    void * const data =  gc_ms_allocate_memory_chunk(attr_size);
     PMC_data(pmc) = data;
     return data;
 #endif
@@ -751,7 +792,7 @@
         const size_t idx = item_size - sizeof (void *);
         gc_ms_free_attributes_from_pool(interp, pools[idx], data);
 #else
-        mem_sys_free(PMC_data(pmc));
+        gc_ms_free_memory_chunk(PMC_data(pmc));
         PMC_data(pmc) = NULL;
 #endif
     }
@@ -1049,6 +1090,65 @@
     gc_ms_free_attributes_from_pool(interp, pools[idx], data);
 }
 
+/*
+
+=item C<static void * gc_ms_allocate_memory_chunk(PARROT_INTERP, size_t size)>
+
+=item C<static void * gc_ms_reallocate_memory_chunk(PARROT_INTERP, void *data,
+size_t newsize)>
+
+=item C<static void * gc_ms_allocate_memory_chunk_zeroed(PARROT_INTERP, size_t
+size)>
+
+=item C<static void * gc_ms_reallocate_memory_chunk_zeroed(PARROT_INTERP, void
+*data, size_t newsize, size_t oldsize)>
+
+=item C<static void gc_ms_free_memory_chunk(PARROT_INTERP, void *data)>
+
+TODO Write docu.
+
+*/
+
+static void *
+gc_ms_allocate_memory_chunk(PARROT_INTERP, size_t size)
+{
+    ASSERT_ARGS(gc_ms_allocate_memory_chunk)
+    return mem_sys_allocate(size);
+}
+
+static void *
+gc_ms_reallocate_memory_chunk(PARROT_INTERP, ARGFREE(void *data), size_t newsize)
+{
+    ASSERT_ARGS(gc_ms_reallocate_memory_chunk)
+    return mem_sys_realloc(data, newsize);
+}
+
+static void *
+gc_ms_allocate_memory_chunk_zeroed(PARROT_INTERP, size_t size)
+{
+    ASSERT_ARGS(gc_ms_allocate_memory_chunk_zeroed)
+    /* FIXME UB of realloc to clear allocated memory */
+    return mem_sys_realloc(NULL, size);
+}
+
+static void *
+gc_ms_reallocate_memory_chunk_zeroed(PARROT_INTERP, ARGFREE(void *data),
+        size_t newsize, size_t oldsize)
+{
+    ASSERT_ARGS(gc_ms_reallocate_memory_chunk_zeroed)
+    void * const ptr = realloc(data, newsize);
+    if (newsize > oldsize)
+        memset((char*)ptr + oldsize, 0, newsize - oldsize);
+    return ptr;
+}
+
+static void
+gc_ms_free_memory_chunk(PARROT_INTERP, ARGFREE(void *data))
+{
+    ASSERT_ARGS(gc_ms_free_memory_chunk)
+    mem_sys_free(data);
+}
+
 
 /*
 

Modified: trunk/src/gc/gc_private.h
==============================================================================
--- trunk/src/gc/gc_private.h	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/src/gc/gc_private.h	Mon Feb 22 09:28:39 2010	(r44291)
@@ -134,6 +134,13 @@
     void* (*allocate_fixed_size_storage)(PARROT_INTERP, size_t size);
     void (*free_fixed_size_storage)(PARROT_INTERP, size_t size, void *);
 
+    void* (*allocate_memory_chunk)(PARROT_INTERP, size_t size);
+    void* (*reallocate_memory_chunk)(PARROT_INTERP, void *data, size_t newsize);
+    void* (*allocate_memory_chunk_with_interior_pointers)(PARROT_INTERP, size_t size);
+    void* (*reallocate_memory_chunk_with_interior_pointers)(PARROT_INTERP, void *data,
+            size_t oldsize, size_t newsize);
+    void (*free_memory_chunk)(PARROT_INTERP, void *data);
+
     void (*block_mark)(PARROT_INTERP);
     void (*unblock_mark)(PARROT_INTERP);
     unsigned int (*is_blocked_mark)(PARROT_INTERP);

Modified: trunk/src/interp/inter_create.c
==============================================================================
--- trunk/src/interp/inter_create.c	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/src/interp/inter_create.c	Mon Feb 22 09:28:39 2010	(r44291)
@@ -122,7 +122,7 @@
     Interp *interp;
 
     /* Get an empty interpreter from system memory */
-    interp = mem_allocate_zeroed_typed(Interp);
+    interp = mem_internal_allocate_zeroed_typed(Interp);
 
     interp->lo_var_ptr = NULL;
 
@@ -156,9 +156,9 @@
     interp->current_runloop_level = 0;
 
     /* Allocate IMCC info */
-    IMCC_INFO(interp) = mem_allocate_zeroed_typed(imc_info_t);
+    IMCC_INFO(interp) = mem_internal_allocate_zeroed_typed(imc_info_t);
 
-    interp->gc_sys           = mem_allocate_zeroed_typed(GC_Subsystem);
+    interp->gc_sys           = mem_internal_allocate_zeroed_typed(GC_Subsystem);
     interp->gc_sys->sys_type = parent
                                     ? parent->gc_sys->sys_type
                                     : PARROT_GC_DEFAULT_TYPE;

Modified: trunk/src/io/buffer.c
==============================================================================
--- trunk/src/io/buffer.c	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/src/io/buffer.c	Mon Feb 22 09:28:39 2010	(r44291)
@@ -99,14 +99,14 @@
     buffer_size = Parrot_io_get_buffer_size(interp, filehandle);
 
     if (buffer_start && (buffer_flags & PIO_BF_MALLOC)) {
-        mem_sys_free(buffer_start);
+        mem_gc_free(interp, buffer_start);
         Parrot_io_set_buffer_start(interp, filehandle, NULL);
         Parrot_io_set_buffer_next(interp, filehandle, NULL);
         buffer_start = buffer_next = NULL;
     }
 
     if (buffer_size > 0) {
-        buffer_start = buffer_next = (unsigned char *)mem_sys_allocate(buffer_size);
+        buffer_start = buffer_next = mem_gc_allocate_n_typed(interp, buffer_size, unsigned char);
         Parrot_io_set_buffer_start(interp, filehandle, buffer_start);
         Parrot_io_set_buffer_next(interp, filehandle, buffer_next);
         buffer_flags |= PIO_BF_MALLOC;

Modified: trunk/src/io/core.c
==============================================================================
--- trunk/src/io/core.c	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/src/io/core.c	Mon Feb 22 09:28:39 2010	(r44291)
@@ -64,12 +64,12 @@
     }
 
 
-    interp->piodata = mem_allocate_typed(ParrotIOData);
+    interp->piodata = mem_gc_allocate_zeroed_typed(interp, ParrotIOData);
     if (interp->piodata == NULL)
         Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_PIO_ERROR,
             "PIO alloc piodata failure.");
     interp->piodata->table         =
-        (PMC **)mem_sys_allocate_zeroed(PIO_NR_OPEN * sizeof (PMC *));
+            mem_gc_allocate_n_zeroed_typed(interp, PIO_NR_OPEN, PMC *);
 
     if (!interp->piodata->table)
         Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_PIO_ERROR,
@@ -95,9 +95,9 @@
     /*
      * TODO free IO of std-handles
      */
-    mem_sys_free(interp->piodata->table);
+    mem_gc_free(interp, interp->piodata->table);
     interp->piodata->table = NULL;
-    mem_sys_free(interp->piodata);
+    mem_gc_free(interp, interp->piodata);
     interp->piodata = NULL;
 
 }

Modified: trunk/src/multidispatch.c
==============================================================================
--- trunk/src/multidispatch.c	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/src/multidispatch.c	Mon Feb 22 09:28:39 2010	(r44291)
@@ -1278,14 +1278,14 @@
     const INTVAL num_values = VTABLE_elements(interp, values);
     const INTVAL name_len   = name ? strlen(name) + 1: 0;
     const size_t id_size    = num_values * sizeof (INTVAL) + name_len;
-    INTVAL *type_ids        = (INTVAL *)mem_sys_allocate(id_size);
+    INTVAL *type_ids        = mem_gc_allocate_n_typed(interp, num_values + name_len, INTVAL);
     STRING *key;
     INTVAL  i;
 
     for (i = 0; i < num_values; i++) {
         const INTVAL id = VTABLE_type(interp, VTABLE_get_pmc_keyed_int(interp, values, i));
         if (id == 0) {
-            mem_sys_free(type_ids);
+            mem_gc_free(interp, type_ids);
             return NULL;
         }
 
@@ -1296,7 +1296,7 @@
         strcpy((char *)(type_ids + num_values), name);
 
     key = Parrot_str_new(interp, (char *)type_ids, id_size);
-    mem_sys_free(type_ids);
+    mem_gc_free(interp, type_ids);
 
     return key;
 }
@@ -1378,7 +1378,7 @@
     const INTVAL num_types  = VTABLE_elements(interp, types);
     const INTVAL name_len   = name ? strlen(name) + 1: 0;
     const size_t id_size    = num_types * sizeof (INTVAL) + name_len;
-    INTVAL * const type_ids = (INTVAL *)mem_sys_allocate(id_size);
+    INTVAL * const type_ids = mem_gc_allocate_n_typed(interp, num_types + name_len, INTVAL);
 
     STRING *key;
     INTVAL  i;
@@ -1387,7 +1387,7 @@
         const INTVAL id = VTABLE_get_integer_keyed_int(interp, types, i);
 
         if (id == 0) {
-            mem_sys_free(type_ids);
+            mem_gc_free(interp, type_ids);
             return NULL;
         }
 
@@ -1399,7 +1399,7 @@
 
     key = Parrot_str_new(interp, (char *)type_ids, id_size);
 
-    mem_sys_free(type_ids);
+    mem_gc_free(interp, type_ids);
     return key;
 }
 

Modified: trunk/src/oo.c
==============================================================================
--- trunk/src/oo.c	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/src/oo.c	Mon Feb 22 09:28:39 2010	(r44291)
@@ -720,7 +720,7 @@
 init_object_cache(PARROT_INTERP)
 {
     ASSERT_ARGS(init_object_cache)
-    Caches * const mc = interp->caches = mem_allocate_zeroed_typed(Caches);
+    Caches * const mc = interp->caches = mem_gc_allocate_zeroed_typed(interp, Caches);
     mc->idx = NULL;
 }
 
@@ -749,8 +749,8 @@
             invalidate_type_caches(interp, i);
     }
 
-    mem_sys_free(mc->idx);
-    mem_sys_free(mc);
+    mem_gc_free(interp, mc->idx);
+    mem_gc_free(interp, mc);
 }
 
 
@@ -783,12 +783,12 @@
         Meth_cache_entry *e = mc->idx[type][i];
         while (e) {
             Meth_cache_entry * const next = e->next;
-            mem_sys_free(e);
+            mem_gc_free(interp, e);
             e = next;
         }
     }
 
-    mem_sys_free(mc->idx[type]);
+    mem_gc_free(interp, mc->idx[type]);
     mc->idx[type] = NULL;
 }
 
@@ -929,19 +929,18 @@
 
     if (type >= mc->mc_size) {
         if (mc->idx) {
-            mc->idx = (Meth_cache_entry ***)mem_sys_realloc_zeroed(mc->idx,
-                sizeof (Meth_cache_entry ***) * (type + 1),
-                sizeof (Meth_cache_entry ***) * mc->mc_size);
+            mc->idx = mem_gc_realloc_n_typed_zeroed(interp, mc->idx,
+                    type + 1, mc->mc_size, Meth_cache_entry**);
         }
         else {
-            mc->idx = mem_allocate_n_zeroed_typed(type + 1, Meth_cache_entry**);
+            mc->idx = mem_gc_allocate_n_zeroed_typed(interp, type + 1, Meth_cache_entry**);
         }
         mc->mc_size = type + 1;
     }
 
     if (mc->idx[type] == NULL) {
-        mc->idx[type] = (Meth_cache_entry **)mem_sys_allocate_zeroed(
-            sizeof (Meth_cache_entry *) * TBL_SIZE);
+        mc->idx[type] = mem_gc_allocate_n_zeroed_typed(interp,
+                TBL_SIZE, Meth_cache_entry*);
     }
 
     e   = mc->idx[type][bits];
@@ -952,7 +951,7 @@
 
     if (!e) {
         /* when here no or no correct entry was at [bits] */
-        e     = mem_allocate_typed(Meth_cache_entry);
+        e     = mem_gc_allocate_typed(interp, Meth_cache_entry);
 
         mc->idx[type][bits] = e;
 

Modified: trunk/src/packfile.c
==============================================================================
--- trunk/src/packfile.c	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/src/packfile.c	Mon Feb 22 09:28:39 2010	(r44291)
@@ -47,10 +47,11 @@
 
 PARROT_WARN_UNUSED_RESULT
 PARROT_CANNOT_RETURN_NULL
-static PackFile_Segment * byte_code_new(SHIM_INTERP,
+static PackFile_Segment * byte_code_new(PARROT_INTERP,
     SHIM(PackFile *pf),
     SHIM(STRING *name),
-    SHIM(int add));
+    SHIM(int add))
+        __attribute__nonnull__(1);
 
 PARROT_WARN_UNUSED_RESULT
 PARROT_CANNOT_RETURN_NULL
@@ -72,10 +73,11 @@
 
 PARROT_MALLOC
 PARROT_CANNOT_RETURN_NULL
-static PackFile_Segment * const_new(SHIM_INTERP,
+static PackFile_Segment * const_new(PARROT_INTERP,
     SHIM(PackFile *pf),
     SHIM(STRING *name),
-    SHIM(int add));
+    SHIM(int add))
+        __attribute__nonnull__(1);
 
 PARROT_WARN_UNUSED_RESULT
 PARROT_CANNOT_RETURN_NULL
@@ -91,8 +93,9 @@
         __attribute__nonnull__(5)
         FUNC_MODIFIES(*dir);
 
-static void default_destroy(ARGMOD(PackFile_Segment *self))
+static void default_destroy(PARROT_INTERP, ARGMOD(PackFile_Segment *self))
         __attribute__nonnull__(1)
+        __attribute__nonnull__(2)
         FUNC_MODIFIES(*self);
 
 static void default_dump(PARROT_INTERP, ARGIN(const PackFile_Segment *self))
@@ -113,11 +116,12 @@
 
 PARROT_WARN_UNUSED_RESULT
 PARROT_CAN_RETURN_NULL
-static const opcode_t * default_unpack(
+static const opcode_t * default_unpack(PARROT_INTERP,
     ARGMOD(PackFile_Segment *self),
     ARGIN(const opcode_t *cursor))
         __attribute__nonnull__(1)
         __attribute__nonnull__(2)
+        __attribute__nonnull__(3)
         FUNC_MODIFIES(*self);
 
 static void directory_destroy(PARROT_INTERP, ARGMOD(PackFile_Segment *self))
@@ -132,10 +136,11 @@
 
 PARROT_WARN_UNUSED_RESULT
 PARROT_CANNOT_RETURN_NULL
-static PackFile_Segment * directory_new(SHIM_INTERP,
+static PackFile_Segment * directory_new(PARROT_INTERP,
     SHIM(PackFile *pf),
     SHIM(STRING *name),
-    SHIM(int add));
+    SHIM(int add))
+        __attribute__nonnull__(1);
 
 PARROT_WARN_UNUSED_RESULT
 PARROT_CANNOT_RETURN_NULL
@@ -210,10 +215,11 @@
 
 PARROT_WARN_UNUSED_RESULT
 PARROT_CANNOT_RETURN_NULL
-static PackFile_Segment * fixup_new(SHIM_INTERP,
+static PackFile_Segment * fixup_new(PARROT_INTERP,
     SHIM(PackFile *pf),
     SHIM(STRING *name),
-    SHIM(int add));
+    SHIM(int add))
+        __attribute__nonnull__(1);
 
 PARROT_WARN_UNUSED_RESULT
 PARROT_CANNOT_RETURN_NULL
@@ -267,7 +273,8 @@
         __attribute__nonnull__(1)
         FUNC_MODIFIES(*header);
 
-static void pf_debug_destroy(SHIM_INTERP, ARGMOD(PackFile_Segment *self))
+static void pf_debug_destroy(PARROT_INTERP, ARGMOD(PackFile_Segment *self))
+        __attribute__nonnull__(1)
         __attribute__nonnull__(2)
         FUNC_MODIFIES(*self);
 
@@ -278,10 +285,11 @@
 
 PARROT_WARN_UNUSED_RESULT
 PARROT_CANNOT_RETURN_NULL
-static PackFile_Segment * pf_debug_new(SHIM_INTERP,
+static PackFile_Segment * pf_debug_new(PARROT_INTERP,
     SHIM(PackFile *pf),
     SHIM(STRING *name),
-    SHIM(int add));
+    SHIM(int add))
+        __attribute__nonnull__(1);
 
 PARROT_WARN_UNUSED_RESULT
 PARROT_CANNOT_RETURN_NULL
@@ -341,7 +349,8 @@
 #define ASSERT_ARGS_byte_code_destroy __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp) \
     , PARROT_ASSERT_ARG(self))
-#define ASSERT_ARGS_byte_code_new __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
+#define ASSERT_ARGS_byte_code_new __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+       PARROT_ASSERT_ARG(interp))
 #define ASSERT_ARGS_clone_constant __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp) \
     , PARROT_ASSERT_ARG(old_const))
@@ -351,14 +360,16 @@
 #define ASSERT_ARGS_const_destroy __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp) \
     , PARROT_ASSERT_ARG(self))
-#define ASSERT_ARGS_const_new __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
+#define ASSERT_ARGS_const_new __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+       PARROT_ASSERT_ARG(interp))
 #define ASSERT_ARGS_create_seg __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp) \
     , PARROT_ASSERT_ARG(dir) \
     , PARROT_ASSERT_ARG(name) \
     , PARROT_ASSERT_ARG(file_name))
 #define ASSERT_ARGS_default_destroy __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(self))
+       PARROT_ASSERT_ARG(interp) \
+    , PARROT_ASSERT_ARG(self))
 #define ASSERT_ARGS_default_dump __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp) \
     , PARROT_ASSERT_ARG(self))
@@ -368,7 +379,8 @@
 #define ASSERT_ARGS_default_packed_size __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(self))
 #define ASSERT_ARGS_default_unpack __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(self) \
+       PARROT_ASSERT_ARG(interp) \
+    , PARROT_ASSERT_ARG(self) \
     , PARROT_ASSERT_ARG(cursor))
 #define ASSERT_ARGS_directory_destroy __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp) \
@@ -376,7 +388,8 @@
 #define ASSERT_ARGS_directory_dump __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp) \
     , PARROT_ASSERT_ARG(self))
-#define ASSERT_ARGS_directory_new __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
+#define ASSERT_ARGS_directory_new __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+       PARROT_ASSERT_ARG(interp))
 #define ASSERT_ARGS_directory_pack __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp) \
     , PARROT_ASSERT_ARG(self) \
@@ -407,7 +420,8 @@
 #define ASSERT_ARGS_fixup_destroy __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp) \
     , PARROT_ASSERT_ARG(self))
-#define ASSERT_ARGS_fixup_new __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
+#define ASSERT_ARGS_fixup_new __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+       PARROT_ASSERT_ARG(interp))
 #define ASSERT_ARGS_fixup_pack __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp) \
     , PARROT_ASSERT_ARG(self) \
@@ -432,11 +446,13 @@
 #define ASSERT_ARGS_PackFile_set_header __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(header))
 #define ASSERT_ARGS_pf_debug_destroy __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(self))
+       PARROT_ASSERT_ARG(interp) \
+    , PARROT_ASSERT_ARG(self))
 #define ASSERT_ARGS_pf_debug_dump __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp) \
     , PARROT_ASSERT_ARG(self))
-#define ASSERT_ARGS_pf_debug_new __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
+#define ASSERT_ARGS_pf_debug_new __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+       PARROT_ASSERT_ARG(interp))
 #define ASSERT_ARGS_pf_debug_pack __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(self) \
     , PARROT_ASSERT_ARG(cursor))
@@ -536,9 +552,9 @@
     }
 #endif
 
-    mem_sys_free(pf->header);
+    mem_gc_free(interp, pf->header);
     pf->header = NULL;
-    mem_sys_free(pf->dirp);
+    mem_gc_free(interp, pf->dirp);
     pf->dirp   = NULL;
     PackFile_Segment_destroy(interp, &pf->directory.base);
     return;
@@ -1062,8 +1078,8 @@
 
         /* Read in the UUID. We'll put it in a NULL-terminated string, just in
          * case people use it that way. */
-        header->uuid_data = (unsigned char *)
-            mem_sys_allocate(header->uuid_size + 1);
+        header->uuid_data = mem_gc_allocate_n_typed(interp,
+                header->uuid_size + 1, unsigned char);
 
         memcpy(header->uuid_data, packed + PACKFILE_HEADER_BYTES,
                 header->uuid_size);
@@ -1183,11 +1199,12 @@
 
 PARROT_EXPORT
 void
-PackFile_add_segment(SHIM_INTERP, ARGMOD(PackFile_Directory *dir),
+PackFile_add_segment(PARROT_INTERP, ARGMOD(PackFile_Directory *dir),
         ARGIN(PackFile_Segment *seg))
 {
     ASSERT_ARGS(PackFile_add_segment)
-    mem_realloc_n_typed(dir->segments, dir->num_segments+1, PackFile_Segment *);
+    dir->segments = mem_gc_realloc_n_typed_zeroed(interp, dir->segments,
+            dir->num_segments+1, dir->num_segments, PackFile_Segment *);
     dir->segments[dir->num_segments] = seg;
     dir->num_segments++;
     seg->dir = dir;
@@ -1384,8 +1401,8 @@
 PackFile_new(PARROT_INTERP, INTVAL is_mapped)
 {
     ASSERT_ARGS(PackFile_new)
-    PackFile * const pf = mem_allocate_zeroed_typed(PackFile);
-    pf->header          = mem_allocate_zeroed_typed(PackFile_Header);
+    PackFile * const pf = mem_gc_allocate_zeroed_typed(interp, PackFile);
+    pf->header          = mem_gc_allocate_zeroed_typed(interp, PackFile_Header);
     pf->is_mmap_ped     = is_mapped;
     pf->options         = PFOPT_NONE;
 
@@ -1462,8 +1479,8 @@
 
 /*
 
-=item C<static const opcode_t * default_unpack(PackFile_Segment *self, const
-opcode_t *cursor)>
+=item C<static const opcode_t * default_unpack(PARROT_INTERP, PackFile_Segment
+*self, const opcode_t *cursor)>
 
 Unpacks a PackFile given a cursor into PBC.  This is the default unpack.
 
@@ -1474,7 +1491,7 @@
 PARROT_WARN_UNUSED_RESULT
 PARROT_CAN_RETURN_NULL
 static const opcode_t *
-default_unpack(ARGMOD(PackFile_Segment *self), ARGIN(const opcode_t *cursor))
+default_unpack(PARROT_INTERP, ARGMOD(PackFile_Segment *self), ARGIN(const opcode_t *cursor))
 {
     ASSERT_ARGS(default_unpack)
     DECL_CONST_CAST_OF(opcode_t);
@@ -1503,7 +1520,7 @@
     }
 
     /* else allocate mem */
-    self->data = mem_allocate_n_typed(self->size, opcode_t);
+    self->data = mem_gc_allocate_n_typed(interp, self->size, opcode_t);
 
     if (!self->data) {
         Parrot_io_eprintf(NULL, "PackFile_unpack: Unable to allocate data memory!\n");
@@ -1801,7 +1818,7 @@
         (f)(interp, self);
 
     /* destroy self after specific */
-    default_destroy(self);
+    default_destroy(interp, self);
 }
 
 
@@ -1917,7 +1934,7 @@
     PackFile * const pf  = self->pf;
 #endif
 
-    cursor = default_unpack(self, cursor);
+    cursor = default_unpack(interp, self, cursor);
 
     if (!cursor)
         return NULL;
@@ -1980,11 +1997,11 @@
 PARROT_WARN_UNUSED_RESULT
 PARROT_CANNOT_RETURN_NULL
 static PackFile_Segment *
-directory_new(SHIM_INTERP, SHIM(PackFile *pf), SHIM(STRING *name), SHIM(int add))
+directory_new(PARROT_INTERP, SHIM(PackFile *pf), SHIM(STRING *name), SHIM(int add))
 {
     ASSERT_ARGS(directory_new)
 
-    return (PackFile_Segment *)mem_allocate_zeroed_typed(PackFile_Directory);
+    return (PackFile_Segment *)mem_gc_allocate_zeroed_typed(interp, PackFile_Directory);
 }
 
 
@@ -2055,7 +2072,8 @@
     PARROT_ASSERT(pf);
     dir->num_segments = PF_fetch_opcode(pf, &cursor);
     TRACE_PRINTF(("directory_unpack: %ld num_segments\n", dir->num_segments));
-    mem_realloc_n_typed(dir->segments, dir->num_segments, PackFile_Segment *);
+    dir->segments = mem_gc_allocate_n_zeroed_typed(interp,
+            dir->num_segments, PackFile_Segment *);
 
     for (i = 0; i < dir->num_segments; i++) {
         PackFile_Segment *seg;
@@ -2071,13 +2089,13 @@
         TRACE_PRINTF_VAL(("Segment type %d.\n", type));
 
         /* get name */
-        buf = PF_fetch_cstring(pf, &cursor);
+        buf = PF_fetch_cstring(interp, pf, &cursor);
         TRACE_PRINTF_VAL(("Segment name \"%s\".\n", name));
 
         /* create it */
         name = Parrot_str_new(interp, buf, strlen(buf));
         seg = PackFile_Segment_new_seg(interp, dir, type, name, 0);
-        mem_sys_free(buf);
+        mem_gc_free(interp, buf);
 
         seg->file_offset = PF_fetch_opcode(pf, &cursor);
         TRACE_PRINTF_VAL(("Segment file_offset %ld.\n", seg->file_offset));
@@ -2219,7 +2237,7 @@
     }
 
     if (dir->segments) {
-        mem_sys_free(dir->segments);
+        mem_gc_free(interp, dir->segments);
         dir->segments = NULL;
         dir->num_segments = 0;
     }
@@ -2458,10 +2476,10 @@
 PARROT_WARN_UNUSED_RESULT
 PARROT_CANNOT_RETURN_NULL
 PackFile_Segment *
-PackFile_Segment_new(SHIM_INTERP, SHIM(PackFile *pf), SHIM(STRING *name), SHIM(int add))
+PackFile_Segment_new(PARROT_INTERP, SHIM(PackFile *pf), SHIM(STRING *name), SHIM(int add))
 {
     ASSERT_ARGS(PackFile_Segment_new)
-    PackFile_Segment * const seg = mem_allocate_typed(PackFile_Segment);
+    PackFile_Segment * const seg = mem_gc_allocate_zeroed_typed(interp, PackFile_Segment);
 
     return seg;
 }
@@ -2478,7 +2496,7 @@
 
 =over 4
 
-=item C<static void default_destroy(PackFile_Segment *self)>
+=item C<static void default_destroy(PARROT_INTERP, PackFile_Segment *self)>
 
 The default destroy function.  Destroys a PackFile_Segment.
 
@@ -2487,15 +2505,15 @@
 */
 
 static void
-default_destroy(ARGMOD(PackFile_Segment *self))
+default_destroy(PARROT_INTERP, ARGMOD(PackFile_Segment *self))
 {
     ASSERT_ARGS(default_destroy)
     if (!self->pf->is_mmap_ped && self->data) {
-        mem_sys_free(self->data);
+        mem_gc_free(interp, self->data);
         self->data = NULL;
     }
 
-    mem_sys_free(self);
+    mem_gc_free(interp, self);
 }
 
 
@@ -2576,7 +2594,7 @@
         byte_code->prederef.code = NULL;
 
         if (byte_code->prederef.branches) {
-            mem_sys_free(byte_code->prederef.branches);
+            mem_gc_free(interp, byte_code->prederef.branches);
             byte_code->prederef.branches = NULL;
         }
     }
@@ -2601,10 +2619,10 @@
 PARROT_WARN_UNUSED_RESULT
 PARROT_CANNOT_RETURN_NULL
 static PackFile_Segment *
-byte_code_new(SHIM_INTERP, SHIM(PackFile *pf), SHIM(STRING *name), SHIM(int add))
+byte_code_new(PARROT_INTERP, SHIM(PackFile *pf), SHIM(STRING *name), SHIM(int add))
 {
     ASSERT_ARGS(byte_code_new)
-    PackFile_ByteCode * const byte_code = mem_allocate_zeroed_typed(PackFile_ByteCode);
+    PackFile_ByteCode * const byte_code = mem_gc_allocate_zeroed_typed(interp, PackFile_ByteCode);
 
     return (PackFile_Segment *) byte_code;
 }
@@ -2627,7 +2645,7 @@
 */
 
 static void
-pf_debug_destroy(SHIM_INTERP, ARGMOD(PackFile_Segment *self))
+pf_debug_destroy(PARROT_INTERP, ARGMOD(PackFile_Segment *self))
 {
     ASSERT_ARGS(pf_debug_destroy)
     PackFile_Debug * const debug = (PackFile_Debug *) self;
@@ -2635,10 +2653,10 @@
 
     /* Free each mapping. */
     for (i = 0; i < debug->num_mappings; i++)
-        mem_sys_free(debug->mappings[i]);
+        mem_gc_free(interp, debug->mappings[i]);
 
     /* Free mappings pointer array. */
-    mem_sys_free(debug->mappings);
+    mem_gc_free(interp, debug->mappings);
     debug->mappings     = NULL;
     debug->num_mappings = 0;
 }
@@ -2659,12 +2677,13 @@
 PARROT_WARN_UNUSED_RESULT
 PARROT_CANNOT_RETURN_NULL
 static PackFile_Segment *
-pf_debug_new(SHIM_INTERP, SHIM(PackFile *pf), SHIM(STRING *name), SHIM(int add))
+pf_debug_new(PARROT_INTERP, SHIM(PackFile *pf), SHIM(STRING *name), SHIM(int add))
 {
     ASSERT_ARGS(pf_debug_new)
-    PackFile_Debug * const debug = mem_allocate_zeroed_typed(PackFile_Debug);
+    PackFile_Debug * const debug = mem_gc_allocate_zeroed_typed(interp, PackFile_Debug);
 
-    debug->mappings              = mem_allocate_typed(PackFile_DebugFilenameMapping *);
+    debug->mappings              = mem_gc_allocate_zeroed_typed(interp,
+            PackFile_DebugFilenameMapping *);
     debug->mappings[0]           = NULL;
 
     return (PackFile_Segment *)debug;
@@ -2760,14 +2779,14 @@
     debug->num_mappings = PF_fetch_opcode(self->pf, &cursor);
 
     /* Allocate space for mappings vector. */
-    mem_realloc_n_typed(debug->mappings, debug->num_mappings + 1,
-        PackFile_DebugFilenameMapping *);
+    debug->mappings = mem_gc_allocate_n_zeroed_typed(interp,
+            debug->num_mappings + 1, PackFile_DebugFilenameMapping *);
 
     /* Read in each mapping. */
     for (i = 0; i < debug->num_mappings; i++) {
         /* Allocate struct and get offset and filename type. */
         debug->mappings[i]           =
-                mem_allocate_typed(PackFile_DebugFilenameMapping);
+                mem_gc_allocate_zeroed_typed(interp, PackFile_DebugFilenameMapping);
         debug->mappings[i]->offset   = PF_fetch_opcode(self->pf, &cursor);
         debug->mappings[i]->filename = PF_fetch_opcode(self->pf, &cursor);
     }
@@ -2849,7 +2868,7 @@
     /* it exists already, resize it */
     if (cs->debugs) {
         debug = cs->debugs;
-        mem_realloc_n_typed(debug->base.data, size, opcode_t);
+        debug->base.data = mem_gc_realloc_n_typed(interp, debug->base.data, size, opcode_t);
     }
     /* create one */
     else {
@@ -2865,7 +2884,7 @@
         debug = (PackFile_Debug *)PackFile_Segment_new_seg(interp, dir,
                                     PF_DEBUG_SEG, name, add);
 
-        debug->base.data = mem_allocate_n_zeroed_typed(size, opcode_t);
+        debug->base.data = mem_gc_allocate_n_zeroed_typed(interp, size, opcode_t);
         debug->code      = cs;
         cs->debugs       = debug;
     }
@@ -2910,8 +2929,9 @@
     }
 
     /* Allocate space for the extra entry. */
-    mem_realloc_n_typed(debug->mappings, debug->num_mappings + 1,
-        PackFile_DebugFilenameMapping *);
+    debug->mappings = mem_gc_realloc_n_typed(interp,
+            debug->mappings, debug->num_mappings + 1,
+            PackFile_DebugFilenameMapping *);
 
     /* Can it just go on the end? */
     if (debug->num_mappings == 0
@@ -2935,7 +2955,7 @@
     {
         /* Set up new entry and insert it. */
         PackFile_DebugFilenameMapping *mapping =
-                mem_allocate_typed(PackFile_DebugFilenameMapping);
+                mem_gc_allocate_zeroed_typed(interp, PackFile_DebugFilenameMapping);
         STRING *namestr = Parrot_str_new_init(interp, filename, strlen(filename),
                 PARROT_DEFAULT_ENCODING, PARROT_DEFAULT_CHARSET, 0);
         size_t count = ct->const_count;
@@ -2957,7 +2977,8 @@
             /* Not found, create a new one */
             PackFile_Constant             *fnconst;
             ct->const_count   = ct->const_count + 1;
-            mem_realloc_n_typed(ct->constants, ct->const_count, PackFile_Constant *);
+            ct->constants = mem_gc_realloc_n_typed_zeroed(interp, ct->constants,
+                    ct->const_count, ct->const_count - 1, PackFile_Constant *);
 
             fnconst           = PackFile_Constant_new(interp);
             fnconst->type     = PFC_STRING;
@@ -3123,7 +3144,8 @@
     &&  VTABLE_isa(interp, old_const->u.key, _sub)) {
         PMC        *old_sub_pmc, *new_sub_pmc;
         Parrot_Sub_attributes *old_sub,     *new_sub;
-        PackFile_Constant * const ret = mem_allocate_typed(PackFile_Constant);
+        PackFile_Constant * const ret = mem_gc_allocate_zeroed_typed(interp,
+                PackFile_Constant);
 
         ret->type = old_const->type;
         old_sub_pmc   = old_const->u.key;
@@ -3189,7 +3211,8 @@
             INTVAL               const num_consts = ct->const_count;
             INTVAL                     i;
 
-            new_consts = mem_allocate_n_typed(num_consts, PackFile_Constant *);
+            new_consts = mem_gc_allocate_n_zeroed_typed(interp,
+                    num_consts, PackFile_Constant *);
 
             for (i = 0; i < num_consts; ++i)
                 new_consts[i] = clone_constant(interp, old_consts[i]);
@@ -3241,10 +3264,10 @@
 
             for (j = 0; j < table->const_count; ++j) {
                 if (consts[j] != orig_consts[j])
-                    mem_sys_free(consts[j]);
+                    mem_gc_free(interp, consts[j]);
             }
 
-            mem_sys_free(consts);
+            mem_gc_free(interp, consts);
             bucket = bucket->next;
         }
     }
@@ -3283,15 +3306,15 @@
     }
 
     for (i = 0; i < self->fixup_count; i++) {
-        mem_sys_free(self->fixups[i]->name);
+        mem_gc_free(interp, self->fixups[i]->name);
         self->fixups[i]->name = NULL;
 
-        mem_sys_free(self->fixups[i]);
+        mem_gc_free(interp, self->fixups[i]);
         self->fixups[i] = NULL;
     }
 
     if (self->fixup_count) {
-        mem_sys_free(self->fixups);
+        mem_gc_free(interp, self->fixups);
         self->fixups = NULL;
     }
 
@@ -3416,10 +3439,11 @@
 PARROT_WARN_UNUSED_RESULT
 PARROT_CANNOT_RETURN_NULL
 static PackFile_Segment *
-fixup_new(SHIM_INTERP, SHIM(PackFile *pf), SHIM(STRING *name), SHIM(int add))
+fixup_new(PARROT_INTERP, SHIM(PackFile *pf), SHIM(STRING *name), SHIM(int add))
 {
     ASSERT_ARGS(fixup_new)
-    PackFile_FixupTable * const fixup = mem_allocate_zeroed_typed(PackFile_FixupTable);
+    PackFile_FixupTable * const fixup = mem_gc_allocate_zeroed_typed(interp,
+            PackFile_FixupTable);
 
     return (PackFile_Segment *) fixup;
 }
@@ -3463,8 +3487,8 @@
         self->fixup_count));
 
     if (self->fixup_count) {
-        self->fixups = (PackFile_FixupEntry **)mem_sys_allocate_zeroed(
-            self->fixup_count * sizeof (PackFile_FixupEntry *));
+        self->fixups = mem_gc_allocate_n_zeroed_typed(interp,
+            self->fixup_count, PackFile_FixupEntry *);
 
         if (!self->fixups) {
             Parrot_io_eprintf(interp,
@@ -3478,14 +3502,14 @@
     for (i = 0; i < self->fixup_count; i++) {
         PackFile_FixupEntry * const entry           =
                                     self->fixups[i] =
-                                    mem_allocate_typed(PackFile_FixupEntry);
+                                    mem_gc_allocate_zeroed_typed(interp, PackFile_FixupEntry);
 
         entry->type = PF_fetch_opcode(pf, &cursor);
 
         switch (entry->type) {
           case enum_fixup_label:
           case enum_fixup_sub:
-            entry->name   = PF_fetch_cstring(pf, &cursor);
+            entry->name   = PF_fetch_cstring(interp, pf, &cursor);
             entry->offset = PF_fetch_opcode(pf, &cursor);
             TRACE_PRINTF_VAL(("PackFile_FixupTable_unpack(): type %d, "
                     "name %s, offset %ld\n",
@@ -3536,9 +3560,10 @@
     }
 
     i = self->fixup_count++;
-    mem_realloc_n_typed(self->fixups, self->fixup_count, PackFile_FixupEntry *);
+    self->fixups = mem_gc_realloc_n_typed_zeroed(interp,
+            self->fixups, self->fixup_count, i, PackFile_FixupEntry *);
 
-    self->fixups[i]         = mem_allocate_typed(PackFile_FixupEntry);
+    self->fixups[i]         = mem_gc_allocate_zeroed_typed(interp, PackFile_FixupEntry);
     self->fixups[i]->type   = type;
     self->fixups[i]->name   = mem_sys_strdup(label);
     self->fixups[i]->offset = offs;
@@ -3638,7 +3663,7 @@
 
     /* TODO make a hash of all fixups */
     PackFile_Directory  * const dir = interp->code->base.dir;
-    PackFile_FixupEntry * const ep  = mem_allocate_typed(PackFile_FixupEntry);
+    PackFile_FixupEntry * const ep  = mem_gc_allocate_zeroed_typed(interp, PackFile_FixupEntry);
 
     ep->type = type;
     ep->name = name;
@@ -3680,7 +3705,7 @@
     }
 
     if (self->constants) {
-        mem_sys_free(self->constants);
+        mem_gc_free(interp, self->constants);
         self->constants = NULL;
     }
 
@@ -3728,7 +3753,7 @@
     if (self->const_count == 0)
         return cursor;
 
-    self->constants = mem_allocate_n_zeroed_typed(self->const_count,
+    self->constants = mem_gc_allocate_n_zeroed_typed(interp, self->const_count,
                 PackFile_Constant *);
 
     if (!self->constants) {
@@ -3765,10 +3790,11 @@
 PARROT_MALLOC
 PARROT_CANNOT_RETURN_NULL
 static PackFile_Segment *
-const_new(SHIM_INTERP, SHIM(PackFile *pf), SHIM(STRING *name), SHIM(int add))
+const_new(PARROT_INTERP, SHIM(PackFile *pf), SHIM(STRING *name), SHIM(int add))
 {
     ASSERT_ARGS(const_new)
-    PackFile_ConstTable * const const_table = mem_allocate_zeroed_typed(PackFile_ConstTable);
+    PackFile_ConstTable * const const_table =
+            mem_gc_allocate_zeroed_typed(interp, PackFile_ConstTable);
 
     return (PackFile_Segment *)const_table;
 }
@@ -3815,10 +3841,11 @@
 PARROT_MALLOC
 PARROT_CANNOT_RETURN_NULL
 PackFile_Constant *
-PackFile_Constant_new(SHIM_INTERP)
+PackFile_Constant_new(PARROT_INTERP)
 {
     ASSERT_ARGS(PackFile_Constant_new)
-    PackFile_Constant * const self = mem_allocate_zeroed_typed(PackFile_Constant);
+    PackFile_Constant * const self = mem_gc_allocate_zeroed_typed(interp,
+            PackFile_Constant);
 
     self->type = PFC_NONE;
 
@@ -3840,10 +3867,10 @@
 
 PARROT_EXPORT
 void
-PackFile_Constant_destroy(SHIM_INTERP, ARGMOD_NULLOK(PackFile_Constant *self))
+PackFile_Constant_destroy(PARROT_INTERP, ARGMOD_NULLOK(PackFile_Constant *self))
 {
     ASSERT_ARGS(PackFile_Constant_destroy)
-    mem_sys_free(self);
+    mem_gc_free(interp, self);
 }
 
 
@@ -4109,14 +4136,15 @@
 PARROT_EXPORT
 PARROT_CANNOT_RETURN_NULL
 PackFile_Segment *
-PackFile_Annotations_new(SHIM_INTERP, SHIM(struct PackFile *pf),
+PackFile_Annotations_new(PARROT_INTERP, SHIM(struct PackFile *pf),
         SHIM(STRING *name), SHIM(int add))
 {
     ASSERT_ARGS(PackFile_Annotations_new)
 
     /* Allocate annotations structure; create it all zeroed, and we will
      * allocate memory for each of the arrays on demand. */
-    PackFile_Annotations * const seg = mem_allocate_zeroed_typed(PackFile_Annotations);
+    PackFile_Annotations * const seg = mem_gc_allocate_zeroed_typed(interp,
+            PackFile_Annotations);
     return (PackFile_Segment *) seg;
 }
 
@@ -4132,7 +4160,7 @@
 */
 
 void
-PackFile_Annotations_destroy(SHIM_INTERP, ARGMOD(PackFile_Segment *seg))
+PackFile_Annotations_destroy(PARROT_INTERP, ARGMOD(PackFile_Segment *seg))
 {
     ASSERT_ARGS(PackFile_Annotations_destroy)
     PackFile_Annotations *self = (PackFile_Annotations *)seg;
@@ -4141,23 +4169,23 @@
     /* Free any keys. */
     if (self->keys) {
         for (i = 0; i < self->num_keys; i++)
-            mem_sys_free(self->keys[i]);
+            mem_gc_free(interp, self->keys[i]);
 
-        mem_sys_free(self->keys);
+        mem_gc_free(interp, self->keys);
     }
 
     /* Free any groups. */
     if (self->groups) {
         for (i = 0; i < self->num_groups; i++)
-            mem_sys_free(self->groups[i]);
-        mem_sys_free(self->groups);
+            mem_gc_free(interp, self->groups[i]);
+        mem_gc_free(interp, self->groups);
     }
 
     /* Free any entries. */
     if (self->entries) {
         for (i = 0; i < self->num_entries; i++)
-            mem_sys_free(self->entries[i]);
-        mem_sys_free(self->entries);
+            mem_gc_free(interp, self->entries[i]);
+        mem_gc_free(interp, self->entries);
     }
 }
 
@@ -4271,11 +4299,12 @@
     TRACE_PRINTF(("PackFile_Annotations_unpack: Unpacking %ld keys\n",
                   self->num_keys));
 
-    self->keys     = mem_allocate_n_typed(self->num_keys, PackFile_Annotations_Key *);
+    self->keys     = mem_gc_allocate_n_zeroed_typed(interp,
+            self->num_keys, PackFile_Annotations_Key *);
 
     for (i = 0; i < self->num_keys; i++) {
-        PackFile_Annotations_Key * const key =
-            self->keys[i] = mem_allocate_typed(PackFile_Annotations_Key);
+        PackFile_Annotations_Key * const key = self->keys[i] =
+                mem_gc_allocate_zeroed_typed(interp, PackFile_Annotations_Key);
         key->name = PF_fetch_opcode(seg->pf, &cursor);
         key->type = PF_fetch_opcode(seg->pf, &cursor);
         TRACE_PRINTF_VAL(("PackFile_Annotations_unpack: key[%d]/%d name=%s type=%d\n",
@@ -4284,11 +4313,13 @@
 
     /* Unpack groups. */
     self->num_groups = PF_fetch_opcode(seg->pf, &cursor);
-    self->groups     = mem_allocate_n_typed(self->num_groups, PackFile_Annotations_Group *);
+    self->groups     = mem_gc_allocate_n_zeroed_typed(interp,
+            self->num_groups, PackFile_Annotations_Group *);
 
     for (i = 0; i < self->num_groups; i++) {
         PackFile_Annotations_Group * const group =
-            self->groups[i] = mem_allocate_typed(PackFile_Annotations_Group);
+            self->groups[i] = mem_gc_allocate_zeroed_typed(interp,
+                    PackFile_Annotations_Group);
         group->bytecode_offset = PF_fetch_opcode(seg->pf, &cursor);
         group->entries_offset  = PF_fetch_opcode(seg->pf, &cursor);
         TRACE_PRINTF_VAL((
@@ -4299,10 +4330,12 @@
 
     /* Unpack entries. */
     self->num_entries = PF_fetch_opcode(seg->pf, &cursor);
-    self->entries     = mem_allocate_n_typed(self->num_entries, PackFile_Annotations_Entry *);
+    self->entries     = mem_gc_allocate_n_zeroed_typed(interp,
+            self->num_entries, PackFile_Annotations_Entry *);
     for (i = 0; i < self->num_entries; i++) {
         PackFile_Annotations_Entry * const entry =
-            self->entries[i]   = mem_allocate_typed(PackFile_Annotations_Entry);
+            self->entries[i]   = mem_gc_allocate_zeroed_typed(interp,
+                    PackFile_Annotations_Entry);
         entry->bytecode_offset = PF_fetch_opcode(seg->pf, &cursor);
         entry->key             = PF_fetch_opcode(seg->pf, &cursor);
         entry->value           = PF_fetch_opcode(seg->pf, &cursor);
@@ -4411,7 +4444,7 @@
 */
 PARROT_EXPORT
 void
-PackFile_Annotations_add_group(SHIM_INTERP, ARGMOD(PackFile_Annotations *self),
+PackFile_Annotations_add_group(PARROT_INTERP, ARGMOD(PackFile_Annotations *self),
         opcode_t offset)
 {
     ASSERT_ARGS(PackFile_Annotations_add_group)
@@ -4419,15 +4452,16 @@
     /* Allocate extra space for the group in the groups array. */
     if (self->groups)
         self->groups =
-            (PackFile_Annotations_Group **)mem_sys_realloc(self->groups,
-                (1 + self->num_groups) *
-                    sizeof (PackFile_Annotations_Group *));
+            self->groups = mem_gc_realloc_n_typed_zeroed(interp, self->groups,
+                1 + self->num_groups, self->num_groups, PackFile_Annotations_Group *);
     else
-        self->groups = mem_allocate_n_typed(self->num_groups + 1, PackFile_Annotations_Group *);
+        self->groups = mem_gc_allocate_n_typed(interp,
+                1 + self->num_groups, PackFile_Annotations_Group *);
 
     /* Store details. */
     self->groups[self->num_groups]                  =
-                            mem_allocate_typed(PackFile_Annotations_Group);
+                            mem_gc_allocate_zeroed_typed(interp,
+                                    PackFile_Annotations_Group);
     self->groups[self->num_groups]->bytecode_offset = offset;
     self->groups[self->num_groups]->entries_offset  = self->num_entries;
 
@@ -4474,15 +4508,14 @@
     if (key_id == -1) {
         /* We do have it. Add key entry. */
         if (self->keys)
-            self->keys =
-                (PackFile_Annotations_Key **)mem_sys_realloc(self->keys,
-                    (1 + self->num_keys) *
-                        sizeof (PackFile_Annotations_Key *));
+            self->keys = mem_gc_realloc_n_typed_zeroed(interp, self->keys,
+                    1 + self->num_keys, self->num_keys, PackFile_Annotations_Key *);
         else
-            self->keys = mem_allocate_n_typed(self->num_keys + 1, PackFile_Annotations_Key *);
+            self->keys = mem_gc_allocate_n_typed(interp,
+                    1 + self->num_keys, PackFile_Annotations_Key *);
 
         key_id             = self->num_keys;
-        self->keys[key_id] = mem_allocate_typed(PackFile_Annotations_Key);
+        self->keys[key_id] = mem_gc_allocate_typed(interp, PackFile_Annotations_Key);
         self->num_keys++;
 
         /* Populate it. */
@@ -4500,17 +4533,14 @@
 
     /* Add annotations entry. */
     if (self->entries)
-            self->entries =
-                (PackFile_Annotations_Entry **)mem_sys_realloc(self->entries,
-                    (1 + self->num_entries) *
-                        sizeof (PackFile_Annotations_Entry *));
+            self->entries = mem_gc_realloc_n_typed(interp, self->entries,
+                    1 + self->num_entries, PackFile_Annotations_Entry *);
         else
-            self->entries =
-                mem_allocate_n_typed(self->num_entries + 1,
-                    PackFile_Annotations_Entry *);
+            self->entries = mem_gc_allocate_n_typed(interp,
+                    1 + self->num_entries, PackFile_Annotations_Entry *);
 
     self->entries[self->num_entries]                  =
-                        mem_allocate_typed(PackFile_Annotations_Entry);
+                        mem_gc_allocate_typed(interp, PackFile_Annotations_Entry);
     self->entries[self->num_entries]->bytecode_offset = offset;
     self->entries[self->num_entries]->key             = key_id;
     self->entries[self->num_entries]->value           = value;
@@ -4610,8 +4640,10 @@
     if (key_id == -1) {
         /* Look through entries, storing what we find by key and tracking those
          * that we have values for. */
-        opcode_t *latest_values = mem_allocate_n_zeroed_typed(self->num_keys, opcode_t);
-        opcode_t *have_values   = mem_allocate_n_zeroed_typed(self->num_keys, opcode_t);
+        opcode_t *latest_values = mem_gc_allocate_n_zeroed_typed(interp,
+                self->num_keys, opcode_t);
+        opcode_t *have_values   = mem_gc_allocate_n_zeroed_typed(interp,
+                self->num_keys, opcode_t);
 
         for (i = start_entry; i < self->num_entries; i++) {
             if (self->entries[i]->bytecode_offset >= offset)
@@ -4633,8 +4665,8 @@
             }
         }
 
-        mem_sys_free(latest_values);
-        mem_sys_free(have_values);
+        mem_gc_free(interp, latest_values);
+        mem_gc_free(interp, have_values);
     }
     else {
         /* Look for latest applicable value of the key. */
@@ -4696,9 +4728,9 @@
             Parrot_ex_throw_from_c_args(interp, NULL, 1,
                 "Unable to append PBC to the current directory");
 
-        mem_sys_free(pf->header);
+        mem_gc_free(interp, pf->header);
         pf->header = NULL;
-        mem_sys_free(pf->dirp);
+        mem_gc_free(interp, pf->dirp);
         pf->dirp   = NULL;
 
     }

Modified: trunk/src/packfile/pf_items.c
==============================================================================
--- trunk/src/packfile/pf_items.c	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/src/packfile/pf_items.c	Mon Feb 22 09:28:39 2010	(r44291)
@@ -1427,7 +1427,8 @@
 
 /*
 
-=item C<char * PF_fetch_cstring(PackFile *pf, const opcode_t **cursor)>
+=item C<char * PF_fetch_cstring(PARROT_INTERP, PackFile *pf, const opcode_t
+**cursor)>
 
 Fetches a cstring from bytecode and returns an allocated copy
 
@@ -1438,11 +1439,11 @@
 PARROT_MALLOC
 PARROT_CANNOT_RETURN_NULL
 char *
-PF_fetch_cstring(ARGIN(PackFile *pf), ARGIN(const opcode_t **cursor))
+PF_fetch_cstring(PARROT_INTERP, ARGIN(PackFile *pf), ARGIN(const opcode_t **cursor))
 {
     ASSERT_ARGS(PF_fetch_cstring)
     const size_t str_len = strlen((const char *)(*cursor)) + 1;
-    char * const p = (char *)mem_sys_allocate(str_len);
+    char * const p = mem_gc_allocate_n_typed(interp, str_len, char);
     const int wordsize = pf->header->wordsize;
 
     TRACE_PRINTF(("PF_fetch_cstring(): size is %ld...\n", str_len));

Modified: trunk/src/pbc_dump.c
==============================================================================
--- trunk/src/pbc_dump.c	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/src/pbc_dump.c	Mon Feb 22 09:28:39 2010	(r44291)
@@ -290,7 +290,7 @@
 
         size = PackFile_pack_size(interp,
                 interp->code->base.pf) * sizeof (opcode_t);
-        pack = (opcode_t*) mem_sys_allocate(size);
+        pack = (opcode_t*) Parrot_gc_allocate_memory_chunk(interp, size);
         if (!pack) {
             printf("out of mem\n");
             exit(EXIT_FAILURE);
@@ -308,7 +308,7 @@
             exit(EXIT_FAILURE);
         }
         fclose(fp);
-        mem_sys_free(pack);
+        Parrot_gc_free_memory_chunk(interp, pack);
         Parrot_exit(interp, 0);
     }
 

Modified: trunk/src/pbc_merge.c
==============================================================================
--- trunk/src/pbc_merge.c	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/src/pbc_merge.c	Mon Feb 22 09:28:39 2010	(r44291)
@@ -257,7 +257,7 @@
 
     /* Read in program. Nabbed from Parrot_pbc_read. */
     chunk_size   = program_size > 0 ? program_size : 1024;
-    program_code = (char *)mem_sys_allocate(chunk_size);
+    program_code = mem_gc_allocate_n_typed(interp, chunk_size, char);
     wanted       = program_size;
     program_size = 0;
     cursor       = (char *)program_code;
@@ -267,8 +267,8 @@
         if (program_size == wanted)
             break;
         chunk_size   = 1024;
-        program_code =
-            (char *)mem_sys_realloc(program_code, program_size + chunk_size);
+        program_code = mem_gc_realloc_n_typed(interp, program_code,
+                program_size + chunk_size, char);
 
         cursor = (char *)program_code + program_size;
     }
@@ -314,7 +314,7 @@
 {
     ASSERT_ARGS(pbc_merge_bytecode)
     int i;
-    opcode_t *bc    = mem_allocate_typed(opcode_t);
+    opcode_t *bc    = mem_gc_allocate_typed(interp, opcode_t);
     opcode_t cursor = 0;
 
     /* Add a bytecode segment. */
@@ -340,7 +340,7 @@
         }
 
         /* Re-allocate the current buffer. */
-        mem_realloc_n_typed(bc, cursor + in_seg->base.size, opcode_t);
+        bc = mem_gc_realloc_n_typed(interp, bc, cursor + in_seg->base.size, opcode_t);
 
         /* Copy data and store cursor. */
         memcpy(bc + cursor, in_seg->base.data,
@@ -378,7 +378,7 @@
                     ARGMOD(PackFile_ByteCode *bc))
 {
     ASSERT_ARGS(pbc_merge_constants)
-    PackFile_Constant   **constants = mem_allocate_typed(PackFile_Constant *);
+    PackFile_Constant   **constants = mem_gc_allocate_typed(interp, PackFile_Constant *);
 
     opcode_t cursor           = 0;
     opcode_t output_const_num = 0;
@@ -414,14 +414,15 @@
 
         /* Allocate space for the constant list, provided we have some. */
         if (in_seg->const_count > 0)
-            constants = (PackFile_Constant **)mem_sys_realloc(constants,
-                (cursor + in_seg->const_count) * sizeof (Parrot_Pointer));
+            constants = mem_gc_realloc_n_typed(interp, constants,
+                    cursor + in_seg->const_count, PackFile_Constant*);
 
         /* Loop over the constants and copy them to the output PBC. */
         for (j = 0; j < in_seg->const_count; j++) {
             /* Get the entry and allocate space for copy. */
             PackFile_Constant *cur_entry = in_seg->constants[j];
-            PackFile_Constant *copy      = mem_allocate_typed(PackFile_Constant);
+            PackFile_Constant *copy      = mem_gc_allocate_typed(interp,
+                    PackFile_Constant);
             STRUCT_COPY(copy, cur_entry);
 
             /* If it's a sub PMC, need to deal with offsets. */
@@ -477,7 +478,8 @@
 {
     ASSERT_ARGS(pbc_merge_fixups)
     PackFile_FixupTable  *fixup_seg;
-    PackFile_FixupEntry **fixups = mem_allocate_typed(PackFile_FixupEntry *);
+    PackFile_FixupEntry **fixups = mem_gc_allocate_typed(interp,
+            PackFile_FixupEntry *);
     opcode_t              cursor = 0;
     int                   i, j;
 
@@ -503,8 +505,8 @@
 
         /* Allocate space for these fixups, provided we have some. */
         if (in_seg->fixup_count > 0) {
-            fixups = (PackFile_FixupEntry **)mem_sys_realloc(fixups,
-                (cursor + in_seg->fixup_count) * sizeof (Parrot_Pointer));
+            fixups = mem_gc_realloc_n_typed(interp, fixups,
+                    cursor + in_seg->fixup_count, PackFile_FixupEntry*);
         }
 
         /* Loop over the fixups and copy them to the output PBC, correcting
@@ -512,10 +514,10 @@
         for (j = 0; j < in_seg->fixup_count; j++) {
             /* Get the entry and allocate space for copies. */
             PackFile_FixupEntry *cur_entry = in_seg->fixups[j];
-            PackFile_FixupEntry *copy      = mem_allocate_typed(
-                PackFile_FixupEntry);
-            char *name_copy = (char *)mem_sys_allocate(
-                strlen(cur_entry->name) + 1);
+            PackFile_FixupEntry *copy      = mem_gc_allocate_typed(interp,
+                    PackFile_FixupEntry);
+            char *name_copy = mem_gc_allocate_n_typed(interp,
+                    strlen(cur_entry->name) + 1, char);
 
             /* Copy type and name. */
             copy->type = cur_entry->type;
@@ -564,9 +566,10 @@
 {
     ASSERT_ARGS(pbc_merge_debugs)
     PackFile_Debug                 *debug_seg;
-    opcode_t                       *lines    = mem_allocate_typed(opcode_t);
+    opcode_t                       *lines    = mem_gc_allocate_typed(interp,
+                                                opcode_t);
     PackFile_DebugFilenameMapping **mappings =
-        mem_allocate_typed(PackFile_DebugFilenameMapping *);
+        mem_gc_allocate_typed(interp, PackFile_DebugFilenameMapping *);
 
     opcode_t num_mappings = 0;
     opcode_t num_lines    = 0;
@@ -580,19 +583,20 @@
         PackFile_Debug *in_seg = inputs[i]->pf->cur_cs->debugs;
 
         /* Concatenate line numbers. */
-        lines = (opcode_t *)mem_sys_realloc(lines,
-                (num_lines + in_seg->base.size) * sizeof (opcode_t));
+        lines = mem_gc_realloc_n_typed(interp, lines,
+                num_lines + in_seg->base.size, opcode_t);
 
         memcpy(lines + num_lines, in_seg->base.data,
             in_seg->base.size * sizeof (opcode_t));
 
         /* Concatenate mappings. */
-        mappings = (PackFile_DebugFilenameMapping **)mem_sys_realloc(mappings,
-                   (num_mappings + in_seg->num_mappings) *
-                   sizeof (Parrot_Pointer));
+        mappings = mem_gc_realloc_n_typed(interp, mappings,
+                num_mappings + in_seg->num_mappings,
+                PackFile_DebugFilenameMapping*);
+
         for (j = 0; j < in_seg->num_mappings; j++) {
-            PackFile_DebugFilenameMapping *mapping = mem_allocate_typed(
-                PackFile_DebugFilenameMapping);
+            PackFile_DebugFilenameMapping *mapping = mem_gc_allocate_typed(
+                    interp, PackFile_DebugFilenameMapping);
             STRUCT_COPY(mapping, in_seg->mappings[j]);
             mapping->offset   += num_lines;
             mapping->filename += inputs[i]->const_start;
@@ -607,9 +611,9 @@
        with merged ones we have created. */
     debug_seg = Parrot_new_debug_seg(interp, bc, num_lines);
     PackFile_add_segment(interp, &pf->directory, (PackFile_Segment*)debug_seg);
-    mem_sys_free(debug_seg->base.data);
+    mem_gc_free(interp, debug_seg->base.data);
     debug_seg->base.data    = lines;
-    mem_sys_free(debug_seg->mappings);
+    mem_gc_free(interp, debug_seg->mappings);
 
     debug_seg->mappings     = mappings;
     debug_seg->num_mappings = num_mappings;
@@ -738,7 +742,8 @@
             PackFile_Segment *seg = (PackFile_Segment *)pf_dir->segments[j];
             if (seg->type == PF_CONST_SEG) {
                 opcode_t const_count = ((PackFile_ConstTable *)seg)->const_count;
-                inputs[i]->const_map = mem_allocate_n_typed(const_count, opcode_t);
+                inputs[i]->const_map = mem_gc_allocate_n_typed(interp,
+                        const_count, opcode_t);
             }
         }
     }
@@ -755,7 +760,7 @@
     pbc_merge_ctpointers(interp, inputs, num_inputs, bc);
 
     for (i = 0; i < num_inputs; i++) {
-        mem_sys_free(inputs[i]->const_map);
+        mem_gc_free(interp, inputs[i]->const_map);
     }
 
     /* Return merged result. */
@@ -784,7 +789,7 @@
     const size_t size = PackFile_pack_size(interp, pf) * sizeof (opcode_t);
 
     /* Allocate memory. */
-    opcode_t * const pack = (opcode_t*) mem_sys_allocate(size);
+    opcode_t * const pack = (opcode_t*) Parrot_gc_allocate_memory_chunk(interp, size);
 
     /* Write and clean up. */
     PackFile_pack(interp, pf, pack);
@@ -797,7 +802,7 @@
         Parrot_exit(interp, 1);
     }
     fclose(fp);
-    mem_sys_free(pack);
+    mem_gc_free(interp, pack);
 }
 
 
@@ -858,12 +863,11 @@
 
     /* Load each packfile that we are to merge and set up an input
        structure for each of them. */
-    input_files = (pbc_merge_input **)mem_sys_allocate(
-        argc * sizeof (Parrot_Pointer));
+    input_files = mem_gc_allocate_n_typed(interp, argc, pbc_merge_input*);
 
     for (i = 0; i < argc; i++) {
         /* Allocate a struct. */
-        input_files[i] = mem_allocate_typed(pbc_merge_input);
+        input_files[i] = mem_gc_allocate_typed(interp, pbc_merge_input);
 
         /* Set filename */
         input_files[i]->filename = *argv;

Modified: trunk/src/pmc/bigint.pmc
==============================================================================
--- trunk/src/pmc/bigint.pmc	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/src/pmc/bigint.pmc	Mon Feb 22 09:28:39 2010	(r44291)
@@ -37,7 +37,7 @@
 
 static void
 bigint_init(PARROT_INTERP, PMC *self) {
-    BIGINT * const bi = mem_allocate_zeroed_typed(BIGINT);
+    BIGINT * const bi = mem_gc_allocate_zeroed_typed(interp, BIGINT);
     SETATTR_BigInt_bi(interp, self, bi);
     mpz_init(bi->b);
 }
@@ -47,7 +47,7 @@
     BIGINT * bi;
     GETATTR_BigInt_bi(interp, self, bi);
     mpz_clear(bi->b);
-    mem_sys_free(bi);
+    mem_gc_free(interp, bi);
 }
 
 static void
@@ -123,7 +123,7 @@
 
     GETATTR_BigInt_bi(interp, self, bi);
     n = mpz_sizeinbase(bi->b, base) + 2;
-    s = (char *)mem_sys_allocate(n);
+    s = mem_gc_allocate_n_typed(interp, n, char);
     return mpz_get_str(s, base, bi->b);
 }
 
@@ -679,14 +679,14 @@
     VTABLE STRING *get_string() {
         char   * const s  = bigint_get_string(INTERP, SELF, 10);
         STRING * const ps = Parrot_str_new(INTERP, s, 0);
-        mem_sys_free(s);
+        mem_gc_free(INTERP, s);
         return ps;
     }
 
     VTABLE STRING *get_string_keyed_int(INTVAL base) {
         char   * const s  = bigint_get_string(INTERP, SELF, base);
         STRING * const ps = Parrot_str_new(INTERP, s, 0);
-        mem_sys_free(s);
+        mem_gc_free(INTERP, s);
         return ps;
     }
 

Modified: trunk/src/pmc/bignum.pmc
==============================================================================
--- trunk/src/pmc/bignum.pmc	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/src/pmc/bignum.pmc	Mon Feb 22 09:28:39 2010	(r44291)
@@ -154,7 +154,7 @@
 static void
 bignum_init(PARROT_INTERP, PMC *self) {
 #ifdef PARROT_HAS_GMP
-    BIGNUM * const bn = mem_allocate_zeroed_typed(BIGNUM);
+    BIGNUM * const bn = mem_gc_allocate_zeroed_typed(interp, BIGNUM);
     SETATTR_BigNum_bn(interp, self, bn);
     mpf_clear(bn->b);
     mpf_init(bn->b);
@@ -170,7 +170,7 @@
     BIGNUM *bn;
     GETATTR_BigNum_bn(interp, self, bn);
     mpf_clear(bn->b);
-    mem_sys_free(bn);
+    mem_gc_free(interp, bn);
 #endif
 }
 
@@ -282,7 +282,7 @@
 
     GETATTR_BigNum_bn(interp, self, bn);
     n = (mpf_get_prec(bn->b)) / log(base) * log(2);
-    s = (char *)mem_sys_allocate(n + 5);
+    s = mem_gc_allocate_n_typed(interp, n + 5, char);
     return mpf_get_str(s, &exponent, base, 0, bn->b);
 }
 
@@ -294,7 +294,7 @@
     mp_exp_t exponent;
 
     GETATTR_BigNum_bn(interp, self, bn);
-    s = (char *)mem_sys_allocate(digits + 5);
+    s = mem_gc_allocate_n_typed(interp, digits + 5, char);
     return mpf_get_str(s, &exponent, base, digits, bn->b);
 }
 
@@ -987,21 +987,21 @@
     VTABLE STRING *get_string() {
         char   *s  = bignum_get_string(INTERP, SELF, 10);
         STRING *ps = Parrot_str_new(INTERP, s, 0);
-        mem_sys_free(s);
+        mem_gc_free(interp, s);
         return ps;
     }
 
     VTABLE STRING *get_string_keyed_int(INTVAL base) {
         char   *s  = bignum_get_string(INTERP, SELF, base);
         STRING *ps = Parrot_str_new(INTERP, s, 0);
-        mem_sys_free(s);
+        mem_gc_free(interp, s);
         return ps;
     }
 
     VTABLE STRING *get_string_keyed_int_int(INTVAL base, INTVAL digits) {
         char   *s  = bignum_get_string_size(INTERP, SELF, base, digits);
         STRING *ps = Parrot_str_new(INTERP, s, 0);
-        mem_sys_free(s);
+        mem_gc_free(interp, s);
         return ps;
     }
 

Modified: trunk/src/pmc/callcontext.pmc
==============================================================================
--- trunk/src/pmc/callcontext.pmc	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/src/pmc/callcontext.pmc	Mon Feb 22 09:28:39 2010	(r44291)
@@ -595,7 +595,7 @@
                 Parrot_gc_free_fixed_size_storage(INTERP,
                     8 * sizeof (void *), returns_values);
             else
-                mem_sys_free(returns_values);
+                mem_gc_free(INTERP, returns_values);
         }
 
         Parrot_pcc_free_registers(INTERP, SELF);

Modified: trunk/src/pmc/fixedbooleanarray.pmc
==============================================================================
--- trunk/src/pmc/fixedbooleanarray.pmc	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/src/pmc/fixedbooleanarray.pmc	Mon Feb 22 09:28:39 2010	(r44291)
@@ -74,7 +74,7 @@
         unsigned char *bit_array;
         GET_ATTR_bit_array(INTERP, SELF, bit_array);
         if (bit_array)
-            mem_sys_free(bit_array);
+            mem_gc_free(INTERP, bit_array);
     }
 
 /*
@@ -102,7 +102,7 @@
             SET_ATTR_size(INTERP, dest, size);
             SET_ATTR_resize_threshold(INTERP, dest, resize_threshold);
 
-            clone_bit_array = (unsigned char*)mem_sys_allocate(size_in_bytes);
+            clone_bit_array = mem_gc_allocate_n_typed(INTERP, size_in_bytes, unsigned char);
             mem_sys_memcopy(clone_bit_array, my_bit_array, size_in_bytes);
 
             SET_ATTR_bit_array(INTERP, dest, clone_bit_array);
@@ -330,6 +330,7 @@
     VTABLE void set_integer_native(INTVAL size) {
         const size_t size_in_bytes = get_size_in_bytes(size);
         UINTVAL old_size;
+        unsigned char *bit_array;
 
         GET_ATTR_size(INTERP, SELF, old_size);
 
@@ -339,8 +340,9 @@
 
         SET_ATTR_size(INTERP, SELF, size);
         SET_ATTR_resize_threshold(INTERP, SELF, size_in_bytes * BITS_PER_CHAR);
-        SET_ATTR_bit_array(INTERP, SELF,
-                (unsigned char*)mem_sys_allocate_zeroed(size_in_bytes));
+        bit_array = mem_gc_allocate_n_typed(INTERP, size_in_bytes, unsigned char);
+        memset(bit_array, 0, size_in_bytes);
+        SET_ATTR_bit_array(INTERP, SELF, bit_array);
     }
 
 /*

Modified: trunk/src/pmc/fixedfloatarray.pmc
==============================================================================
--- trunk/src/pmc/fixedfloatarray.pmc	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/src/pmc/fixedfloatarray.pmc	Mon Feb 22 09:28:39 2010	(r44291)
@@ -43,7 +43,7 @@
         FLOATVAL *float_array;
         GET_ATTR_float_array(INTERP, SELF, float_array);
         if (float_array)
-            mem_sys_free(float_array);
+            mem_gc_free(INTERP, float_array);
     }
 
 /*
@@ -70,7 +70,7 @@
         SET_ATTR_size(INTERP, dest, size);
         mem_size          = size * sizeof (FLOATVAL);
 
-        dest_float_array  = (FLOATVAL*)mem_sys_allocate(mem_size);
+        dest_float_array  = (FLOATVAL*)Parrot_gc_allocate_memory_chunk(INTERP, mem_size);
         mem_sys_memcopy(dest_float_array, self_float_array, mem_size);
         SET_ATTR_float_array(INTERP, dest, dest_float_array);
         PObj_custom_destroy_SET(dest);
@@ -289,7 +289,7 @@
 
         SET_ATTR_size(INTERP, SELF, new_size);
         SET_ATTR_float_array(INTERP, SELF,
-                mem_allocate_n_typed(new_size, FLOATVAL));
+                mem_gc_allocate_n_typed(INTERP, new_size, FLOATVAL));
         PObj_custom_destroy_SET(SELF);
     }
 

Modified: trunk/src/pmc/fixedintegerarray.pmc
==============================================================================
--- trunk/src/pmc/fixedintegerarray.pmc	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/src/pmc/fixedintegerarray.pmc	Mon Feb 22 09:28:39 2010	(r44291)
@@ -57,7 +57,7 @@
         INTVAL* int_array;
         GET_ATTR_int_array(INTERP, SELF, int_array);
         if (int_array)
-            mem_sys_free(int_array);
+            Parrot_gc_free_memory_chunk(INTERP, int_array);
     }
 
 /*
@@ -92,7 +92,7 @@
 
             GET_ATTR_size(INTERP, SELF, size);
 
-            dest_int_array = mem_allocate_n_typed(size, INTVAL);
+            dest_int_array = mem_gc_allocate_n_typed(INTERP, size, INTVAL);
             SET_ATTR_size(INTERP, dest, size);
             SET_ATTR_int_array(INTERP, dest, dest_int_array);
 
@@ -338,7 +338,7 @@
         SET_ATTR_size(INTERP, SELF, size);
         GET_ATTR_int_array(INTERP, SELF, int_array);
         SET_ATTR_int_array(INTERP, SELF,
-                mem_realloc_n_typed(int_array, size, INTVAL));
+                mem_gc_realloc_n_typed(INTERP, int_array, size, INTVAL));
         PObj_custom_destroy_SET(SELF);
     }
 

Modified: trunk/src/pmc/fixedpmcarray.pmc
==============================================================================
--- trunk/src/pmc/fixedpmcarray.pmc	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/src/pmc/fixedpmcarray.pmc	Mon Feb 22 09:28:39 2010	(r44291)
@@ -88,7 +88,7 @@
 
     VTABLE void destroy() {
         if (PMC_array(SELF))
-            mem_sys_free(PMC_array(SELF));
+            mem_gc_free(INTERP, PMC_array(SELF));
     }
 
 /*
@@ -107,7 +107,7 @@
 
         if (size) {
             PMC_size(dest)  = size;
-            PMC_array(dest) = mem_allocate_n_typed(size, PMC *);
+            PMC_array(dest) = mem_gc_allocate_n_zeroed_typed(INTERP, size, PMC *);
             mem_copy_n_typed(PMC_array(dest), PMC_array(SELF), size, PMC *);
             PObj_custom_mark_destroy_SETALL(dest);
         }
@@ -377,7 +377,7 @@
                     _("FixedPMCArray: Cannot set array size to a negative number"));
 
         PMC_size(SELF) = size;
-        data           = mem_allocate_n_typed(size, PMC *);
+        data           = mem_gc_allocate_n_zeroed_typed(INTERP, size, PMC *);
 
         for (i = 0; i < size; i++)
             data[i] = PMCNULL;
@@ -397,10 +397,10 @@
                     _("Can't set self from this type"));
 
         if (PMC_array(SELF))
-            mem_sys_free(PMC_array(SELF));
+            mem_gc_free(INTERP, PMC_array(SELF));
 
         size            = PMC_size(SELF) = VTABLE_elements(INTERP, value);
-        PMC_array(SELF) = mem_allocate_n_zeroed_typed(size, PMC *);
+        PMC_array(SELF) = mem_gc_allocate_n_zeroed_typed(INTERP, size, PMC *);
 
         for (i = 0; i < size; i++)
             (PMC_array(SELF))[i] = VTABLE_get_pmc_keyed_int(INTERP, value, i);

Modified: trunk/src/pmc/fixedstringarray.pmc
==============================================================================
--- trunk/src/pmc/fixedstringarray.pmc	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/src/pmc/fixedstringarray.pmc	Mon Feb 22 09:28:39 2010	(r44291)
@@ -60,7 +60,7 @@
         GET_ATTR_str_array(INTERP, SELF, str_array);
 
         if (str_array)
-            mem_sys_free(str_array);
+            mem_gc_free(INTERP, str_array);
     }
 
 /*
@@ -87,7 +87,7 @@
             GET_ATTR_size(INTERP, SELF, size);
             mem_size = size * sizeof (STRING *);
 
-            dest_str_array = mem_allocate_n_zeroed_typed(size, STRING *);
+            dest_str_array = mem_gc_allocate_n_zeroed_typed(INTERP, size, STRING *);
             mem_sys_memcopy(dest_str_array, my_str_array, mem_size);
             SET_ATTR_str_array(INTERP, dest, dest_str_array);
             SET_ATTR_size(INTERP, dest, size);
@@ -341,7 +341,7 @@
 
         SET_ATTR_size(INTERP, SELF, new_size);
         SET_ATTR_str_array(INTERP, SELF,
-                (STRING**)mem_sys_allocate_zeroed(new_size * sizeof (STRING*)));
+                mem_gc_allocate_n_zeroed_typed(INTERP, new_size, STRING*));
 
         PObj_custom_mark_destroy_SETALL(SELF);
     }

Modified: trunk/src/pmc/managedstruct.pmc
==============================================================================
--- trunk/src/pmc/managedstruct.pmc	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/src/pmc/managedstruct.pmc	Mon Feb 22 09:28:39 2010	(r44291)
@@ -71,7 +71,7 @@
 Destroys the struct, freeing the allocated memory.
 
 If the "custom_free_func" attribute is set, it is called to free the pointer.
-Otherwise, mem_sys_free() is used.
+Otherwise, mem_gc_free() is used.
 
 =cut
 
@@ -83,9 +83,9 @@
             custom_free_func_t free_func = PARROT_MANAGEDSTRUCT(SELF)->custom_free_func;
             if (free_func) {
                 void *free_data = PARROT_MANAGEDSTRUCT(SELF)->custom_free_priv;
-                free_func(interp, ptr, free_data);
+                free_func(INTERP, ptr, free_data);
             } else
-                mem_sys_free(ptr);
+                mem_gc_free(INTERP, ptr);
         }
     }
 
@@ -100,20 +100,24 @@
 */
 
     VTABLE void set_integer_native(INTVAL value) {
-        if (PARROT_MANAGEDSTRUCT(SELF)->ptr && !value) {
-            mem_sys_free(PARROT_MANAGEDSTRUCT(SELF)->ptr);
-            PARROT_MANAGEDSTRUCT(SELF)->ptr  = NULL;
-            PARROT_MANAGEDSTRUCT(SELF)->size = 0;
+        Parrot_ManagedStruct_attributes * attrs = PARROT_MANAGEDSTRUCT(SELF);
+
+        if (attrs->ptr && !value) {
+            mem_gc_free(INTERP, attrs->ptr);
+            attrs->ptr  = NULL;
+            attrs->size = 0;
         }
-        else if (value && !PARROT_MANAGEDSTRUCT(SELF)->ptr) {
-            PARROT_MANAGEDSTRUCT(SELF)->ptr  = mem_sys_allocate_zeroed((size_t)value);
-            PARROT_MANAGEDSTRUCT(SELF)->size = value;
+        else if (value && !attrs->ptr) {
+            attrs->ptr  = Parrot_gc_allocate_memory_chunk_with_interior_pointers(
+                    INTERP, (size_t)value);
+            attrs->size = value;
         }
-        else if (value && PARROT_MANAGEDSTRUCT(SELF)->ptr) {
-            if (PARROT_MANAGEDSTRUCT(SELF)->size != value) {
-                PARROT_MANAGEDSTRUCT(SELF)->ptr =
-                    mem_sys_realloc(PARROT_MANAGEDSTRUCT(SELF)->ptr, (size_t)value);
-                PARROT_MANAGEDSTRUCT(SELF)->size = value;
+        else if (value && attrs->ptr) {
+            if (attrs->size != value) {
+                attrs->ptr =
+                    Parrot_gc_reallocate_memory_chunk_with_interior_pointers(INTERP,
+                        attrs->ptr, (size_t)value, attrs->size);
+                attrs->size = value;
             }
         }
 

Modified: trunk/src/pmc/nci.pmc
==============================================================================
--- trunk/src/pmc/nci.pmc	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/src/pmc/nci.pmc	Mon Feb 22 09:28:39 2010	(r44291)
@@ -28,7 +28,7 @@
     char    param_buf[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
     char   *param_sig    = sig_length <= 7
                          ? param_buf
-                         : mem_allocate_n_typed(sig_length, char);
+                         : mem_gc_allocate_n_typed(interp, sig_length, char);
     size_t  j            = 0;
     size_t  i;
 

Modified: trunk/src/pmc/opcode.pmc
==============================================================================
--- trunk/src/pmc/opcode.pmc	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/src/pmc/opcode.pmc	Mon Feb 22 09:28:39 2010	(r44291)
@@ -42,7 +42,7 @@
 
     VTABLE void set_string_native(STRING *name) {
         char * cstr = Parrot_str_to_cstring(INTERP, name);
-        const INTVAL num = INTERP->op_lib->op_code(cstr, 1);
+        const INTVAL num = INTERP->op_lib->op_code(INTERP, cstr, 1);
         Parrot_str_free_cstring(cstr);
         if (num == -1)
             Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_OUT_OF_BOUNDS,

Modified: trunk/src/pmc/oplib.pmc
==============================================================================
--- trunk/src/pmc/oplib.pmc	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/src/pmc/oplib.pmc	Mon Feb 22 09:28:39 2010	(r44291)
@@ -50,9 +50,9 @@
        specific name, then the more general short name. */
     VTABLE INTVAL get_integer_keyed_str(STRING *name) {
         char * cstr = Parrot_str_to_cstring(INTERP, name);
-        INTVAL num = INTERP->op_lib->op_code(cstr, 1);
+        INTVAL num = INTERP->op_lib->op_code(INTERP, cstr, 1);
         if (num == -1)
-            num = INTERP->op_lib->op_code(cstr, 0);
+            num = INTERP->op_lib->op_code(INTERP, cstr, 0);
         Parrot_str_free_cstring(cstr);
         return num;
     }

Modified: trunk/src/pmc/orderedhash.pmc
==============================================================================
--- trunk/src/pmc/orderedhash.pmc	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/src/pmc/orderedhash.pmc	Mon Feb 22 09:28:39 2010	(r44291)
@@ -153,7 +153,7 @@
 }
 
 
-pmclass OrderedHash need_ext provides array provides hash {
+pmclass OrderedHash need_ext provides array provides hash auto_attrs {
     ATTR PMC    *hash;   /* key to item tuple */
     ATTR PMC    *first;  /* Pointer to first inserted value  */
     ATTR PMC    *last;   /* Pointer to last inserted value   */
@@ -170,9 +170,8 @@
 
     VTABLE void init() {
         Parrot_OrderedHash_attributes * const attrs =
-                mem_allocate_zeroed_typed(Parrot_OrderedHash_attributes);
+                (Parrot_OrderedHash_attributes*) PMC_data(SELF);
 
-        PMC_data(SELF)  = attrs;
         attrs->hash     = Parrot_pmc_new(INTERP, enum_class_Hash);
         attrs->first    = PMCNULL;
         attrs->last     = PMCNULL;

Modified: trunk/src/pmc/os.pmc
==============================================================================
--- trunk/src/pmc/os.pmc	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/src/pmc/os.pmc	Mon Feb 22 09:28:39 2010	(r44291)
@@ -86,7 +86,7 @@
 #endif
         if (cwd) {
             STRING * const scwd = Parrot_str_new(INTERP, cwd, strlen(cwd));
-            mem_sys_free(cwd);
+            free(cwd);
             RETURN(STRING *scwd);
         }
         else {

Modified: trunk/src/pmc/packfile.pmc
==============================================================================
--- trunk/src/pmc/packfile.pmc	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/src/pmc/packfile.pmc	Mon Feb 22 09:28:39 2010	(r44291)
@@ -120,7 +120,7 @@
 
         /* Calculate required memory */
         length  = PackFile_pack_size(interp, pf) * sizeof (opcode_t);
-        ptr     = (opcode_t*)mem_sys_allocate(length);
+        ptr     = (opcode_t*)Parrot_gc_allocate_memory_chunk(INTERP, length);
 
         /* Copy related attributes to header */
         pf->header->major     = attrs->version_major;
@@ -133,7 +133,7 @@
 
         str = Parrot_str_new_init(interp, (const char*)ptr, length,
                 PARROT_FIXED_8_ENCODING, PARROT_BINARY_CHARSET, 0);
-        mem_sys_free(ptr);
+        Parrot_gc_free_memory_chunk(INTERP, ptr);
 
         PackFile_destroy(interp, pf);
         return str;

Modified: trunk/src/pmc/packfileannotations.pmc
==============================================================================
--- trunk/src/pmc/packfileannotations.pmc	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/src/pmc/packfileannotations.pmc	Mon Feb 22 09:28:39 2010	(r44291)
@@ -260,7 +260,8 @@
     VTABLE void *get_pointer() {
         Parrot_PackfileAnnotations_attributes *attrs =
                 PARROT_PACKFILEANNOTATIONS(SELF);
-        PackFile_Annotations *res = mem_allocate_zeroed_typed(PackFile_Annotations);
+        PackFile_Annotations *res = mem_gc_allocate_zeroed_typed(INTERP,
+                PackFile_Annotations);
         INTVAL                i, num;
         INTVAL                key_type;
         PMC                  *keys;             /* Temporary representation of Keys */
@@ -297,7 +298,7 @@
         /* Iterate over stored annotations and create Key if required. */
         num = VTABLE_elements(interp, attrs->annotations);
         res->num_entries = num;
-        res->entries = mem_allocate_n_typed(num, PackFile_Annotations_Entry*);
+        res->entries = mem_gc_allocate_n_typed(INTERP, num, PackFile_Annotations_Entry*);
         for (i = 0; i < num; ++i) {
             PMC  *entity = VTABLE_get_pmc_keyed_int(interp, attrs->annotations, i);
             Parrot_PackfileAnnotation_attributes *entity_attrs = PARROT_PACKFILEANNOTATION(entity);
@@ -336,7 +337,8 @@
 
             /* At this point we have create (if nesassary) key and name constant. */
             /* Start storing real entity */
-            res->entries[i] = mem_allocate_zeroed_typed(PackFile_Annotations_Entry);
+            res->entries[i] = mem_gc_allocate_zeroed_typed(INTERP,
+                    PackFile_Annotations_Entry);
 
             res->entries[i]->bytecode_offset = entity_attrs->offset;
             res->entries[i]->key             = key_id;
@@ -365,9 +367,10 @@
         /* Time to pack keys */
         num = VTABLE_elements(interp, types);
         res->num_keys = num;
-        res->keys = mem_allocate_n_typed(num, PackFile_Annotations_Key*);
+        res->keys = mem_gc_allocate_n_zeroed_typed(INTERP, num,
+                PackFile_Annotations_Key*);
         for (i = 0; i < num; ++i) {
-            res->keys[i] = mem_allocate_typed(PackFile_Annotations_Key);
+            res->keys[i] = mem_gc_allocate_typed(INTERP, PackFile_Annotations_Key);
             res->keys[i]->name = VTABLE_get_integer_keyed_int(interp, names, i);
             res->keys[i]->type = VTABLE_get_integer_keyed_int(interp, types, i);
         }

Modified: trunk/src/pmc/packfileconstanttable.pmc
==============================================================================
--- trunk/src/pmc/packfileconstanttable.pmc	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/src/pmc/packfileconstanttable.pmc	Mon Feb 22 09:28:39 2010	(r44291)
@@ -129,7 +129,7 @@
         Parrot_PackfileConstantTable_attributes * attrs =
                 PARROT_PACKFILECONSTANTTABLE(SELF);
         PackFile_ConstTable * pftable =
-                mem_allocate_zeroed_typed(PackFile_ConstTable);
+                mem_gc_allocate_zeroed_typed(INTERP, PackFile_ConstTable);
         PackFile_Constant   * value;
         opcode_t              i;
 
@@ -137,8 +137,8 @@
 
         /* Copy all constanst with respect of type */
         pftable->const_count = VTABLE_get_integer(interp, attrs->constants);
-        pftable->constants   = mem_allocate_n_typed(pftable->const_count,
-                PackFile_Constant*);
+        pftable->constants   = mem_gc_allocate_n_typed(INTERP,
+                pftable->const_count, PackFile_Constant*);
 
         for (i = 0; i < pftable->const_count; ++i) {
             value = PackFile_Constant_new(interp);

Modified: trunk/src/pmc/packfilefixupentry.pmc
==============================================================================
--- trunk/src/pmc/packfilefixupentry.pmc	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/src/pmc/packfilefixupentry.pmc	Mon Feb 22 09:28:39 2010	(r44291)
@@ -95,7 +95,7 @@
         Parrot_PackfileFixupEntry_attributes * attrs =
                 PARROT_PACKFILEFIXUPENTRY(SELF);
         PackFile_FixupEntry                  * entry =
-                mem_allocate_zeroed_typed(PackFile_FixupEntry);
+                mem_gc_allocate_zeroed_typed(INTERP, PackFile_FixupEntry);
 
         entry->type     = attrs->type;
         entry->name     = strdup(Parrot_string_cstring(interp, attrs->name));

Modified: trunk/src/pmc/packfilefixuptable.pmc
==============================================================================
--- trunk/src/pmc/packfilefixuptable.pmc	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/src/pmc/packfilefixuptable.pmc	Mon Feb 22 09:28:39 2010	(r44291)
@@ -108,15 +108,15 @@
         Parrot_PackfileFixupTable_attributes * attrs =
                 PARROT_PACKFILEFIXUPTABLE(SELF);
         PackFile_FixupTable * pftable =
-                mem_allocate_zeroed_typed(PackFile_FixupTable);
+                mem_gc_allocate_zeroed_typed(INTERP, PackFile_FixupTable);
         PMC                 * entry;
         PackFile_FixupEntry * val;
         opcode_t              i;
 
         pftable->base.type   = PF_FIXUP_SEG;
         pftable->fixup_count = VTABLE_elements(interp, attrs->entries);
-        pftable->fixups      = mem_allocate_n_typed(pftable->fixup_count,
-                PackFile_FixupEntry*);
+        pftable->fixups      = mem_gc_allocate_n_typed(INTERP,
+                pftable->fixup_count, PackFile_FixupEntry*);
 
         /* Copy all entries */
         for (i = 0; i < pftable->fixup_count; ++i) {

Modified: trunk/src/pmc/packfilerawsegment.pmc
==============================================================================
--- trunk/src/pmc/packfilerawsegment.pmc	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/src/pmc/packfilerawsegment.pmc	Mon Feb 22 09:28:39 2010	(r44291)
@@ -111,7 +111,7 @@
 
     VTABLE void *get_pointer() {
         PackFile_Segment * pfseg =
-                (PackFile_Segment*)mem_allocate_zeroed_typed(PackFile_ByteCode);
+                (PackFile_Segment*)mem_gc_allocate_zeroed_typed(INTERP, PackFile_ByteCode);
         Parrot_PackfileRawSegment_attributes * attrs =
                 PARROT_PACKFILERAWSEGMENT(SELF);
         PMC * opcodes = attrs->opcodes;
@@ -119,7 +119,7 @@
 
         pfseg->type     = attrs->type;
         pfseg->size     = VTABLE_get_integer(interp, opcodes);
-        pfseg->data     = mem_allocate_n_typed(pfseg->size, opcode_t);
+        pfseg->data     = mem_gc_allocate_n_typed(INTERP, pfseg->size, opcode_t);
 
         /* Not very efficient... */
         for (i = 0; i < pfseg->size; ++i) {

Modified: trunk/src/pmc/parrotinterpreter.pmc
==============================================================================
--- trunk/src/pmc/parrotinterpreter.pmc	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/src/pmc/parrotinterpreter.pmc	Mon Feb 22 09:28:39 2010	(r44291)
@@ -1,5 +1,5 @@
 /*
-Copyright (C) 2001-2009, Parrot Foundation.
+Copyright (C) 2001-2010, Parrot Foundation.
 $Id$
 
 =head1 NAME
@@ -232,7 +232,7 @@
          */
         if (!PMC_data(SELF)) {
             Parrot_ParrotInterpreter_attributes *attrs =
-                mem_allocate_zeroed_typed(Parrot_ParrotInterpreter_attributes);
+                mem_gc_allocate_zeroed_typed(INTERP, Parrot_ParrotInterpreter_attributes);
             PMC_data(SELF) = attrs;
         }
         if (!PMC_interp(SELF)) {
@@ -258,7 +258,7 @@
 
         if (!PMC_data(SELF)) {
             Parrot_ParrotInterpreter_attributes *attrs =
-                mem_allocate_zeroed_typed(Parrot_ParrotInterpreter_attributes);
+                mem_gc_allocate_zeroed_typed(INTERP, Parrot_ParrotInterpreter_attributes);
             PMC_data(SELF) = attrs;
         }
         if (!PMC_interp(SELF)) {
@@ -280,7 +280,7 @@
 
     VTABLE void destroy() {
         if (PMC_data(SELF)) {
-            mem_sys_free(PMC_data(SELF));
+            mem_gc_free(INTERP, PMC_data(SELF));
             PMC_data(SELF) = NULL;
         }
     }
@@ -303,7 +303,7 @@
          * initialized, cheat by initializing instead. */
         if (!PMC_data(SELF)) {
             Parrot_ParrotInterpreter_attributes *attrs =
-                mem_allocate_zeroed_typed(Parrot_ParrotInterpreter_attributes);
+                mem_gc_allocate_zeroed_typed(INTERP, Parrot_ParrotInterpreter_attributes);
             PMC_data(SELF) = attrs;
             PObj_custom_destroy_SET(SELF);
         }
@@ -713,7 +713,7 @@
     VTABLE void thaw(PMC *info) {
         if (!PMC_data(SELF)) {
             Parrot_ParrotInterpreter_attributes *attrs =
-                mem_allocate_zeroed_typed(Parrot_ParrotInterpreter_attributes);
+                mem_gc_allocate_zeroed_typed(INTERP, Parrot_ParrotInterpreter_attributes);
             PMC_data(SELF) = attrs;
             PObj_custom_destroy_SET(SELF);
         }

Modified: trunk/src/pmc/resizablebooleanarray.pmc
==============================================================================
--- trunk/src/pmc/resizablebooleanarray.pmc	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/src/pmc/resizablebooleanarray.pmc	Mon Feb 22 09:28:39 2010	(r44291)
@@ -148,8 +148,9 @@
         /* Nothing allocated yet */
         GET_ATTR_bit_array(INTERP, SELF, bit_array);
         if (!bit_array) {
-            SET_ATTR_bit_array(INTERP, SELF,
-                    (unsigned char *)mem_sys_allocate_zeroed(new_size_in_bytes));
+            void *new_bit_array = Parrot_gc_allocate_memory_chunk(INTERP, new_size_in_bytes);
+            memset(new_bit_array, 0, new_size_in_bytes);
+            SET_ATTR_bit_array(INTERP, SELF, (unsigned char *)new_bit_array);
 
         /* The size is different, and doesn't fit within the current
          * allocation */
@@ -157,15 +158,16 @@
         else if (new_size_in_bytes != old_size_in_bytes) {
             unsigned char * old_store = bit_array;
             unsigned char * new_store =
-                (unsigned char *)mem_sys_allocate_zeroed(new_tail_pos);
+                (unsigned char *)Parrot_gc_allocate_memory_chunk(INTERP, new_tail_pos);
             size_t          copy_size =
                 new_size_in_bytes < old_size_in_bytes ? new_size_in_bytes : old_size_in_bytes;
+            memset(new_store, 0, new_tail_pos);
 
             /* Replace old array with new array, and free old array */
             SET_ATTR_bit_array(INTERP, SELF,
                     (unsigned char *)mem_sys_memmove(
                         new_store, old_store, copy_size));
-            mem_sys_free(old_store);
+            mem_gc_free(INTERP, old_store);
         }
     }
 
@@ -249,7 +251,8 @@
 
             /* Allocate an extra allocation unit of space in new array */
             new_mem_size  = ROUND_BYTES(tail_pos+ MIN_ALLOC);
-            new_bit_array = (unsigned char *)mem_sys_allocate_zeroed(new_mem_size);
+            new_bit_array = (unsigned char *)Parrot_gc_allocate_memory_chunk(INTERP, new_mem_size);
+            memset(new_bit_array, 0, new_mem_size);
 
             /* Copy contents of old array to new array, moving the head
              * position forward by one allocation unit (in bytes). */
@@ -259,7 +262,7 @@
 
             /* Replace old array with new array, and free old array */
             SET_ATTR_bit_array(INTERP, SELF, new_bit_array);
-            mem_sys_free(old_bit_array);
+            mem_gc_free(INTERP, old_bit_array);
 
             /* Added one allocation unit to the head position offset */
             SET_ATTR_size(INTERP, SELF, tail_pos + MIN_ALLOC);
@@ -309,7 +312,8 @@
             GET_ATTR_size(INTERP, SELF, tail_pos);
             new_mem_size  = ROUND_BYTES(tail_pos - MIN_ALLOC);
             new_bit_array =
-                (unsigned char *)mem_sys_allocate_zeroed(new_mem_size);
+                (unsigned char *)Parrot_gc_allocate_memory_chunk(INTERP, new_mem_size);
+            memset(new_bit_array, 0, new_mem_size);
 
             /* Copy contents of old array to new array, move the head position
              * offset back by one allocation unit (in bytes) */
@@ -319,7 +323,7 @@
 
             /* Replace old array with new array, and free old array */
             SET_ATTR_bit_array(INTERP, SELF, new_bit_array);
-            mem_sys_free(old_bit_array);
+            mem_gc_free(INTERP, old_bit_array);
 
             /* Removed one allocation unit from the head position offset */
             SET_ATTR_size(INTERP, SELF, tail_pos - MIN_ALLOC);
@@ -384,7 +388,7 @@
 
         if (my_bit_array) {
             size_t size_in_bits = tail_pos / BITS_PER_CHAR + 1;
-            dest_bit_array = (unsigned char *)mem_sys_allocate(size_in_bits);
+            dest_bit_array = (unsigned char *)Parrot_gc_allocate_memory_chunk(INTERP, size_in_bits);
             mem_sys_memcopy(dest_bit_array, my_bit_array, size_in_bits);
         }
         else

Modified: trunk/src/pmc/resizablefloatarray.pmc
==============================================================================
--- trunk/src/pmc/resizablefloatarray.pmc	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/src/pmc/resizablefloatarray.pmc	Mon Feb 22 09:28:39 2010	(r44291)
@@ -130,8 +130,7 @@
                 cur          &= ~0xfff;
             }
             SET_ATTR_float_array(INTERP, SELF,
-                    (FLOATVAL*)mem_sys_realloc(float_array,
-                    cur * sizeof (FLOATVAL)));
+                    mem_gc_realloc_n_typed(INTERP, float_array, cur, FLOATVAL));
             SET_ATTR_size(INTERP, SELF, size);
             SET_ATTR_resize_threshold(INTERP, SELF, cur);
         }

Modified: trunk/src/pmc/resizableintegerarray.pmc
==============================================================================
--- trunk/src/pmc/resizableintegerarray.pmc	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/src/pmc/resizableintegerarray.pmc	Mon Feb 22 09:28:39 2010	(r44291)
@@ -124,7 +124,7 @@
             }
 
             GET_ATTR_int_array(INTERP, SELF, int_array);
-            mem_realloc_n_typed(int_array, cur, INTVAL);
+            int_array = mem_gc_realloc_n_typed(INTERP, int_array, cur, INTVAL);
             SET_ATTR_int_array(INTERP, SELF, int_array);
             SET_ATTR_size(INTERP, SELF, size);
             SET_ATTR_resize_threshold(INTERP, SELF, cur);

Modified: trunk/src/pmc/resizablepmcarray.pmc
==============================================================================
--- trunk/src/pmc/resizablepmcarray.pmc	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/src/pmc/resizablepmcarray.pmc	Mon Feb 22 09:28:39 2010	(r44291)
@@ -92,7 +92,8 @@
             if (cur < 8)
                 cur = 8;
 
-            PMC_array(SELF) = mem_realloc_n_typed(PMC_array(SELF), cur, PMC *);
+            PMC_array(SELF) = mem_gc_realloc_n_typed_zeroed(INTERP,
+                    PMC_array(SELF), cur, i, PMC *);
 
             for (; i < cur; i++) {
                 (PMC_array(SELF))[i] = PMCNULL;

Modified: trunk/src/pmc/resizablestringarray.pmc
==============================================================================
--- trunk/src/pmc/resizablestringarray.pmc	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/src/pmc/resizablestringarray.pmc	Mon Feb 22 09:28:39 2010	(r44291)
@@ -241,8 +241,8 @@
             }
 
             SET_ATTR_str_array(INTERP, SELF,
-                    (STRING **)mem_sys_realloc(
-                        str_array, cur * sizeof (STRING*)));
+                    mem_gc_realloc_n_typed_zeroed(INTERP, str_array,
+                            cur, resize_threshold, STRING*));
             GET_ATTR_str_array(INTERP, SELF, str_array);
 
             for (; i < cur; i++)

Modified: trunk/src/pmc/sockaddr.pmc
==============================================================================
--- trunk/src/pmc/sockaddr.pmc	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/src/pmc/sockaddr.pmc	Mon Feb 22 09:28:39 2010	(r44291)
@@ -46,7 +46,8 @@
         Parrot_Sockaddr_attributes * const pdata_struct =
             (Parrot_Sockaddr_attributes *) PMC_data(SELF);
 
-        pdata_struct->pointer = mem_allocate_zeroed_typed(struct sockaddr_in);
+        pdata_struct->pointer = mem_gc_allocate_zeroed_typed(INTERP,
+                struct sockaddr_in);
         PObj_custom_destroy_SET(SELF);
     }
 

Modified: trunk/src/pmc/sub.pmc
==============================================================================
--- trunk/src/pmc/sub.pmc	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/src/pmc/sub.pmc	Mon Feb 22 09:28:39 2010	(r44291)
@@ -184,7 +184,8 @@
         if (VTABLE_exists_keyed_str(INTERP, init, field)) {
             PMC   *tmp = VTABLE_get_pmc_keyed_str(INTERP, init, field);
             /* Allocate structure to store argument information in. */
-            attrs->arg_info = mem_allocate_zeroed_typed(Parrot_sub_arginfo);
+            attrs->arg_info = mem_gc_allocate_zeroed_typed(INTERP,
+                    Parrot_sub_arginfo);
             /*
             Hash.get_integer_keyed_str return 0 if key doesn't exists.
             So, don't check existence of key, just use it.
@@ -222,7 +223,7 @@
 
         if (sub) {
             if (sub->arg_info)
-                mem_sys_free(sub->arg_info);
+                mem_gc_free(INTERP, sub->arg_info);
         }
     }
 
@@ -843,7 +844,8 @@
             const opcode_t *pc = sub->seg->base.data + sub->start_offs;
 
             /* Allocate structure to store argument information in. */
-            sub->arg_info = mem_allocate_zeroed_typed(Parrot_sub_arginfo);
+            sub->arg_info = mem_gc_allocate_zeroed_typed(INTERP,
+                    Parrot_sub_arginfo);
 
             /* If the first instruction is a get_params... */
             if (*pc == PARROT_OP_get_params_pc) {

Modified: trunk/src/runcore/cores.c
==============================================================================
--- trunk/src/runcore/cores.c	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/src/runcore/cores.c	Mon Feb 22 09:28:39 2010	(r44291)
@@ -405,7 +405,7 @@
 {
     ASSERT_ARGS(Parrot_runcore_slow_init)
 
-    Parrot_runcore_t *coredata = mem_allocate_typed(Parrot_runcore_t);
+    Parrot_runcore_t *coredata = mem_gc_allocate_zeroed_typed(interp, Parrot_runcore_t);
     coredata->name             = CONST_STRING(interp, "slow");
     coredata->id               = PARROT_SLOW_CORE;
     coredata->opinit           = PARROT_CORE_OPLIB_INIT;
@@ -435,7 +435,7 @@
 {
     ASSERT_ARGS(Parrot_runcore_fast_init)
 
-    Parrot_runcore_t *coredata = mem_allocate_typed(Parrot_runcore_t);
+    Parrot_runcore_t *coredata = mem_gc_allocate_zeroed_typed(interp, Parrot_runcore_t);
     coredata->name             = CONST_STRING(interp, "fast");
     coredata->id               = PARROT_FAST_CORE;
     coredata->opinit           = PARROT_CORE_OPLIB_INIT;
@@ -465,7 +465,7 @@
 {
     ASSERT_ARGS(Parrot_runcore_switch_init)
 
-    Parrot_runcore_t *coredata = mem_allocate_typed(Parrot_runcore_t);
+    Parrot_runcore_t *coredata = mem_gc_allocate_zeroed_typed(interp, Parrot_runcore_t);
     coredata->name             = CONST_STRING(interp, "switch");
     coredata->id               = PARROT_SWITCH_CORE;
     coredata->opinit           = PARROT_CORE_SWITCH_OPLIB_INIT;
@@ -495,7 +495,7 @@
 {
     ASSERT_ARGS(Parrot_runcore_exec_init)
 
-    Parrot_runcore_t *coredata = mem_allocate_typed(Parrot_runcore_t);
+    Parrot_runcore_t *coredata = mem_gc_allocate_zeroed_typed(interp, Parrot_runcore_t);
     coredata->name             = CONST_STRING(interp, "exec");
     coredata->id               = PARROT_EXEC_CORE;
     coredata->opinit           = PARROT_CORE_OPLIB_INIT;
@@ -523,7 +523,7 @@
 {
     ASSERT_ARGS(Parrot_runcore_gc_debug_init)
 
-    Parrot_runcore_t *coredata = mem_allocate_typed(Parrot_runcore_t);
+    Parrot_runcore_t *coredata = mem_gc_allocate_zeroed_typed(interp, Parrot_runcore_t);
     coredata->name             = CONST_STRING(interp, "gc_debug");
     coredata->id               = PARROT_GC_DEBUG_CORE;
     coredata->opinit           = PARROT_CORE_OPLIB_INIT;
@@ -553,7 +553,7 @@
 {
     ASSERT_ARGS(Parrot_runcore_debugger_init)
 
-    Parrot_runcore_t *coredata = mem_allocate_typed(Parrot_runcore_t);
+    Parrot_runcore_t *coredata = mem_gc_allocate_zeroed_typed(interp, Parrot_runcore_t);
     coredata->name             = CONST_STRING(interp, "debugger");
     coredata->id               = PARROT_DEBUGGER_CORE;
     coredata->opinit           = PARROT_CORE_OPLIB_INIT;
@@ -585,7 +585,7 @@
 {
     ASSERT_ARGS(Parrot_runcore_cgp_init)
 
-    Parrot_runcore_t *coredata = mem_allocate_typed(Parrot_runcore_t);
+    Parrot_runcore_t *coredata = mem_gc_allocate_zeroed_typed(interp, Parrot_runcore_t);
     coredata->name             = CONST_STRING(interp, "cgp");
     coredata->id               = PARROT_CGP_CORE;
     coredata->opinit           = PARROT_CORE_CGP_OPLIB_INIT;
@@ -618,7 +618,7 @@
 {
     ASSERT_ARGS(Parrot_runcore_cgoto_init)
 
-    Parrot_runcore_t *coredata = mem_allocate_typed(Parrot_runcore_t);
+    Parrot_runcore_t *coredata = mem_gc_allocate_zeroed_typed(interp, Parrot_runcore_t);
     coredata->name             = CONST_STRING(interp, "cgoto");
     coredata->id               = PARROT_CGOTO_CORE;
     coredata->opinit           = PARROT_CORE_CG_OPLIB_INIT;
@@ -999,16 +999,8 @@
         const size_t N  = interp->code->base.size;
         size_t       i, n_pics;
 
-/* Parrot_memalign_if_possible in OpenBSD allocates 256 if you ask for 312
-   -- Need to verify this, it may have been a bug elsewhere. If it works now,
-   we can remove the mem_sys_allocate_zeroed line below. */
-
-#if 0
-        void **temp = (void **)mem_sys_allocate_zeroed(N * sizeof (void *));
-#else
         void **temp = (void **)Parrot_memalign_if_possible(256,
                 N * sizeof (void *));
-#endif
         /* calc and remember pred_offset */
         CONTEXT(interp)->pred_offset = pc - (opcode_t *)temp;
 
@@ -1057,7 +1049,7 @@
     ASSERT_ARGS(load_prederef)
     const oplib_init_f init_func = get_core_op_lib_init(interp, runcore);
 
-    int (*get_op)(const char * name, int full);
+    int (*get_op)(PARROT_INTERP, const char * name, int full);
 
     get_op          = interp->op_lib->op_code;
     interp->op_lib  = init_func(1);

Modified: trunk/src/runcore/main.c
==============================================================================
--- trunk/src/runcore/main.c	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/src/runcore/main.c	Mon Feb 22 09:28:39 2010	(r44291)
@@ -166,11 +166,12 @@
 Parrot_runcore_register(PARROT_INTERP, ARGIN(Parrot_runcore_t *coredata))
 {
     ASSERT_ARGS(Parrot_runcore_register)
-    size_t num_cores = ++interp->num_cores;
+    size_t i = interp->num_cores++;
 
-    mem_realloc_n_typed(interp->cores, num_cores, Parrot_runcore_t *);
+    interp->cores = mem_gc_realloc_n_typed_zeroed(interp, interp->cores,
+            interp->num_cores, i, Parrot_runcore_t *);
 
-    interp->cores[num_cores - 1] = coredata;
+    interp->cores[i] = coredata;
 
     return 1;
 }
@@ -383,13 +384,15 @@
             if (nb < 8)
                 nb = (size_t)8;
 
-            pi->branches    = mem_allocate_n_typed(nb, Prederef_branch);
+            pi->branches    = mem_gc_allocate_n_zeroed_typed(interp, nb, Prederef_branch);
             pi->n_allocated = nb;
             pi->n_branches  = 0;
         }
         else if (pi->n_branches >= pi->n_allocated) {
+            size_t old = pi->n_allocated;
             pi->n_allocated = (size_t) (pi->n_allocated * 1.5);
-            mem_realloc_n_typed(pi->branches, pi->n_allocated, Prederef_branch);
+            pi->branches = mem_gc_realloc_n_typed_zeroed(interp,
+                    pi->branches, pi->n_allocated, old, Prederef_branch);
         }
 
         pi->branches[pi->n_branches].offs = offset;
@@ -481,7 +484,7 @@
     interp->op_func_table = PARROT_CORE_OPLIB_INIT(1)->op_func_table;
 
     if (interp->evc_func_table) {
-        mem_sys_free(interp->evc_func_table);
+        mem_gc_free(interp, interp->evc_func_table);
         interp->evc_func_table = NULL;
     }
 
@@ -589,7 +592,7 @@
     if (!interp->evc_func_table) {
         size_t i;
 
-        interp->evc_func_table = mem_allocate_n_typed(n, op_func_t);
+        interp->evc_func_table = mem_gc_allocate_n_zeroed_typed(interp, n, op_func_t);
 
         for (i = 0; i < n; ++i)
             interp->evc_func_table[i] = (op_func_t)
@@ -623,11 +626,11 @@
         if (destroy)
             (*destroy)(interp, core);
 
-        mem_sys_free(core);
+        mem_gc_free(interp, core);
     }
 
     if (interp->cores)
-        mem_sys_free(interp->cores);
+        mem_gc_free(interp, interp->cores);
 
     interp->cores    = NULL;
     interp->run_core = NULL;
@@ -640,17 +643,17 @@
     cg_lib = PARROT_CORE_CGP_OPLIB_INIT(1);
 
     if (cg_lib->op_func_table)
-        mem_sys_free(cg_lib->op_func_table);
+        mem_gc_free(interp, cg_lib->op_func_table);
     cg_lib->op_func_table = NULL;
 
     cg_lib = PARROT_CORE_CG_OPLIB_INIT(1);
     if (cg_lib->op_func_table)
-        mem_sys_free(cg_lib->op_func_table);
+        mem_gc_free(interp, cg_lib->op_func_table);
     cg_lib->op_func_table = NULL;
 #endif
 
-    mem_sys_free(interp->op_info_table);
-    mem_sys_free(interp->op_func_table);
+    mem_gc_free(interp, interp->op_info_table);
+    mem_gc_free(interp, interp->op_func_table);
     interp->op_info_table = NULL;
     interp->op_func_table = NULL;
 }
@@ -697,11 +700,11 @@
     }
 
     if (!interp->all_op_libs)
-        interp->all_op_libs = (op_lib_t **)mem_sys_allocate(
-                sizeof (op_lib_t *) * (interp->n_libs + 1));
+        interp->all_op_libs = mem_gc_allocate_n_zeroed_typed(interp,
+                interp->n_libs + 1, op_lib_t*);
     else
-        mem_realloc_n_typed(interp->all_op_libs, interp->n_libs + 1,
-                op_lib_t *);
+        mem_gc_realloc_n_typed_zeroed(interp, interp->all_op_libs,
+                interp->n_libs + 1, interp->n_libs, op_lib_t *);
 
     init_func = get_dynamic_op_lib_init(interp, lib_pmc);
     lib       = init_func(1);
@@ -726,18 +729,18 @@
 
     PARROT_ASSERT(interp->op_count == core->op_count);
 
-    new_evc_func_table = (op_func_t *)mem_sys_realloc(interp->evc_func_table,
-            sizeof (op_func_t) * n_tot);
+    new_evc_func_table = mem_gc_realloc_n_typed_zeroed(interp,
+            interp->evc_func_table, n_tot, n_old, op_func_t);
     if (core->flags & OP_FUNC_IS_ALLOCATED) {
-        new_func_table = (op_func_t *)mem_sys_realloc(core->op_func_table,
-                sizeof (op_func_t) * n_tot);
-        new_info_table = (op_info_t *)mem_sys_realloc(core->op_info_table,
-                sizeof (op_info_t) * n_tot);
+        new_func_table = mem_gc_realloc_n_typed_zeroed(interp,
+                core->op_func_table, n_tot, n_old, op_func_t);
+        new_info_table = mem_gc_realloc_n_typed_zeroed(interp,
+                core->op_info_table, n_tot, n_old, op_info_t);
     }
     else {
         /* allocate new op_func and info tables */
-        new_func_table = mem_allocate_n_typed(n_tot, op_func_t);
-        new_info_table = mem_allocate_n_typed(n_tot, op_info_t);
+        new_func_table = mem_gc_allocate_n_zeroed_typed(interp, n_tot, op_func_t);
+        new_info_table = mem_gc_allocate_n_zeroed_typed(interp, n_tot, op_info_t);
 
         /* copy old */
         for (i = 0; i < n_old; ++i) {
@@ -811,13 +814,13 @@
     PMC *lib_variant;
 
     if (cg_lib->flags & OP_FUNC_IS_ALLOCATED) {
-        ops_addr = (op_func_t *)mem_sys_realloc(cg_lib->op_func_table,
-                n_tot * sizeof (op_func_t));
+        ops_addr = mem_gc_realloc_n_typed_zeroed(interp,
+                cg_lib->op_func_table, n_tot, n_old, op_func_t);
     }
     else {
         size_t i;
 
-        ops_addr      = mem_allocate_n_typed(n_tot, op_func_t);
+        ops_addr      = mem_gc_allocate_n_zeroed_typed(interp, n_tot, op_func_t);
         cg_lib->flags = OP_FUNC_IS_ALLOCATED;
 
         for (i = 0; i < n_old; ++i)

Modified: trunk/src/runcore/profiling.c
==============================================================================
--- trunk/src/runcore/profiling.c	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/src/runcore/profiling.c	Mon Feb 22 09:28:39 2010	(r44291)
@@ -115,7 +115,7 @@
     ASSERT_ARGS(Parrot_runcore_profiling_init)
 
     Parrot_profiling_runcore_t *coredata =
-                                 mem_allocate_typed(Parrot_profiling_runcore_t);
+            mem_gc_allocate_zeroed_typed(interp, Parrot_profiling_runcore_t);
 
     coredata->name        = CONST_STRING(interp, "profiling");
     coredata->id          = PARROT_PROFILING_CORE;
@@ -160,7 +160,8 @@
     runcore->level           = 0;
     runcore->time_size       = 32;
     runcore->line_cache      = parrot_new_pointer_hash(interp);
-    runcore->time            = mem_allocate_n_typed(runcore->time_size, UHUGEINTVAL);
+    runcore->time            = mem_gc_allocate_n_typed(interp, runcore->time_size,
+                                                    UHUGEINTVAL);
 
     /* figure out what format the output should be in */
     output_cstr = Parrot_getenv(interp, CONST_STRING(interp, "PARROT_PROFILING_OUTPUT"));
@@ -273,7 +274,8 @@
 
         if (runcore->level >= runcore->time_size) {
             runcore->time_size *= 2;
-            runcore->time = mem_realloc_n_typed(runcore->time, runcore->time_size + 1, UHUGEINTVAL);
+            runcore->time = mem_gc_realloc_n_typed(interp,
+                    runcore->time, runcore->time_size + 1, UHUGEINTVAL);
         }
 
         /* store the time between DO_OP and the start of this runcore in this

Modified: trunk/src/string/api.c
==============================================================================
--- trunk/src/string/api.c	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/src/string/api.c	Mon Feb 22 09:28:39 2010	(r44291)
@@ -302,7 +302,7 @@
                        PObj_constant_FLAG);
 
     interp->const_cstring_table =
-        mem_allocate_n_zeroed_typed(n_parrot_cstrings, STRING *);
+        mem_gc_allocate_n_zeroed_typed(interp, n_parrot_cstrings, STRING *);
 
     for (i = 0; i < n_parrot_cstrings; ++i) {
         DECL_CONST_CAST;
@@ -335,7 +335,7 @@
     ASSERT_ARGS(Parrot_str_finish)
     /* all are shared between interpreters */
     if (!interp->parent_interpreter) {
-        mem_sys_free(interp->const_cstring_table);
+        mem_internal_free(interp->const_cstring_table);
         interp->const_cstring_table = NULL;
         Parrot_charsets_encodings_deinit(interp);
         parrot_hash_destroy(interp, interp->const_cstring_hash);
@@ -2483,7 +2483,7 @@
     if (!s)
         return NULL;
     else {
-        char * const p = (char *)mem_sys_allocate(s->bufused + 1);
+        char * const p = (char*)mem_internal_allocate(s->bufused + 1);
         memcpy(p, s->strstart, s->bufused);
         p[s->bufused] = '\0';
         return p;
@@ -2509,7 +2509,7 @@
 Parrot_str_free_cstring(ARGIN_NULLOK(char *p))
 {
     ASSERT_ARGS(Parrot_str_free_cstring)
-    mem_sys_free((void *)p);
+    mem_internal_free((void *)p);
 }
 
 
@@ -2538,7 +2538,7 @@
     Parrot_str_write_COW(interp, s);
 
     size   = Buffer_buflen(s);
-    memory = (char *)mem_sys_allocate(size);
+    memory = (char *)mem_internal_allocate(size);
 
     mem_sys_memcopy(memory, Buffer_bufstart(s), size);
     Buffer_bufstart(s) = memory;
@@ -2594,7 +2594,7 @@
     PObj_sysmem_CLEAR(s);
 
     /* Free up the memory */
-    mem_sys_free(memory);
+    mem_internal_free(memory);
 }
 
 

Modified: trunk/src/string/charset.c
==============================================================================
--- trunk/src/string/charset.c	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/src/string/charset.c	Mon Feb 22 09:28:39 2010	(r44291)
@@ -64,11 +64,12 @@
 static void Parrot_str_internal_register_charset_names(PARROT_INTERP)
         __attribute__nonnull__(1);
 
-static INTVAL register_charset(
+static INTVAL register_charset(PARROT_INTERP,
     ARGIN(const char *charsetname),
     ARGIN(CHARSET *charset))
         __attribute__nonnull__(1)
-        __attribute__nonnull__(2);
+        __attribute__nonnull__(2)
+        __attribute__nonnull__(3);
 
 static void register_static_converters(PARROT_INTERP)
         __attribute__nonnull__(1);
@@ -77,7 +78,8 @@
      __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp))
 #define ASSERT_ARGS_register_charset __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(charsetname) \
+       PARROT_ASSERT_ARG(interp) \
+    , PARROT_ASSERT_ARG(charsetname) \
     , PARROT_ASSERT_ARG(charset))
 #define ASSERT_ARGS_register_static_converters __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp))
@@ -98,10 +100,10 @@
 PARROT_CAN_RETURN_NULL
 PARROT_MALLOC
 CHARSET *
-Parrot_new_charset(SHIM_INTERP)
+Parrot_new_charset(PARROT_INTERP)
 {
     ASSERT_ARGS(Parrot_new_charset)
-    return mem_allocate_typed(CHARSET);
+    return mem_gc_allocate_zeroed_typed(interp, CHARSET);
 }
 
 /*
@@ -117,7 +119,7 @@
 
 PARROT_EXPORT
 void
-Parrot_charsets_encodings_deinit(SHIM_INTERP)
+Parrot_charsets_encodings_deinit(PARROT_INTERP)
 {
     ASSERT_ARGS(Parrot_charsets_encodings_deinit)
     int i;
@@ -125,13 +127,13 @@
 
     for (i = 0; i < n; ++i) {
         if (all_charsets->set[i].n_converters)
-            mem_sys_free(all_charsets->set[i].to_converters);
-        mem_sys_free(all_charsets->set[i].charset);
+            mem_gc_free(interp, all_charsets->set[i].to_converters);
+        mem_gc_free(interp, all_charsets->set[i].charset);
     }
-    mem_sys_free(all_charsets->set);
-    mem_sys_free(all_charsets);
+    mem_gc_free(interp, all_charsets->set);
+    mem_gc_free(interp, all_charsets);
     all_charsets = NULL;
-    parrot_deinit_encodings();
+    parrot_deinit_encodings(interp);
 }
 
 /*
@@ -311,8 +313,8 @@
 
 /*
 
-=item C<static INTVAL register_charset(const char *charsetname, CHARSET
-*charset)>
+=item C<static INTVAL register_charset(PARROT_INTERP, const char *charsetname,
+CHARSET *charset)>
 
 Adds a new charset C<charset> with name <charsetname> to the list of
 all charsets. Returns 0 and does nothing if a charset with that name
@@ -323,7 +325,8 @@
 */
 
 static INTVAL
-register_charset(ARGIN(const char *charsetname), ARGIN(CHARSET *charset))
+register_charset(PARROT_INTERP, ARGIN(const char *charsetname),
+        ARGIN(CHARSET *charset))
 {
     ASSERT_ARGS(register_charset)
     int i;
@@ -339,10 +342,10 @@
      * loading of charsets from inside threads
      */
     if (!n)
-        all_charsets->set = mem_allocate_typed(One_charset);
+        all_charsets->set = mem_gc_allocate_zeroed_typed(interp, One_charset);
     else
-        all_charsets->set = (One_charset *)mem_sys_realloc(all_charsets->set,
-                (n + 1) * sizeof (One_charset));
+        all_charsets->set = mem_gc_realloc_n_typed_zeroed(interp,
+                all_charsets->set, n + 1, n, One_charset);
 
     all_charsets->n_charsets++;
     all_charsets->set[n].charset      = charset;
@@ -429,29 +432,29 @@
 
 PARROT_EXPORT
 INTVAL
-Parrot_register_charset(SHIM_INTERP, ARGIN(const char *charsetname),
+Parrot_register_charset(PARROT_INTERP, ARGIN(const char *charsetname),
         ARGIN(CHARSET *charset))
 {
     ASSERT_ARGS(Parrot_register_charset)
     if (!all_charsets) {
-        all_charsets             = mem_allocate_typed(All_charsets);
+        all_charsets             = mem_gc_allocate_zeroed_typed(interp, All_charsets);
         all_charsets->set        = NULL;
         all_charsets->n_charsets = 0;
     }
 
     if (STREQ("binary", charsetname)) {
         Parrot_binary_charset_ptr = charset;
-        return register_charset(charsetname, charset);
+        return register_charset(interp, charsetname, charset);
     }
 
     if (STREQ("iso-8859-1", charsetname)) {
         Parrot_iso_8859_1_charset_ptr = charset;
-        return register_charset(charsetname, charset);
+        return register_charset(interp, charsetname, charset);
     }
 
     if (STREQ("unicode", charsetname)) {
         Parrot_unicode_charset_ptr = charset;
-        return register_charset(charsetname, charset);
+        return register_charset(interp, charsetname, charset);
     }
 
     if (STREQ("ascii", charsetname)) {
@@ -459,7 +462,7 @@
             Parrot_default_charset_ptr = charset;
 
         Parrot_ascii_charset_ptr = charset;
-        return register_charset(charsetname, charset);
+        return register_charset(interp, charsetname, charset);
     }
 
     return 0;
@@ -594,7 +597,7 @@
 
 PARROT_EXPORT
 void
-Parrot_register_charset_converter(SHIM_INTERP,
+Parrot_register_charset_converter(PARROT_INTERP,
         ARGIN(const CHARSET *lhs), ARGIN(CHARSET *rhs),
         ARGIN(charset_converter_t func))
 {
@@ -608,11 +611,11 @@
             const int nc = left->n_converters++;
 
             if (nc) {
-                left->to_converters = (To_converter *)mem_sys_realloc(
-                        left->to_converters, sizeof (To_converter) * (nc + 1));
+                left->to_converters = mem_gc_realloc_n_typed_zeroed(interp,
+                        left->to_converters, nc + 1, nc, To_converter);
             }
             else
-                left->to_converters = (To_converter *)mem_sys_allocate(sizeof (To_converter));
+                left->to_converters = mem_gc_allocate_zeroed_typed(interp, To_converter);
             left->to_converters[nc].to = rhs;
             left->to_converters[nc].func = func;
         }

Modified: trunk/src/string/encoding.c
==============================================================================
--- trunk/src/string/encoding.c	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/src/string/encoding.c	Mon Feb 22 09:28:39 2010	(r44291)
@@ -24,14 +24,16 @@
 /* HEADERIZER BEGIN: static */
 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END.  Your changes will be lost. */
 
-static INTVAL register_encoding(SHIM_INTERP,
+static INTVAL register_encoding(PARROT_INTERP,
     ARGIN(const char *encodingname),
     ARGIN(ENCODING *encoding))
+        __attribute__nonnull__(1)
         __attribute__nonnull__(2)
         __attribute__nonnull__(3);
 
 #define ASSERT_ARGS_register_encoding __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(encodingname) \
+       PARROT_ASSERT_ARG(interp) \
+    , PARROT_ASSERT_ARG(encodingname) \
     , PARROT_ASSERT_ARG(encoding))
 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END.  Your changes will be lost. */
 /* HEADERIZER END: static */
@@ -56,7 +58,7 @@
 
 /*
 
-=item C<void parrot_deinit_encodings(void)>
+=item C<void parrot_deinit_encodings(PARROT_INTERP)>
 
 Deinitialize encodings and free all memory used by them.
 
@@ -65,17 +67,17 @@
 */
 
 void
-parrot_deinit_encodings(void)
+parrot_deinit_encodings(PARROT_INTERP)
 {
     ASSERT_ARGS(parrot_deinit_encodings)
     const int n = all_encodings->n_encodings;
     int i;
 
     for (i = 0; i < n; ++i) {
-        mem_sys_free(all_encodings->enc[i].encoding);
+        mem_gc_free(interp, all_encodings->enc[i].encoding);
     }
-    mem_sys_free(all_encodings->enc);
-    mem_sys_free(all_encodings);
+    mem_gc_free(interp, all_encodings->enc);
+    mem_gc_free(interp, all_encodings);
     all_encodings = NULL;
 }
 
@@ -93,10 +95,10 @@
 PARROT_MALLOC
 PARROT_CANNOT_RETURN_NULL
 ENCODING *
-Parrot_new_encoding(SHIM_INTERP)
+Parrot_new_encoding(PARROT_INTERP)
 {
     ASSERT_ARGS(Parrot_new_encoding)
-    return mem_allocate_typed(ENCODING);
+    return mem_gc_allocate_typed(interp, ENCODING);
 }
 
 /*
@@ -298,7 +300,7 @@
 */
 
 static INTVAL
-register_encoding(SHIM_INTERP, ARGIN(const char *encodingname),
+register_encoding(PARROT_INTERP, ARGIN(const char *encodingname),
         ARGIN(ENCODING *encoding))
 {
     ASSERT_ARGS(register_encoding)
@@ -315,10 +317,10 @@
      * loading of encodings from inside threads
      */
     if (!n)
-        all_encodings->enc = mem_allocate_typed(One_encoding);
+        all_encodings->enc = mem_gc_allocate_zeroed_typed(interp, One_encoding);
     else
-        all_encodings->enc = (One_encoding*)mem_sys_realloc(all_encodings->enc,
-                (n + 1) * sizeof (One_encoding));
+        all_encodings->enc = mem_gc_realloc_n_typed_zeroed(interp,
+                all_encodings->enc, n + 1, n, One_encoding);
     all_encodings->n_encodings++;
     all_encodings->enc[n].encoding = encoding;
 
@@ -367,7 +369,7 @@
 {
     ASSERT_ARGS(Parrot_register_encoding)
     if (!all_encodings) {
-        all_encodings = mem_allocate_typed(All_encodings);
+        all_encodings = mem_gc_allocate_zeroed_typed(interp, All_encodings);
         all_encodings->n_encodings = 0;
         all_encodings->enc = NULL;
     }

Modified: trunk/src/string/encoding/utf16.c
==============================================================================
--- trunk/src/string/encoding/utf16.c	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/src/string/encoding/utf16.c	Mon Feb 22 09:28:39 2010	(r44291)
@@ -298,7 +298,7 @@
 #if PARROT_HAS_ICU
     if (in_place) {
         /* need intermediate memory */
-        p = (UChar *)mem_sys_allocate(src_len * sizeof (UChar));
+        p = mem_gc_allocate_n_typed(interp, src_len, UChar);
     }
     else {
         Parrot_gc_reallocate_string_storage(interp, dest, sizeof (UChar) * src_len);
@@ -319,7 +319,7 @@
              * have to resize - required len in UChars is in dest_len
              */
             if (in_place)
-                p = (UChar *)mem_sys_realloc(p, dest_len * sizeof (UChar));
+                p = mem_gc_realloc_n_typed(interp, p, dest_len, UChar);
             else {
                 result->bufused = dest_len * sizeof (UChar);
                 Parrot_gc_reallocate_string_storage(interp, dest,
@@ -335,7 +335,7 @@
     if (in_place) {
         Parrot_gc_reallocate_string_storage(interp, src, src->bufused);
         memcpy(src->strstart, p, src->bufused);
-        mem_sys_free(p);
+        mem_gc_free(interp, p);
     }
     result->charset  = Parrot_unicode_charset_ptr;
     result->encoding = Parrot_utf16_encoding_ptr;

Modified: trunk/src/string/encoding/utf8.c
==============================================================================
--- trunk/src/string/encoding/utf8.c	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/src/string/encoding/utf8.c	Mon Feb 22 09:28:39 2010	(r44291)
@@ -608,7 +608,7 @@
 
     if (in_place) {
         /* need intermediate memory */
-        p = (unsigned char *)mem_sys_allocate(src_len);
+        p = mem_gc_allocate_n_typed(interp, src_len, unsigned char);
     }
     else {
         Parrot_gc_reallocate_string_storage(interp, dest, src_len);
@@ -631,7 +631,7 @@
                     need = 16;
                 dest_len += need;
                 if (in_place)
-                    p = (unsigned char *)mem_sys_realloc(p, dest_len);
+                    p = mem_gc_realloc_n_typed(interp, p, dest_len, unsigned char);
                 else {
                     result->bufused = dest_pos;
                     Parrot_gc_reallocate_string_storage(interp, dest, dest_len);
@@ -648,7 +648,7 @@
     if (in_place) {
         Parrot_gc_reallocate_string_storage(interp, src, src->bufused);
         memcpy(src->strstart, p, src->bufused);
-        mem_sys_free(p);
+        mem_gc_free(interp, p);
     }
     return result;
 }

Modified: trunk/src/string/primitives.c
==============================================================================
--- trunk/src/string/primitives.c	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/src/string/primitives.c	Mon Feb 22 09:28:39 2010	(r44291)
@@ -357,7 +357,7 @@
 
     /* 2 for the beginning and ending quote chars */
     const size_t newlen = oldlen - 2;
-    char * const copy   = (char *)mem_sys_allocate(newlen);
+    char * const copy   = (char *)mem_internal_allocate(newlen);
 
     memcpy(copy, old + 1, newlen);
     copy[newlen - 1] = 0;

Modified: trunk/src/thread.c
==============================================================================
--- trunk/src/thread.c	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/src/thread.c	Mon Feb 22 09:28:39 2010	(r44291)
@@ -257,7 +257,7 @@
     if (shared_gc_info) {
         COND_DESTROY(shared_gc_info->gc_cond);
         PARROT_ATOMIC_INT_DESTROY(shared_gc_info->gc_block_level);
-        mem_sys_free(shared_gc_info);
+        mem_internal_free(shared_gc_info);
         shared_gc_info = NULL;
     }
 }
@@ -1007,8 +1007,8 @@
         if (cur == queue->head)
             queue->head = cur->next;
 
-        mem_sys_free(ev);
-        mem_sys_free(cur);
+        mem_internal_free(ev);
+        mem_internal_free(cur);
         cur = NULL;
         DEBUG_ONLY(fprintf(stderr, "%p: remove_queued_suspend_gc: got one\n", interp));
     }
@@ -1560,18 +1560,18 @@
         PARROT_ASSERT(!interpreter_array);
         PARROT_ASSERT(n_interpreters == 0);
 
-        interpreter_array    = mem_allocate_typed(Interp *);
+        interpreter_array    = mem_internal_allocate_typed(Interp *);
         interpreter_array[0] = interp;
         n_interpreters       = 1;
 
-        shared_gc_info = (Shared_gc_info *)mem_sys_allocate_zeroed(sizeof (*shared_gc_info));
+        shared_gc_info = (Shared_gc_info *)mem_internal_allocate_zeroed(sizeof (*shared_gc_info));
         COND_INIT(shared_gc_info->gc_cond);
         PARROT_ATOMIC_INT_INIT(shared_gc_info->gc_block_level);
         PARROT_ATOMIC_INT_SET(shared_gc_info->gc_block_level, 0);
 
         /* XXX try to defer this until later */
         PARROT_ASSERT(interp == interpreter_array[0]);
-        interp->thread_data      = mem_allocate_zeroed_typed(Thread_data);
+        interp->thread_data      = mem_internal_allocate_zeroed_typed(Thread_data);
         INTERPRETER_LOCK_INIT(interp);
         interp->thread_data->tid = 0;
 
@@ -1579,7 +1579,7 @@
     }
 
 
-    new_interp->thread_data = mem_allocate_zeroed_typed(Thread_data);
+    new_interp->thread_data = mem_internal_allocate_zeroed_typed(Thread_data);
     INTERPRETER_LOCK_INIT(new_interp);
     running_threads++;
     if (Interp_debug_TEST(interp, PARROT_THREAD_DEBUG_FLAG))
@@ -1596,7 +1596,7 @@
     }
 
     /* need to resize */
-    interpreter_array = (Interp **)mem_sys_realloc(interpreter_array,
+    interpreter_array = (Interp **)mem_internal_realloc(interpreter_array,
             (n_interpreters + 1) * sizeof (Interp *));
 
     interpreter_array[n_interpreters] = new_interp;

Modified: trunk/src/tsq.c
==============================================================================
--- trunk/src/tsq.c	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/src/tsq.c	Mon Feb 22 09:28:39 2010	(r44291)
@@ -374,7 +374,7 @@
 queue_init(UINTVAL prio)
 {
     ASSERT_ARGS(queue_init)
-    QUEUE * const queue = mem_allocate_typed(QUEUE);
+    QUEUE * const queue = mem_internal_allocate_typed(QUEUE);
 
     queue->head = queue->tail = NULL;
     queue->max_prio = prio;

Modified: trunk/src/utils.c
==============================================================================
--- trunk/src/utils.c	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/src/utils.c	Mon Feb 22 09:28:39 2010	(r44291)
@@ -845,9 +845,9 @@
 
     /* allocate space for data structures */
     /* NOTA: data structures could be kept allocated somewhere waiting to get reused...*/
-    c.nb_succ      = nb_succ      = mem_allocate_n_zeroed_typed(n_regs, int);
-    c.backup       = backup       = mem_allocate_n_zeroed_typed(n_regs, int);
-    c.reg_to_index = reg_to_index = mem_allocate_n_zeroed_typed(max_reg, int);
+    c.nb_succ      = nb_succ      = mem_gc_allocate_n_zeroed_typed(interp, n_regs, int);
+    c.backup       = backup       = mem_gc_allocate_n_zeroed_typed(interp, n_regs, int);
+    c.reg_to_index = reg_to_index = mem_gc_allocate_n_zeroed_typed(interp, max_reg, int);
 
     /* init backup array */
     for (i = 0; i < n_regs; i++)
@@ -883,9 +883,9 @@
         }
     }
 
-    mem_sys_free(nb_succ);
-    mem_sys_free(reg_to_index);
-    mem_sys_free(backup);
+    mem_gc_free(interp, nb_succ);
+    mem_gc_free(interp, reg_to_index);
+    mem_gc_free(interp, backup);
 }
 
 typedef INTVAL (*sort_func_t)(PARROT_INTERP, void *, void *);

Modified: trunk/src/vtables.c
==============================================================================
--- trunk/src/vtables.c	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/src/vtables.c	Mon Feb 22 09:28:39 2010	(r44291)
@@ -43,7 +43,7 @@
 Parrot_new_vtable(SHIM_INTERP)
 {
     ASSERT_ARGS(Parrot_new_vtable)
-    return mem_allocate_zeroed_typed(VTABLE);
+    return mem_internal_allocate_zeroed_typed(VTABLE);
 }
 
 /*
@@ -63,7 +63,7 @@
 Parrot_clone_vtable(PARROT_INTERP, ARGIN(const VTABLE *base_vtable))
 {
     ASSERT_ARGS(Parrot_clone_vtable)
-    VTABLE * const new_vtable = mem_allocate_typed(VTABLE);
+    VTABLE * const new_vtable = mem_internal_allocate_typed(VTABLE);
 
     STRUCT_COPY(new_vtable, base_vtable);
 
@@ -108,7 +108,7 @@
             ro_vtable->isa_hash = NULL;
         }
 
-        mem_sys_free(ro_vtable);
+        mem_internal_free(ro_vtable);
         vtable->ro_variant_vtable = NULL;
     }
 
@@ -117,7 +117,7 @@
         vtable->isa_hash = NULL;
     }
 
-    mem_sys_free(vtable);
+    mem_internal_free(vtable);
 }
 
 /*
@@ -134,7 +134,7 @@
 parrot_alloc_vtables(PARROT_INTERP)
 {
     ASSERT_ARGS(parrot_alloc_vtables)
-    interp->vtables          = mem_allocate_n_zeroed_typed(PARROT_MAX_CLASSES, VTABLE *);
+    interp->vtables          = mem_internal_allocate_n_zeroed_typed(PARROT_MAX_CLASSES, VTABLE *);
     interp->n_vtable_max     = enum_class_core_max;
     interp->n_vtable_alloced = PARROT_MAX_CLASSES - 1;
 }
@@ -162,7 +162,7 @@
 
     /* arrays start at zero, but we compare type numbers starting at 1 */
     interp->n_vtable_alloced = new_max - 1;
-    interp->vtables          = (VTABLE **)mem_sys_realloc_zeroed(
+    interp->vtables          = (VTABLE **)mem_internal_realloc_zeroed(
         interp->vtables, new_size, old_size);
 }
 
@@ -187,7 +187,7 @@
     for (i = 0; i < interp->n_vtable_max; i++)
         Parrot_destroy_vtable(interp, interp->vtables[i]);
 
-    mem_sys_free(interp->vtables);
+    mem_internal_free(interp->vtables);
 }
 
 /*

Modified: trunk/t/pmc/fixedbooleanarray.t
==============================================================================
--- trunk/t/pmc/fixedbooleanarray.t	Mon Feb 22 06:22:46 2010	(r44290)
+++ trunk/t/pmc/fixedbooleanarray.t	Mon Feb 22 09:28:39 2010	(r44291)
@@ -17,7 +17,7 @@
 
 =cut
 
-.const int TESTS = 36
+.const int TESTS = 37
 
 .sub 'test' :main
     .include 'test_more.pir'
@@ -292,18 +292,17 @@
     size = 1564
     $P0 = size
 
-    $P0.'fill'(0)
+    # Fresh array is empty.
     i = 0
     result = 0
-    $I1 = 0
-  fill_false_loop:
-    unless i < size goto fill_false_end
+  initial_false_loop:
+    unless i < size goto initial_false_end
     $I0 = $P0[i]
     result = or result, $I0
     inc i
-    goto fill_false_loop
-  fill_false_end:
-    nok(result, "Fill with 0")
+    goto initial_false_loop
+  initial_false_end:
+    nok(result, "Fresh array filled with 0")
 
     $P0.'fill'(1)
     i = 0
@@ -317,6 +316,20 @@
     goto fill_true_loop
   fill_true_end:
     ok(result, "Fill with 1")
+
+    $P0.'fill'(0)
+    i = 0
+    result = 0
+    $I1 = 0
+  fill_false_loop:
+    unless i < size goto fill_false_end
+    $I0 = $P0[i]
+    result = or result, $I0
+    inc i
+    goto fill_false_loop
+  fill_false_end:
+    nok(result, "Fill with 0")
+
 .end
 
 


More information about the parrot-commits mailing list