develooper Front page | perl.cvs.parrot | Postings from December 2008

[svn:parrot] r34722 - in trunk: compilers/imcc src src/charset src/encodings src/gc src/stm

From:
infinoid
Date:
December 31, 2008 11:20
Subject:
[svn:parrot] r34722 - in trunk: compilers/imcc src src/charset src/encodings src/gc src/stm
Message ID:
20081231192008.87C08CBA08@x12.develooper.com
Author: infinoid
Date: Wed Dec 31 11:20:05 2008
New Revision: 34722

Modified:
   trunk/compilers/imcc/cfg.c
   trunk/compilers/imcc/imc.c
   trunk/compilers/imcc/imcc.y
   trunk/compilers/imcc/instructions.c
   trunk/compilers/imcc/main.c
   trunk/compilers/imcc/optimizer.c
   trunk/compilers/imcc/parser_util.c
   trunk/src/charset/ascii.c
   trunk/src/charset/binary.c
   trunk/src/charset/iso-8859-1.c
   trunk/src/charset/unicode.c
   trunk/src/encodings/fixed_8.c
   trunk/src/encodings/ucs2.c
   trunk/src/encodings/utf16.c
   trunk/src/encodings/utf8.c
   trunk/src/events.c
   trunk/src/gc/register.c
   trunk/src/gc/res_lea.c
   trunk/src/gc/resources.c
   trunk/src/gc/smallobject.c
   trunk/src/hash.c
   trunk/src/pmc_freeze.c
   trunk/src/runops_cores.c
   trunk/src/scheduler.c
   trunk/src/stacks.c
   trunk/src/stm/backend.c
   trunk/src/stm/waitlist.c
   trunk/src/string.c
   trunk/src/string_primitives.c
   trunk/src/sub.c
   trunk/src/thread.c
   trunk/src/trace.c
   trunk/src/tsq.c
   trunk/src/vtables.c
   trunk/src/warnings.c

Log:
[headerizer] Use the new assert macros in a bunch of functions.

Modified: trunk/compilers/imcc/cfg.c
==============================================================================
--- trunk/compilers/imcc/cfg.c	(original)
+++ trunk/compilers/imcc/cfg.c	Wed Dec 31 11:20:05 2008
@@ -203,6 +203,7 @@
 check_invoke_type(PARROT_INTERP, ARGIN(const IMC_Unit    *unit),
                                  ARGIN(const Instruction *ins))
 {
+    ASSERT_ARGS(check_invoke_type);
     /* 1) pcc sub call or yield */
     if (ins->type & (ITPCCSUB | ITPCCYIELD))
         return INVOKE_SUB_CALL;
@@ -246,6 +247,7 @@
     const SymHash * const hsh = &unit->hash;
     int                   nu  = 0;
     unsigned int          i;
+    ASSERT_ARGS(find_basic_blocks);
 
     IMCC_info(interp, 2, "find_basic_blocks\n");
     init_basic_blocks(unit);
@@ -353,6 +355,7 @@
         ARGMOD(Basic_block *bb), ARGIN(const SymReg *label))
 {
     const Instruction *ins;
+    ASSERT_ARGS(bb_check_set_addr);
 
     for (ins = unit->instructions; ins; ins = ins->next) {
         if ((ins->opnum == PARROT_OP_set_addr_p_ic)
@@ -390,6 +393,7 @@
     Basic_block *last = NULL;
     unsigned int i;
     int changes;
+    ASSERT_ARGS(build_cfg);
 
     IMCC_info(interp, 2, "build_cfg\n");
 
@@ -531,6 +535,7 @@
 {
     Instruction         *ins;
     const SymReg * const r = find_sym(interp, label->name);
+    ASSERT_ARGS(bb_findadd_edge);
 
     if (r && (r->type & VTADDRESS) && r->first_ins)
         bb_add_edge(unit, from, unit->bb_list[r->first_ins->bbindex]);
@@ -570,6 +575,7 @@
                      ARGIN(const Basic_block *to))
 {
     const Edge *pred = to->pred_list;
+    ASSERT_ARGS(blocks_are_connected);
 
     while (pred) {
         /*already linked*/
@@ -598,6 +604,7 @@
                                     ARGMOD(Basic_block *to))
 {
     Edge *e;
+    ASSERT_ARGS(bb_add_edge);
     if (blocks_are_connected(from, to))
         return;
 
@@ -638,6 +645,7 @@
 static void
 bb_remove_edge(ARGMOD(IMC_Unit *unit), ARGMOD(Edge *edge))
 {
+    ASSERT_ARGS(bb_remove_edge);
     if (edge->from->succ_list == edge) {
         edge->from->succ_list = edge->succ_next;
     }
@@ -693,6 +701,7 @@
 free_edge(ARGMOD(IMC_Unit *unit))
 {
     Edge *e;
+    ASSERT_ARGS(free_edge);
 
     for (e = unit->edge_list; e;) {
         Edge * const next = e->next;
@@ -720,7 +729,7 @@
 {
     Edge *e = unit->edge_list;
     int   i = 0;
-
+    ASSERT_ARGS(edge_count);
     while (e) {
         i++;
         e = e->next;
@@ -746,6 +755,7 @@
 {
     SymReg  ** const reglist = unit->reglist;
     unsigned int     i;
+    ASSERT_ARGS(life_analysis);
 
     IMCC_info(interp, 2, "life_analysis\n");
 
@@ -768,6 +778,7 @@
 analyse_life_symbol(ARGIN(const IMC_Unit *unit), ARGMOD(SymReg* r))
 {
     unsigned int i;
+    ASSERT_ARGS(analyse_life_symbol);
 
 #if IMC_TRACE_HIGH
     fprintf(stderr, "cfg.c: analyse_life_symbol(%s)\n", r->name);
@@ -829,6 +840,7 @@
 void
 free_life_info(ARGIN(const IMC_Unit *unit), ARGMOD(SymReg *r))
 {
+    ASSERT_ARGS(free_life_info);
 #if IMC_TRACE_HIGH
     fprintf(stderr, "free_life_into(%s)\n", r->name);
 #endif
@@ -864,6 +876,7 @@
     Life_range  * const l        = make_life_range(r, bb->index);
     Instruction         *special = NULL;
     Instruction         *ins;
+    ASSERT_ARGS(analyse_life_block);
 
     for (ins = bb->start; ins; ins = ins->next) {
         int is_alias;
@@ -942,6 +955,7 @@
     Edge        *edge;
     Life_range  *l;
     Basic_block *pred;
+    ASSERT_ARGS(propagate_need);
 
     /* every predecessor of a LF_lv_in block must be in LF_lv_out
      * and, unless itself is LV_def, this should be propagated to its
@@ -1020,6 +1034,7 @@
     Set **dominators;
 
     const unsigned int n = unit->n_basic_blocks;
+    ASSERT_ARGS(compute_dominators);
     IMCC_info(interp, 2, "compute_dominators\n");
 
     unit->idoms          = mem_allocate_n_zeroed_typed(n, int);
@@ -1150,6 +1165,7 @@
     const int    n                   = unit->n_basic_blocks;
     Set ** const dominance_frontiers = unit->dominance_frontiers =
         mem_allocate_n_typed(n, Set *);
+    ASSERT_ARGS(compute_dominance_frontiers);
 
     IMCC_info(interp, 2, "compute_dominance_frontiers\n");
 
@@ -1206,6 +1222,7 @@
 static void
 free_dominators(ARGMOD(IMC_Unit *unit))
 {
+    ASSERT_ARGS(free_dominators);
     if (unit->dominators) {
         unsigned int i;
 
@@ -1233,6 +1250,7 @@
 static void
 free_dominance_frontiers(ARGMOD(IMC_Unit *unit))
 {
+    ASSERT_ARGS(free_dominance_frontiers);
     if (unit->dominance_frontiers) {
         unsigned int i;
 
@@ -1265,6 +1283,7 @@
     int          n_loops   = (int)unit->n_loops;
     int          i, k, changed;
     unsigned int j;
+    ASSERT_ARGS(sort_loops);
 
     for (i = 0; i < n_loops; i++) {
         loop_info[i]->size = 0;
@@ -1340,6 +1359,7 @@
 find_loops(PARROT_INTERP, ARGMOD(IMC_Unit *unit))
 {
     unsigned int i;
+    ASSERT_ARGS(find_loops);
 
     IMCC_info(interp, 2, "find_loops\n");
 
@@ -1378,6 +1398,7 @@
 {
     Edge *edge;
     int   preheader = -1;
+    ASSERT_ARGS(natural_preheader);
 
     for (edge = unit->bb_list[loop_info->header]->pred_list;
          edge;
@@ -1424,6 +1445,7 @@
 
     unsigned int i;
     int n_loops;
+    ASSERT_ARGS(mark_loop);
 
     /* look from where loop was entered */
     for (i = 0, edge=header->pred_list; edge; edge=edge->pred_next)
@@ -1501,6 +1523,7 @@
 free_loops(ARGMOD(IMC_Unit *unit))
 {
     int i;
+    ASSERT_ARGS(free_loops);
 
     for (i = 0; i < unit->n_loops; i++) {
         set_free(unit->loop_info[i]->loop);
@@ -1530,6 +1553,7 @@
 search_predecessors_not_in(ARGIN(const Basic_block *node), ARGMOD(Set *s))
 {
    Edge *edge;
+   ASSERT_ARGS(search_predecessors_not_in);
 
    for (edge = node->pred_list; edge; edge = edge->pred_next) {
         Basic_block * const pred = edge->from;
@@ -1557,6 +1581,8 @@
 static void
 init_basic_blocks(ARGMOD(IMC_Unit *unit))
 {
+    ASSERT_ARGS(init_basic_blocks);
+
     if (!unit->bb_list)
         clear_basic_blocks(unit);
 
@@ -1581,6 +1607,8 @@
 void
 clear_basic_blocks(ARGMOD(IMC_Unit *unit))
 {
+    ASSERT_ARGS(clear_basic_blocks);
+
     if (unit->bb_list) {
         unsigned int i;
 
@@ -1615,8 +1643,7 @@
 {
     Basic_block * const bb = mem_allocate_typed(Basic_block);
     int                 n  = unit->n_basic_blocks;
-
-    PARROT_ASSERT(ins);
+    ASSERT_ARGS(make_basic_block);
 
     bb->start      = ins;
     bb->end        = ins;
@@ -1656,6 +1683,7 @@
 make_life_range(ARGMOD(SymReg *r), int idx)
 {
     Life_range * const l = mem_allocate_zeroed_typed(Life_range);
+    ASSERT_ARGS(make_life_range);
     r->life_info[idx]    = l;
 
     return l;

Modified: trunk/compilers/imcc/imc.c
==============================================================================
--- trunk/compilers/imcc/imc.c	(original)
+++ trunk/compilers/imcc/imc.c	Wed Dec 31 11:20:05 2008
@@ -66,6 +66,7 @@
 {
     /* compile all units created during the parse */
     IMC_Unit *unit;
+    ASSERT_ARGS(imc_compile_all_units);
 
 #if ! COMPILE_IMMEDIATE
     for (unit = IMCC_INFO(interp)->imc_units; unit;) {
@@ -113,6 +114,7 @@
 void
 imc_compile_unit(PARROT_INTERP, ARGIN(IMC_Unit *unit))
 {
+    ASSERT_ARGS(imc_compile_unit);
     /* Not much here for now except the allocator */
     IMCC_INFO(interp)->cur_unit = unit;
 
@@ -135,6 +137,7 @@
 void
 imc_cleanup(PARROT_INTERP, ARGIN_NULLOK(void *yyscanner))
 {
+    ASSERT_ARGS(imc_cleanup);
     IMCC_pop_parser_state(interp, yyscanner);
     clear_globals(interp);
     mem_sys_free(IMCC_INFO(interp)->ghash.data);
@@ -158,6 +161,7 @@
 imc_new_unit(IMC_Unit_Type t)
 {
     IMC_Unit * const unit = mem_allocate_zeroed_typed(IMC_Unit);
+    ASSERT_ARGS(imc_new_unit);
     create_symhash(&unit->hash);
     unit->type = t;
     return unit;
@@ -182,6 +186,7 @@
 {
     IMC_Unit   * const unit     = imc_new_unit(t);
     imc_info_t * const imc_info = IMCC_INFO(interp);
+    ASSERT_ARGS(imc_open_unit);
 
     if (!imc_info->imc_units)
         imc_info->imc_units = unit;
@@ -218,6 +223,7 @@
 void
 imc_close_unit(PARROT_INTERP, ARGIN_NULLOK(IMC_Unit *unit))
 {
+    ASSERT_ARGS(imc_close_unit);
 #if COMPILE_IMMEDIATE
     if (unit)
         imc_compile_unit(interp, unit);
@@ -241,6 +247,7 @@
 imc_free_unit(PARROT_INTERP, ARGMOD(IMC_Unit *unit))
 {
     imc_info_t * const imc = IMCC_INFO(interp);
+    ASSERT_ARGS(imc_free_unit);
 
 #if IMC_TRACE_HIGH
     fprintf(stderr, "imc_free_unit()\n");

Modified: trunk/compilers/imcc/imcc.y
==============================================================================
--- trunk/compilers/imcc/imcc.y	(original)
+++ trunk/compilers/imcc/imcc.y	Wed Dec 31 11:20:05 2008
@@ -327,6 +327,7 @@
     va_list ap;
     SymReg *r[IMCC_MAX_FIX_REGS];
     int i;
+    ASSERT_ARGS(mk_i);
 
     for (p = opname, q = fmt; *q && *q != ' ';)
         *p++ = *q++;
@@ -359,6 +360,7 @@
     SymReg *rhs;
     SymReg *r[3];
     char   *name;
+    ASSERT_ARGS(mk_pmc_const);
 
     if (left->type == VTADDRESS) {      /* IDENTIFIER */
         if (IMCC_INFO(interp)->state->pasm_file) {
@@ -414,6 +416,7 @@
     const int ascii       = (*constant == '\'' || *constant == '"');
     char   *unquoted_name = str_dup(name + 1);
     size_t  name_length   = strlen(unquoted_name) - 1;
+    ASSERT_ARGS(mk_pmc_const_named);
 
     unquoted_name[name_length] = '\0';
 
@@ -466,6 +469,7 @@
          ARGMOD(SymReg **r), int n, int keyv, int emit)
 {
     int i;
+    ASSERT_ARGS(func_ins);
     /* shift regs up by 1 */
     for (i = n - 1; i >= 0; --i)
         r[i+1] = r[i];
@@ -483,6 +487,7 @@
 static void
 clear_state(PARROT_INTERP)
 {
+    ASSERT_ARGS(clear_state);
     IMCC_INFO(interp) -> nargs = 0;
     IMCC_INFO(interp) -> keyvec = 0;
 }
@@ -493,6 +498,7 @@
 {
 
     Instruction * const ins = _mk_instruction("", "%s:", 1, &r0, 0);
+    ASSERT_ARGS(ins_label);
     ins->type               = ITLABEL;
     r0->first_ins           = ins;
 
@@ -507,6 +513,7 @@
 iLABEL(PARROT_INTERP, ARGMOD_NULLOK(IMC_Unit *unit), ARGMOD(SymReg *r0))
 {
     Instruction * const i = INS_LABEL(interp, unit, r0, 1);
+    ASSERT_ARGS(ilabel);
     i->line               = IMCC_INFO(interp)->line;
 
     clear_state(interp);
@@ -518,6 +525,7 @@
 iSUBROUTINE(PARROT_INTERP, ARGMOD_NULLOK(IMC_Unit *unit), ARGMOD(SymReg *r))
 {
     Instruction * const i = iLABEL(interp, unit, r);
+    ASSERT_ARGS(isubroutine);
 
     r->type    = (r->type & VT_ENCODED) ? VT_PCC_SUB|VT_ENCODED : VT_PCC_SUB;
     r->pcc_sub = mem_allocate_zeroed_typed(pcc_sub_t);
@@ -537,6 +545,7 @@
 iINDEXFETCH(PARROT_INTERP, ARGMOD(IMC_Unit *unit), ARGIN(SymReg *r0), ARGIN(SymReg *r1),
         ARGIN(SymReg *r2))
 {
+    ASSERT_ARGS(iindexfetch);
     IMCC_INFO(interp) -> keyvec |= KEY_BIT(2);
     return MK_I(interp, unit, "set %s, %s[%s]", 3, r0, r1, r2);
 }
@@ -550,6 +559,7 @@
 iINDEXSET(PARROT_INTERP, ARGMOD(IMC_Unit *unit), ARGIN(SymReg *r0), ARGIN(SymReg *r1),
         ARGIN(SymReg *r2))
 {
+    ASSERT_ARGS(iindexset);
     if (r0->set == 'P') {
         IMCC_INFO(interp)->keyvec |= KEY_BIT(1);
         MK_I(interp, unit, "set %s[%s], %s", 3, r0, r1, r2);
@@ -567,6 +577,7 @@
 inv_op(ARGIN(const char *op))
 {
     int n;
+    ASSERT_ARGS(inv_op);
     return get_neg_op(op, &n);
 }
 
@@ -577,6 +588,7 @@
     char         name[128];
     SymReg      *r;
     Instruction *i;
+    ASSERT_ARGS(imcc_create_itcall_label);
 
     snprintf(name, sizeof (name), "%cpcc_sub_call_%d", IMCC_INTERNAL_CHAR,
         IMCC_INFO(interp)->cnr++);
@@ -597,6 +609,7 @@
     /* name is a quoted sub name */
     SymReg *r;
     char *name_copy                  = str_dup(name + 1);
+    ASSERT_ARGS(mk_sub_address_fromc);
     name_copy[strlen(name_copy) - 1] = '\0';
 
     r = mk_sub_address(interp, name_copy);
@@ -610,6 +623,7 @@
 mk_sub_address_u(PARROT_INTERP, ARGIN(const char *name))
 {
     SymReg * const r = mk_sub_address(interp, name);
+    ASSERT_ARGS(mk_sub_address_u);
     r->type         |= VT_ENCODED;
 
     return r;
@@ -618,6 +632,7 @@
 void
 IMCC_itcall_sub(PARROT_INTERP, ARGIN(SymReg *sub))
 {
+    ASSERT_ARGS(imcc_itcall_sub);
     IMCC_INFO(interp)->cur_call->pcc_sub->sub = sub;
     if (IMCC_INFO(interp)->cur_obj) {
         if (IMCC_INFO(interp)->cur_obj->set != 'P')
@@ -637,6 +652,7 @@
     Instruction *i;
     Instruction * const ins = IMCC_INFO(interp)->cur_unit->instructions;
     char                name[128];
+    ASSERT_ARGS(begin_return_or_yield);
 
     if (!ins || !ins->symregs[0] || !(ins->symregs[0]->type & VT_PCC_SUB))
         IMCC_fataly(interp, EXCEPTION_SYNTAX_ERROR,
@@ -655,6 +671,7 @@
 set_lexical(PARROT_INTERP, ARGMOD(SymReg *r), ARGIN(const char *name))
 {
     SymReg * const n = mk_const(interp, name, 'S');
+    ASSERT_ARGS(set_lexical);
 
     r->usage |= U_LEXICAL;
 
@@ -673,6 +690,7 @@
         ARGIN(SymReg *value))
 {
     SymReg * const r = mk_const(interp, name, 'S');
+    ASSERT_ARGS(add_pcc_named_arg);
 
     r->type  |= VT_NAMED;
 
@@ -685,6 +703,7 @@
         ARGIN(SymReg *value))
 {
     SymReg * const r = mk_const(interp, name, 'S');
+    ASSERT_ARGS(add_pcc_named_result);
     r->type         |= VT_NAMED;
 
     add_pcc_result(cur_call, r);
@@ -696,6 +715,7 @@
         ARGIN(SymReg *value))
 {
     SymReg * const r = mk_const(interp, name, 'S');
+    ASSERT_ARGS(add_pcc_named_param);
     r->type         |= VT_NAMED;
 
     add_pcc_arg(cur_call, r);
@@ -707,6 +727,7 @@
         ARGIN(SymReg *value))
 {
     SymReg * const r = mk_const(interp, name, 'S');
+    ASSERT_ARGS(add_pcc_named_return);
     r->type         |= VT_NAMED;
 
     add_pcc_result(cur_call, r);
@@ -717,6 +738,7 @@
 static void
 adv_named_set(PARROT_INTERP, ARGIN(char *name))
 {
+    ASSERT_ARGS(adv_named_set);
     if (IMCC_INFO(interp)->adv_named_id) {
         IMCC_fataly(interp, EXCEPTION_SYNTAX_ERROR,
                     "Named parameter with more than one name.\n");
@@ -729,6 +751,7 @@
 {
     STRING * const s = string_unescape_cstring(interp, lib + 1, '"', NULL);
     PMC    *ignored  = Parrot_load_lib(interp, s, NULL);
+    ASSERT_ARGS(do_loadlib);
     UNUSED(ignored);
     Parrot_register_HLL_lib(interp, s);
 }

Modified: trunk/compilers/imcc/instructions.c
==============================================================================
--- trunk/compilers/imcc/instructions.c	(original)
+++ trunk/compilers/imcc/instructions.c	Wed Dec 31 11:20:05 2008
@@ -98,6 +98,7 @@
     Instruction * const ins =
         (Instruction*)mem_sys_allocate_zeroed(sizeof (Instruction) + reg_space);
     int i;
+    ASSERT_ARGS(_mk_instruction);
 
     ins->opname       = str_dup(op);
     ins->format       = str_dup(fmt);
@@ -139,6 +140,7 @@
     const char *writes[] = {
         "cleari", "clearn", "clearp", "clears",
     };
+    ASSERT_ARGS(imcc_init_tables);
     /* init opnums */
     if (!w_special[0]) {
         size_t i;
@@ -164,6 +166,7 @@
 ins_writes2(ARGIN(const Instruction *ins), int t)
 {
     const char *p;
+    ASSERT_ARGS(ins_writes2);
 
     if (ins->opnum == w_special[0])
         return 1;
@@ -197,6 +200,7 @@
 instruction_reads(ARGIN(const Instruction *ins), ARGIN(const SymReg *r))
 {
     int f, i;
+    ASSERT_ARGS(instruction_reads);
 
     if (ins->opnum == PARROT_OP_set_args_pc
     ||  ins->opnum == PARROT_OP_set_returns_pc) {
@@ -267,6 +271,7 @@
 {
     const int f = ins->flags;
     int i;
+    ASSERT_ARGS(instruction_writes);
 
     /*
      * a get_results opcode is before the actual sub call
@@ -349,6 +354,7 @@
 get_branch_regno(ARGIN(const Instruction *ins))
 {
     int j;
+    ASSERT_ARGS(get_branch_regno);
 
     for (j = ins->opsize - 2; j >= 0 && ins->symregs[j] ; --j)
         if (ins->type & (1 << j))
@@ -373,6 +379,7 @@
 get_branch_reg(ARGIN(const Instruction *ins))
 {
     const int r = get_branch_regno(ins);
+    ASSERT_ARGS(get_branch_reg);
 
     if (r >= 0)
         return ins->symregs[r];
@@ -402,6 +409,7 @@
 {
     Instruction * const next = ins->next;
     Instruction * const prev = ins->prev;
+    ASSERT_ARGS(delete_ins);
 
     if (prev)
         prev->next = next;
@@ -434,6 +442,8 @@
 delete_ins(ARGMOD(IMC_Unit *unit), ARGMOD(Instruction *ins))
 {
     Instruction * next = _delete_ins(unit, ins);
+    ASSERT_ARGS(delete_ins);
+
 
     free_ins(ins);
 
@@ -455,6 +465,7 @@
 insert_ins(ARGMOD(IMC_Unit *unit), ARGMOD_NULLOK(Instruction *ins),
         ARGMOD(Instruction *tmp))
 {
+    ASSERT_ARGS(insert_ins);
     if (!ins) {
         Instruction * const next = unit->instructions;
 
@@ -501,6 +512,7 @@
 prepend_ins(ARGMOD(IMC_Unit *unit), ARGMOD_NULLOK(Instruction *ins),
         ARGMOD(Instruction *tmp))
 {
+    ASSERT_ARGS(prepend_ins);
     if (!ins) {
         Instruction * const next = unit->instructions;
 
@@ -540,6 +552,8 @@
           ARGMOD(Instruction *tmp), int needs_freeing)
 {
     Instruction * const prev = ins->prev;
+    ASSERT_ARGS(subst_ins);
+
 
     if (prev)
         prev->next = tmp;
@@ -578,6 +592,7 @@
 move_ins(ARGMOD(IMC_Unit *unit), ARGMOD(Instruction *ins), ARGMOD(Instruction *to))
 {
     Instruction * const next = _delete_ins(unit, ins);
+    ASSERT_ARGS(move_ins);
     insert_ins(unit, to, ins);
     return next;
 }
@@ -597,7 +612,7 @@
 Instruction *
 emitb(PARROT_INTERP, ARGMOD_NULLOK(IMC_Unit *unit), ARGIN_NULLOK(Instruction *i))
 {
-
+    ASSERT_ARGS(emitb);
     if (!unit || !i)
         return NULL;
 
@@ -628,6 +643,7 @@
 void
 free_ins(ARGMOD(Instruction *ins))
 {
+    ASSERT_ARGS(free_ins);
     free(ins->format);
     free(ins->opname);
     free(ins);
@@ -652,6 +668,7 @@
     char *regstr[IMCC_MAX_FIX_REGS];
     int i;
     int len;
+    ASSERT_ARGS(ins_print);
 
 #if IMC_TRACE
     Parrot_io_eprintf(NULL, "ins_print\n");
@@ -773,6 +790,7 @@
 e_file_open(PARROT_INTERP, ARGIN(void *param))
 {
     char * const file = (char *) param;
+    ASSERT_ARGS(e_file_open);
 
     if (!STREQ(file, "-")) {
         FILE *newfile = freopen(file, "w", stdout);
@@ -800,6 +818,7 @@
 static int
 e_file_close(PARROT_INTERP, SHIM(void *param))
 {
+    ASSERT_ARGS(e_file_close);
     printf("\n\n");
     fclose(stdout);
     IMCC_info(interp, 1, "assembly module %s written.\n", output);
@@ -822,6 +841,7 @@
         SHIM(const IMC_Unit *unit),
         ARGIN(const Instruction *ins))
 {
+    ASSERT_ARGS(e_file_emit);
 #if IMC_TRACE
     Parrot_io_eprintf(NULL, "e_file_emit\n");
 #endif
@@ -851,6 +871,7 @@
 int
 emit_open(PARROT_INTERP, int type, ARGIN_NULLOK(void *param))
 {
+    ASSERT_ARGS(emit_open);
     IMCC_INFO(interp)->emitter       = type;
     IMCC_INFO(interp)->has_compile   = 0;
     IMCC_INFO(interp)->dont_optimize = 0;
@@ -875,6 +896,7 @@
 {
     Instruction *ins;
     int          emitter = IMCC_INFO(interp)->emitter;
+    ASSERT_ARGS(emit_flush);
 
     if (emitters[emitter].new_sub)
         (emitters[emitter]).new_sub(interp, param, unit);
@@ -904,6 +926,7 @@
 int
 emit_close(PARROT_INTERP, ARGIN_NULLOK(void *param))
 {
+    ASSERT_ARGS(emit_close);
     return (emitters[IMCC_INFO(interp)->emitter]).close(interp, param);
 }
 

Modified: trunk/compilers/imcc/main.c
==============================================================================
--- trunk/compilers/imcc/main.c	(original)
+++ trunk/compilers/imcc/main.c	Wed Dec 31 11:20:05 2008
@@ -133,6 +133,7 @@
 static void
 usage(ARGMOD(FILE *fp))
 {
+    ASSERT_ARGS(usage);
     fprintf(fp,
             "parrot -[abcCEfgGhjprStvVwy.] [-d [FLAGS]] [-D [FLAGS]]"
             "[-O [level]] [-o FILE] <file>\n");
@@ -151,6 +152,7 @@
 static void
 help_debug(void)
 {
+    ASSERT_ARGS(help_debug);
     /* split printf for C89 compliance on string length */
     printf(
     "--imcc-debug -d [Flags] ...\n"
@@ -195,6 +197,7 @@
 static void
 help(void)
 {
+    ASSERT_ARGS(help);
     /* split printf for C89 compliance on string length */
     printf(
     "parrot [Options] <file>\n"
@@ -252,6 +255,7 @@
 static void
 Parrot_version(PARROT_INTERP)
 {
+    ASSERT_ARGS(Parrot_version);
     printf("This is parrot version " PARROT_VERSION);
     printf(" built for " PARROT_ARCHNAME ".\n");
     printf("Copyright (C) 2001-2008, The Perl Foundation.\n\
@@ -328,6 +332,7 @@
 static int
 is_all_hex_digits(ARGIN(const char *s))
 {
+    ASSERT_ARGS(is_all_hex_digits);
     for (; *s; s++)
         if (!isxdigit(*s))
             return 0;
@@ -593,6 +598,7 @@
     YYSTYPE   val;
 
     const yyscan_t yyscanner = IMCC_INFO(interp)->yyscanner;
+    ASSERT_ARGS(do_pre_process);
 
     IMCC_push_parser_state(interp);
     c = yylex(&val, yyscanner, interp); /* is reset at end of while loop */
@@ -711,6 +717,7 @@
 imcc_get_optimization_description(const PARROT_INTERP, int opt_level, ARGMOD(char *opt_desc))
 {
     int i = 0;
+    ASSERT_ARGS(imcc_get_optimization_description);
 
     if (opt_level & (OPT_PRE | OPT_CFG))
             opt_desc[i++] = '2';
@@ -783,6 +790,7 @@
 imcc_run_pbc(PARROT_INTERP, int obj_file, ARGIN_NULLOK(const char *output_file),
         int argc, ARGIN(char **argv))
 {
+    ASSERT_ARGS(imcc_run_pbc);
     if (IMCC_INFO(interp)->imcc_warn)
         PARROT_WARNINGS_on(interp, PARROT_WARNINGS_ALL_FLAG);
     else
@@ -821,6 +829,7 @@
     size_t    size;
     opcode_t *packed;
     FILE     *fp;
+    ASSERT_ARGS(imcc_write_pbc);
 
     IMCC_info(interp, 1, "Writing %s\n", output_file);
 
@@ -857,6 +866,7 @@
 determine_input_file_type(PARROT_INTERP, ARGIN(const char * const sourcefile))
 {
     yyscan_t yyscanner = IMCC_INFO(interp)->yyscanner;
+    ASSERT_ARGS(determine_input_file_type);
 
     /* Read in the source and check the file extension for the input type;
        a file extension .pbc means it's parrot bytecode;
@@ -901,6 +911,7 @@
     ARGMOD(int *obj_file), ARGIN(const char *output_file))
 {
     const char * const ext = strrchr(output_file, '.');
+    ASSERT_ARGS(determine_output_file_type);
 
     if (ext) {
         if (STREQ(ext, ".pbc"))
@@ -942,6 +953,7 @@
 
     /* Shouldn't be more than five, but five extra is cheap */
     char opt_desc[10];
+    ASSERT_ARGS(compile_to_bytecode);
 
     imcc_get_optimization_description(interp, opt_level, opt_desc);
 

Modified: trunk/compilers/imcc/optimizer.c
==============================================================================
--- trunk/compilers/imcc/optimizer.c	(original)
+++ trunk/compilers/imcc/optimizer.c	Wed Dec 31 11:20:05 2008
@@ -301,6 +301,7 @@
 pre_optimize(PARROT_INTERP, ARGMOD(IMC_Unit *unit))
 {
     int changed = 0;
+    ASSERT_ARGS(pre_optimize);
 
     if (IMCC_INFO(interp)->optimizer_level & OPT_PRE) {
         IMCC_info(interp, 2, "pre_optimize\n");
@@ -328,6 +329,7 @@
 int
 cfg_optimize(PARROT_INTERP, ARGMOD(IMC_Unit *unit))
 {
+    ASSERT_ARGS(cfg_optimize);
     if (IMCC_INFO(interp)->dont_optimize)
         return 0;
     if (IMCC_INFO(interp)->optimizer_level & OPT_PRE) {
@@ -361,6 +363,7 @@
 optimize(PARROT_INTERP, ARGMOD(IMC_Unit *unit))
 {
     int any = 0;
+    ASSERT_ARGS(optimize);
     if (IMCC_INFO(interp)->optimizer_level & OPT_CFG) {
         IMCC_info(interp, 2, "optimize\n");
         any = constant_propagation(interp, unit);
@@ -400,6 +403,7 @@
         { "ge", "lt", 3 },
     };
     size_t i;
+    ASSERT_ARGS(get_neg_op);
     for (i = 0; i < N_ELEMENTS(br_pairs); i++) {
         *n = br_pairs[i].n;
         if (STREQ(op, br_pairs[i].op))
@@ -436,6 +440,7 @@
 {
     Instruction *ins, *last;
     int reg, changed = 0;
+    ASSERT_ARGS(if_branch);
 
     last = unit->instructions;
     if (!last->next)
@@ -502,6 +507,7 @@
     SymReg *r;
     int changes = 0;
     FLOATVAL f;
+    ASSERT_ARGS(strength_reduce);
 
     IMCC_info(interp, 2, "\tstrength_reduce\n");
     for (ins = unit->instructions; ins; ins = ins->next) {
@@ -745,6 +751,7 @@
     Instruction *ins;
     SymReg *c, *o;
     int any = 0;
+    ASSERT_ARGS(constant_propagation);
 
     o = c = NULL; /* silence compiler uninit warning, but XXX better to handle flow well */
 
@@ -855,6 +862,7 @@
     };
     size_t i;
     char b[128];
+    ASSERT_ARGS(IMCC_subst_constants_umix);
 
     tmp = NULL;
     for (i = 0; i < N_ELEMENTS(ops); i++) {
@@ -893,6 +901,7 @@
     int opnum;
     int i;
     op_info_t *op_info;
+    ASSERT_ARGS(eval_ins);
 
     opnum = interp->op_lib->op_code(op, 1);
     if (opnum < 0)
@@ -999,6 +1008,7 @@
     char op[20];
     const char *debug_fmt = NULL;   /* gcc -O uninit warn */
     int found, branched;
+    ASSERT_ARGS(IMCC_subst_constants);
 
     /* construct a FLOATVAL_FMT with needed precision */
 #if NUMVAL_SIZE == 8
@@ -1166,6 +1176,7 @@
 {
     Instruction *ins;
     int changed = 0;
+    ASSERT_ARGS(branch_branch);
 
     IMCC_info(interp, 2, "\tbranch_branch\n");
     /* reset statistic globals */
@@ -1226,6 +1237,7 @@
 {
     unsigned int i;
     int changed = 0;
+    ASSERT_ARGS(branch_reorg);
 
     IMCC_info(interp, 2, "\tbranch_reorg\n");
     for (i = 0; i < unit->n_basic_blocks; i++) {
@@ -1310,6 +1322,7 @@
     int changed = 0;
     int args;
     const char * const neg_op = get_neg_op(cond->opname, &args);
+    ASSERT_ARGS(branch_cond_loop_swap);
     if (neg_op) {
         const size_t size  = strlen(branch->symregs[0]->name) + 10; /* + '_post999' */
         char * const label = (char *)mem_sys_allocate(size);
@@ -1398,6 +1411,7 @@
 {
     Instruction *ins, *cond, *start, *prev;
     int changed = 0, found;
+    ASSERT_ARGS(branch_cond_loop);
 
     IMCC_info(interp, 2, "\tbranch_cond_loop\n");
     /* reset statistic globals */
@@ -1471,6 +1485,7 @@
     unsigned int i;
     int used;
     int changed = 0;
+    ASSERT_ARGS(unused_label);
 
     IMCC_info(interp, 2, "\tunused_label\n");
     for (i = 1; i < unit->n_basic_blocks; i++) {
@@ -1543,6 +1558,7 @@
     unsigned int i;
     int changed = 0;
     Instruction *ins, *last;
+    ASSERT_ARGS(dead_code_remove);
 
     /* this could be a separate level, now it's done with -O1 */
     if (!(IMCC_INFO(interp)->optimizer_level & OPT_PRE))
@@ -1625,6 +1641,7 @@
 {
     Instruction *ins;
     int opt = 0;
+    ASSERT_ARGS(used_once);
 
     for (ins = unit->instructions; ins; ins = ins->next) {
         if (ins->symregs) {
@@ -1673,6 +1690,7 @@
     int use_count, lhs_use_count;
     int i, in_use;
     int new_bl=-1, set_bl=-1;
+    ASSERT_ARGS(_is_ins_save);
 
     /* now check all instructions where r is used */
 
@@ -1771,6 +1789,7 @@
         ARGIN(const SymReg *r), int what)
 {
     int save;
+    ASSERT_ARGS(is_ins_save);
 
     reason = 0;
     save = _is_ins_save(unit, ins, r, what);
@@ -1797,6 +1816,7 @@
 {
     int i;
     int d = 0;
+    ASSERT_ARGS(max_loop_depth);
 
     for (i = 0; i < unit->n_basic_blocks; i++)
         if (unit->bb_list[i]->loop_depth > d)
@@ -1818,6 +1838,7 @@
 is_invariant(PARROT_INTERP, ARGIN(const IMC_Unit *unit), ARGIN(const Instruction *ins))
 {
     int what;
+    ASSERT_ARGS(is_invariant);
 
     if (STREQ(ins->opname, "new")) {
         what = CHK_INV_NEW;
@@ -1855,6 +1876,7 @@
     Loop_info ** const loop_info = unit->loop_info;
     const int          bb        = blk->index;
     int                i         = unit->n_loops - 1;
+    ASSERT_ARGS(find_outer);
 
     /* loops are sorted depth last */
     for (; i >= 0; i--) {
@@ -1885,6 +1907,7 @@
 {
     Basic_block *pred;
     Instruction * next, *out;
+    ASSERT_ARGS(move_ins_out);
 
     /* check loop_info, where this loop started
      * actually, this moves instruction to block 0 */
@@ -1938,6 +1961,7 @@
     Basic_block * const bb = unit->bb_list[bnr];
     Instruction *ins;
     int changed = 0;
+    ASSERT_ARGS(loop_one);
 
     if (bnr == 0) {
         IMCC_warning(interp, "loop_one", "wrong loop depth in block 0\n");
@@ -1979,6 +2003,7 @@
     static int prev_depth;
 
     const int loop_depth = prev_depth ? prev_depth : max_loop_depth(unit);
+    ASSERT_ARGS(loop_optimization);
 
     /* work from inside out */
     IMCC_debug(interp, DEBUG_OPT2, "loop_optimization\n");

Modified: trunk/compilers/imcc/parser_util.c
==============================================================================
--- trunk/compilers/imcc/parser_util.c	(original)
+++ trunk/compilers/imcc/parser_util.c	Wed Dec 31 11:20:05 2008
@@ -147,6 +147,7 @@
     int nargs;
     const int pmc_num = pmc_type(interp,
             string_from_cstring(interp, *type == '.' ? type + 1 : type, 0));
+    ASSERT_ARGS(iNEW);
 
     snprintf(fmt, sizeof (fmt), "%d", pmc_num);
     pmc = mk_const(interp, fmt, 'I');
@@ -203,6 +204,7 @@
     const char * const full = dest;
     Parrot_io_eprintf(NULL, "op %s", name);
 #endif
+    ASSERT_ARGS(op_fullname);
 
     memcpy(dest, name, namelen+1);
     dest += namelen;
@@ -270,6 +272,7 @@
 check_op(PARROT_INTERP, ARGOUT(char *fullname), ARGIN(const char *name),
         ARGIN(SymReg * const * r), int narg, int keyvec)
 {
+    ASSERT_ARGS(check_op);
     op_fullname(fullname, name, r, narg, keyvec);
 
     return interp->op_lib->op_code(fullname, 1);
@@ -289,6 +292,7 @@
 int
 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;
 }
@@ -316,6 +320,7 @@
 
     /* in constant */
     int dirs       = 1;
+    ASSERT_ARGS(var_arg_ins);
 
     r[0]           = mk_const(interp, r[0]->name, 'P');
     r[0]->pmc_type = enum_class_FixedIntegerArray;
@@ -366,6 +371,7 @@
     Instruction *ins;
     op_info_t   *op_info;
     char fullname[64], format[128];
+    ASSERT_ARGS(INS);
 
     if ((STREQ(name, "set_args"))
     ||  (STREQ(name, "get_results"))
@@ -563,6 +569,7 @@
 do_yylex_init(PARROT_INTERP, ARGOUT(yyscan_t* yyscanner))
 {
     const int retval = yylex_init(yyscanner);
+    ASSERT_ARGS(do_yylex_init);
 
     /* This way we can get the interpreter via yyscanner */
     if (!retval)
@@ -601,6 +608,7 @@
     Parrot_Context        *ignored;
     INTVAL regs_used[4] = {3, 3, 3, 3};
     INTVAL eval_number;
+    ASSERT_ARGS(imcc_compile);
 
     do_yylex_init(interp, &yyscanner);
 
@@ -733,6 +741,7 @@
 imcc_compile_pasm(PARROT_INTERP, ARGIN(const char *s))
 {
     STRING *error_message;
+    ASSERT_ARGS(imcc_compile_pasm);
     return imcc_compile(interp, s, 1, &error_message);
 }
 
@@ -755,6 +764,7 @@
 imcc_compile_pir(PARROT_INTERP, ARGIN(const char *s))
 {
     STRING *error_message;
+    ASSERT_ARGS(imcc_compile_pir);
     return imcc_compile(interp, s, 0, &error_message);
 }
 
@@ -774,6 +784,7 @@
 IMCC_compile_pir_s(PARROT_INTERP, ARGIN(const char *s),
         ARGOUT(STRING **error_message))
 {
+    ASSERT_ARGS(IMCC_compile_pir_s);
     return imcc_compile(interp, s, 0, error_message);
 }
 
@@ -793,6 +804,7 @@
 IMCC_compile_pasm_s(PARROT_INTERP, ARGIN(const char *s),
         ARGOUT(STRING **error_message))
 {
+    ASSERT_ARGS(IMCC_compile_pasm_s);
     return imcc_compile(interp, s, 1, error_message);
 }
 
@@ -814,6 +826,7 @@
     STRING *error_message;
 
     PMC * const sub = imcc_compile(interp, s, 1, &error_message);
+    ASSERT_ARGS(imcc_compile_pasm_ex);
 
     if (sub)
         return sub;
@@ -840,6 +853,7 @@
     STRING *error_message;
 
     PMC * const sub = imcc_compile(interp, s, 0, &error_message);
+    ASSERT_ARGS(imcc_compile_pir_ex);
     if (sub)
         return sub;
 
@@ -873,6 +887,7 @@
     /* need at least 3 regs for compilation of constant math e.g.
      * add_i_ic_ic - see also IMCC_subst_constants() */
     INTVAL regs_used[4] = {3, 3, 3, 3};
+    ASSERT_ARGS(imcc_compile_file);
 
     if (IMCC_INFO(interp)->last_unit) {
         /* a reentrant compile */
@@ -976,6 +991,7 @@
 IMCC_compile_file(PARROT_INTERP, ARGIN(const char *s))
 {
     STRING *error_message;
+    ASSERT_ARGS(IMCC_compile_file);
     return imcc_compile_file(interp, s, &error_message);
 }
 
@@ -994,6 +1010,7 @@
 IMCC_compile_file_s(PARROT_INTERP, ARGIN(const char *s),
         ARGOUT(STRING **error_message))
 {
+    ASSERT_ARGS(IMCC_compile_file_s);
     return imcc_compile_file(interp, s, error_message);
 }
 
@@ -1010,6 +1027,7 @@
 void
 register_compilers(PARROT_INTERP)
 {
+    ASSERT_ARGS(register_compilers);
     Parrot_compreg(interp, const_string(interp, "PASM"), imcc_compile_pasm_ex);
     Parrot_compreg(interp, const_string(interp, "PIR"),  imcc_compile_pir_ex);
 
@@ -1035,6 +1053,7 @@
 change_op(PARROT_INTERP, ARGMOD(IMC_Unit *unit), ARGMOD(SymReg **r), int num, int emit)
 {
     int changed = 0;
+    ASSERT_ARGS(change_op);
 
     if (r[num]->type & (VTCONST|VT_CONSTP)) {
         /* make a number const */
@@ -1093,6 +1112,7 @@
 {
     char fullname[64];
     int changed = 0;
+    ASSERT_ARGS(try_find_op);
     /*
      * eq_str, eq_num => eq
      * ...
@@ -1189,6 +1209,7 @@
     };
 
     unsigned int i;
+    ASSERT_ARGS(try_rev_cmp);
 
     for (i = 0; i < N_ELEMENTS(br_pairs); i++) {
         if (STREQ(name, br_pairs[i].op)) {
@@ -1243,6 +1264,7 @@
 void
 imcc_init(PARROT_INTERP)
 {
+    ASSERT_ARGS(imcc_init);
     PARROT_ASSERT(IMCC_INFO(interp) == NULL);
 
     IMCC_INFO(interp) = mem_allocate_zeroed_typed(imc_info_t);
@@ -1267,6 +1289,7 @@
     params_t * const params = &m->params;
 
     int i;
+    ASSERT_ARGS(imcc_destroy_macro_values);
 
     for (i = 0; i < params->num_param; ++i) {
         char * const name = params->name[i];
@@ -1294,6 +1317,7 @@
 imcc_destroy(PARROT_INTERP)
 {
     Hash * const macros = IMCC_INFO(interp)->macros;
+    ASSERT_ARGS(imcc_destroy);
 
     if (macros)
         parrot_chash_destroy_values(interp, macros, imcc_destroy_macro_values);

Modified: trunk/src/charset/ascii.c
==============================================================================
--- trunk/src/charset/ascii.c	(original)
+++ trunk/src/charset/ascii.c	Wed Dec 31 11:20:05 2008
@@ -176,6 +176,7 @@
 ascii_get_graphemes(PARROT_INTERP, ARGIN(STRING *source_string),
         UINTVAL offset, UINTVAL count)
 {
+    ASSERT_ARGS(ascii_get_graphemes);
     return ENCODING_GET_BYTES(interp, source_string, offset, count);
 }
 
@@ -194,6 +195,7 @@
 set_graphemes(PARROT_INTERP, ARGIN(STRING *source_string),
         UINTVAL offset, UINTVAL replace_count, ARGMOD(STRING *insert_string))
 {
+    ASSERT_ARGS(set_graphemes);
     ENCODING_SET_BYTES(interp, source_string, offset,
             replace_count, insert_string);
 
@@ -217,6 +219,7 @@
 ascii_get_graphemes_inplace(PARROT_INTERP, ARGIN(STRING *source_string),
         UINTVAL offset, UINTVAL count, ARGMOD(STRING *dest_string))
 {
+    ASSERT_ARGS(ascii_get_graphemes_inplace);
     return ENCODING_GET_BYTES_INPLACE(interp, source_string,
             offset, count, dest_string);
 }
@@ -239,8 +242,9 @@
     String_iter iter;
     UINTVAL offs;
     unsigned char *p;
-
     const UINTVAL len = src->strlen;
+    ASSERT_ARGS(to_ascii);
+
     if (dest) {
         Parrot_reallocate_string(interp, dest, len);
     }
@@ -278,6 +282,7 @@
 static STRING *
 to_unicode(PARROT_INTERP, ARGMOD(STRING *src), ARGMOD_NULLOK(STRING *dest))
 {
+    ASSERT_ARGS(to_unicode);
     if (dest) {
         dest->charset = Parrot_unicode_charset_ptr;
         dest->encoding = CHARSET_GET_PREFERRED_ENCODING(interp, dest);
@@ -307,6 +312,7 @@
 {
     const charset_converter_t conversion_func =
         Parrot_find_charset_converter(interp, src->charset, Parrot_ascii_charset_ptr);
+    ASSERT_ARGS(to_charset);
 
     if (conversion_func) {
          return conversion_func(interp, src, dest);
@@ -332,6 +338,7 @@
 static STRING*
 compose(PARROT_INTERP, ARGIN(STRING *src))
 {
+    ASSERT_ARGS(compose);
     return string_copy(interp, src);
 }
 
@@ -351,6 +358,7 @@
 static STRING*
 decompose(PARROT_INTERP, ARGMOD(STRING *src))
 {
+    ASSERT_ARGS(decompose);
     return string_copy(interp, src);
 }
 
@@ -368,6 +376,7 @@
 upcase(SHIM_INTERP, ARGIN(STRING *source_string))
 {
     const UINTVAL n = source_string->strlen;
+    ASSERT_ARGS(upcase);
 
     if (n) {
         char * const buffer = source_string->strstart;
@@ -393,6 +402,7 @@
 downcase(SHIM_INTERP, ARGIN(STRING *source_string))
 {
     const UINTVAL n = source_string->strlen;
+    ASSERT_ARGS(downcase);
 
     if (n) {
         char * const buffer = source_string->strstart;
@@ -420,6 +430,7 @@
 titlecase(SHIM_INTERP, ARGIN(STRING *source_string))
 {
     const UINTVAL n = source_string->strlen;
+    ASSERT_ARGS(titlecase);
 
     if (n) {
         char * const buffer = source_string->strstart;
@@ -446,6 +457,7 @@
 static void
 upcase_first(SHIM_INTERP, ARGIN(STRING *source_string))
 {
+    ASSERT_ARGS(upcase_first);
     if (source_string->strlen) {
         char * const buffer = source_string->strstart;
         buffer[0] = (char)toupper((unsigned char)buffer[0]);
@@ -466,6 +478,7 @@
 static void
 downcase_first(SHIM_INTERP, ARGIN(STRING *source_string))
 {
+    ASSERT_ARGS(downcase_first);
     if (source_string->strlen) {
         char * const buffer = source_string->strstart;
         buffer[0] = (char)tolower((unsigned char)buffer[0]);
@@ -486,6 +499,7 @@
 static void
 titlecase_first(SHIM_INTERP, ARGMOD(STRING *source_string))
 {
+    ASSERT_ARGS(titlecase_first);
     if (source_string->strlen) {
         char * const buffer = source_string->strstart;
         buffer[0] = (char)toupper((unsigned char)buffer[0]);
@@ -511,6 +525,7 @@
     const UINTVAL r_len = rhs->strlen;
     const UINTVAL min_len = l_len > r_len ? r_len : l_len;
     String_iter iter;
+    ASSERT_ARGS(ascii_compare);
 
     if (lhs->encoding == Parrot_fixed_8_encoding_ptr &&
             rhs->encoding == Parrot_fixed_8_encoding_ptr) {
@@ -558,6 +573,7 @@
     String_iter src_iter, search_iter;
     UINTVAL len;
     INTVAL start;
+    ASSERT_ARGS(mixed_cs_index);
 
     ENCODING_ITER_INIT(interp, src, &src_iter);
     src_iter.set_position(interp, &src_iter, offs);
@@ -602,6 +618,7 @@
         ARGIN(STRING *search_string), UINTVAL offset)
 {
     INTVAL retval;
+    ASSERT_ARGS(ascii_cs_index);
     if (source_string->charset != search_string->charset) {
         return mixed_cs_index(interp, source_string, search_string, offset);
     }
@@ -629,6 +646,7 @@
         ARGIN(STRING *search_string), UINTVAL offset)
 {
     INTVAL retval;
+    ASSERT_ARGS(ascii_cs_rindex);
 
     if (source_string->charset != search_string->charset)
         Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_UNIMPLEMENTED,
@@ -657,6 +675,7 @@
 {
     UINTVAL offset;
     String_iter iter;
+    ASSERT_ARGS(validate);
 
     ENCODING_ITER_INIT(interp, src, &iter);
     for (offset = 0; offset < string_length(interp, src); ++offset) {
@@ -685,6 +704,7 @@
 {
     char real_codepoint = (char)codepoint;
     STRING * const return_string = string_make(interp, &real_codepoint, 1, "ascii", 0);
+    ASSERT_ARGS(string_from_codepoint);
     return return_string;
 }
 
@@ -703,6 +723,7 @@
 is_cclass(PARROT_INTERP, INTVAL flags, ARGIN(const STRING *source_string), UINTVAL offset)
 {
     UINTVAL codepoint;
+    ASSERT_ARGS(is_cclass);
 
     if (offset >= source_string->strlen)
         return 0;
@@ -732,8 +753,8 @@
 {
     UINTVAL pos = offset;
     UINTVAL end = offset + count;
+    ASSERT_ARGS(find_cclass);
 
-    PARROT_ASSERT(source_string != 0);
     end = source_string->strlen < end ? source_string->strlen : end;
     for (; pos < end; ++pos) {
         const UINTVAL codepoint = ENCODING_GET_CODEPOINT(interp, source_string, pos);
@@ -760,8 +781,8 @@
 {
     UINTVAL pos = offset;
     UINTVAL end = offset + count;
+    ASSERT_ARGS(find_not_cclass);
 
-    PARROT_ASSERT(source_string != 0);
     end = source_string->strlen < end ? source_string->strlen : end;
     for (; pos < end; ++pos) {
         const UINTVAL codepoint = ENCODING_GET_CODEPOINT(interp, source_string, pos);
@@ -790,6 +811,7 @@
     size_t hashval = seed;
     const char *buffptr = (const char *)source_string->strstart;
     UINTVAL len = source_string->strlen;
+    ASSERT_ARGS(ascii_compute_hash);
 
     PARROT_ASSERT(source_string->encoding == Parrot_fixed_8_encoding_ptr);
     while (len--) {
@@ -840,6 +862,7 @@
         ascii_compute_hash,
         NULL
     };
+    ASSERT_ARGS(Parrot_charset_ascii_init);
 
     STRUCT_COPY_FROM_STRUCT(return_set, base_set);
     return_set->preferred_encoding = Parrot_fixed_8_encoding_ptr;
@@ -861,6 +884,7 @@
 STRING *
 charset_cvt_ascii_to_binary(PARROT_INTERP, ARGIN(STRING *src), ARGIN_NULLOK(STRING *dest))
 {
+    ASSERT_ARGS(charset_cvt_ascii_to_binary);
     if (dest) {
         UINTVAL offs;
 
@@ -892,6 +916,7 @@
 charset_cvt_ascii_to_iso_8859_1(PARROT_INTERP, ARGIN(STRING *src),
     ARGIN_NULLOK(STRING *dest))
 {
+    ASSERT_ARGS(charset_cvt_ascii_to_iso_8859_1);
     if (dest) {
         UINTVAL offs;
 

Modified: trunk/src/charset/binary.c
==============================================================================
--- trunk/src/charset/binary.c	(original)
+++ trunk/src/charset/binary.c	Wed Dec 31 11:20:05 2008
@@ -153,6 +153,7 @@
 set_graphemes(PARROT_INTERP, ARGIN(STRING *source_string),
         UINTVAL offset, UINTVAL replace_count, ARGMOD(STRING *insert_string))
 {
+    ASSERT_ARGS(set_graphemes);
     ENCODING_SET_BYTES(interp, source_string, offset,
             replace_count, insert_string);
 }
@@ -174,6 +175,7 @@
 {
     charset_converter_t conversion_func =
         Parrot_find_charset_converter(interp, src->charset, Parrot_binary_charset_ptr);
+    ASSERT_ARGS(to_charset);
 
     if (conversion_func)
          return conversion_func(interp, src, dest);
@@ -197,6 +199,7 @@
 static STRING*
 compose(PARROT_INTERP, SHIM(STRING *source_string))
 {
+    ASSERT_ARGS(compose);
     EXCEPTION(EXCEPTION_INVALID_CHARTYPE, "Can't compose binary data");
 }
 
@@ -215,6 +218,7 @@
 static STRING*
 decompose(PARROT_INTERP, SHIM(STRING *source_string))
 {
+    ASSERT_ARGS(decompose);
     EXCEPTION(EXCEPTION_INVALID_CHARTYPE, "Can't decompose binary data");
 }
 
@@ -232,6 +236,7 @@
 static void
 upcase(PARROT_INTERP, SHIM(STRING *source_string))
 {
+    ASSERT_ARGS(upcase);
     EXCEPTION(EXCEPTION_INVALID_CHARTYPE, "Can't upcase binary data");
 }
 
@@ -249,6 +254,7 @@
 static void
 downcase(PARROT_INTERP, SHIM(STRING *source_string))
 {
+    ASSERT_ARGS(downcase);
     EXCEPTION(EXCEPTION_INVALID_CHARTYPE, "Can't downcase binary data");
 }
 
@@ -266,6 +272,7 @@
 static void
 titlecase(PARROT_INTERP, SHIM(STRING *source_string))
 {
+    ASSERT_ARGS(titlecase);
     EXCEPTION(EXCEPTION_INVALID_CHARTYPE, "Can't titlecase binary data");
 }
 
@@ -283,6 +290,7 @@
 static void
 upcase_first(PARROT_INTERP, SHIM(STRING *source_string))
 {
+    ASSERT_ARGS(upcase_first);
     EXCEPTION(EXCEPTION_INVALID_CHARTYPE, "Can't upcase binary data");
 }
 
@@ -300,6 +308,7 @@
 static void
 downcase_first(PARROT_INTERP, SHIM(STRING *source_string))
 {
+    ASSERT_ARGS(downcase_first);
     EXCEPTION(EXCEPTION_INVALID_CHARTYPE, "Can't downcase binary data");
 }
 
@@ -317,6 +326,7 @@
 static void
 titlecase_first(PARROT_INTERP, SHIM(STRING *source_string))
 {
+    ASSERT_ARGS(titlecase_first);
     EXCEPTION(EXCEPTION_INVALID_CHARTYPE, "Can't titlecase binary data");
 }
 
@@ -333,6 +343,7 @@
 static INTVAL
 compare(SHIM_INTERP, SHIM(const STRING *lhs), SHIM(const STRING *rhs))
 {
+    ASSERT_ARGS(compare);
     return 0;
 }
 
@@ -351,6 +362,7 @@
 cs_index(SHIM_INTERP, SHIM(STRING *source_string),
         SHIM(STRING *search_string), SHIM(UINTVAL offset))
 {
+    ASSERT_ARGS(cs_index);
     return -1;
 }
 
@@ -369,6 +381,7 @@
 cs_rindex(SHIM_INTERP, SHIM(STRING *source_string),
         SHIM(STRING *search_string), SHIM(UINTVAL offset))
 {
+    ASSERT_ARGS(cs_rindex);
     return -1;
 }
 
@@ -386,6 +399,7 @@
 static UINTVAL
 validate(SHIM_INTERP, SHIM(STRING *source_string))
 {
+    ASSERT_ARGS(validate);
     return 1;
 }
 
@@ -403,6 +417,7 @@
 is_cclass(SHIM_INTERP, SHIM(INTVAL flags), SHIM(const STRING *source_string),
         SHIM(UINTVAL offset))
 {
+    ASSERT_ARGS(is_cclass);
     return 0;
 }
 
@@ -420,6 +435,7 @@
 find_cclass(SHIM_INTERP, SHIM(INTVAL flags),
             SHIM(STRING *source_string), UINTVAL offset, UINTVAL count)
 {
+    ASSERT_ARGS(find_cclass);
     return offset + count;
 }
 
@@ -437,6 +453,7 @@
 find_not_cclass(SHIM_INTERP, SHIM(INTVAL flags),
                SHIM(STRING *source_string), UINTVAL offset, UINTVAL count)
 {
+    ASSERT_ARGS(find_not_cclass);
     return offset + count;
 }
 
@@ -456,6 +473,7 @@
 {
     STRING *return_string;
     char real_codepoint = (char)codepoint;
+    ASSERT_ARGS(string_from_codepoint);
     return_string = string_make(interp, &real_codepoint, 1, "binary", 0);
     return return_string;
 }
@@ -502,6 +520,7 @@
         ascii_compute_hash,
         NULL
     };
+    ASSERT_ARGS(Parrot_charset_binary_init);
 
     STRUCT_COPY_FROM_STRUCT(return_set, base_set);
     return_set->preferred_encoding = Parrot_fixed_8_encoding_ptr;

Modified: trunk/src/charset/iso-8859-1.c
==============================================================================
--- trunk/src/charset/iso-8859-1.c	(original)
+++ trunk/src/charset/iso-8859-1.c	Wed Dec 31 11:20:05 2008
@@ -175,6 +175,7 @@
 set_graphemes(PARROT_INTERP, ARGIN(STRING *source_string),
         UINTVAL offset, UINTVAL replace_count, ARGMOD(STRING *insert_string))
 {
+    ASSERT_ARGS(set_graphemes);
     ENCODING_SET_BYTES(interp, source_string, offset,
             replace_count, insert_string);
 }
@@ -195,6 +196,7 @@
 {
     UINTVAL offs, src_len;
     String_iter iter;
+    ASSERT_ARGS(to_latin1);
 
     ENCODING_ITER_INIT(interp, src, &iter);
     src_len = src->strlen;
@@ -234,6 +236,7 @@
 static STRING *
 to_unicode(PARROT_INTERP, ARGIN(STRING *src), ARGMOD_NULLOK(STRING *dest))
 {
+    ASSERT_ARGS(to_unicode);
     if (dest) {
         UINTVAL offs;
         String_iter iter;
@@ -279,6 +282,7 @@
 {
     const charset_converter_t conversion_func =
         Parrot_find_charset_converter(interp, src->charset, Parrot_iso_8859_1_charset_ptr);
+    ASSERT_ARGS(to_charset);
 
     if (conversion_func)
         return conversion_func(interp, src, dest);
@@ -304,6 +308,7 @@
 static STRING*
 compose(PARROT_INTERP, ARGIN(STRING *src))
 {
+    ASSERT_ARGS(compose);
     return string_copy(interp, src);
 }
 
@@ -321,6 +326,7 @@
 static STRING*
 decompose(PARROT_INTERP, SHIM(STRING *src))
 {
+    ASSERT_ARGS(decompose);
     Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_UNIMPLEMENTED,
             "decompose for iso-8859-1 not implemented");
 }
@@ -341,6 +347,7 @@
 {
     unsigned char *buffer;
     UINTVAL offset = 0;
+    ASSERT_ARGS(upcase);
 
     if (!source_string->strlen)
         return;
@@ -371,6 +378,7 @@
 static void
 downcase(PARROT_INTERP, ARGIN(STRING *source_string))
 {
+    ASSERT_ARGS(downcase);
     if (source_string->strlen) {
         UINTVAL offset;
         unsigned char *buffer;
@@ -405,6 +413,7 @@
     unsigned char *buffer;
     unsigned int c;
     UINTVAL offset;
+    ASSERT_ARGS(titlecase);
 
     if (!source_string->strlen)
         return;
@@ -442,6 +451,7 @@
 static void
 upcase_first(PARROT_INTERP, ARGIN(STRING *source_string))
 {
+    ASSERT_ARGS(upcase_first);
     if (source_string->strlen) {
         unsigned char *buffer;
         unsigned int c;
@@ -471,6 +481,7 @@
 static void
 downcase_first(PARROT_INTERP, ARGIN(STRING *source_string))
 {
+    ASSERT_ARGS(downcase_first);
     if (source_string->strlen) {
         unsigned char *buffer;
         unsigned int c;
@@ -500,6 +511,7 @@
 static void
 titlecase_first(PARROT_INTERP, ARGIN(STRING *source_string))
 {
+    ASSERT_ARGS(titlecase_first);
     upcase_first(interp, source_string);
 }
 
@@ -518,6 +530,7 @@
 validate(PARROT_INTERP, ARGIN(STRING *src))
 {
     UINTVAL offset;
+    ASSERT_ARGS(validate);
 
     for (offset = 0; offset < string_length(interp, src); ++offset) {
         const UINTVAL codepoint = ENCODING_GET_CODEPOINT(interp, src, offset);
@@ -542,6 +555,7 @@
           ARGIN(const STRING *source_string), UINTVAL offset)
 {
     UINTVAL codepoint;
+    ASSERT_ARGS(is_cclass);
 
     if (offset >= source_string->strlen) return 0;
     codepoint = ENCODING_GET_CODEPOINT(interp, source_string, offset);
@@ -570,8 +584,8 @@
     UINTVAL pos = offset;
     UINTVAL end = offset + count;
     UINTVAL codepoint;
+    ASSERT_ARGS(find_cclass);
 
-    PARROT_ASSERT(source_string != 0);
     end = source_string->strlen < end ? source_string->strlen : end;
     for (; pos < end; ++pos) {
         codepoint = ENCODING_GET_CODEPOINT(interp, source_string, pos);
@@ -598,8 +612,8 @@
 {
     UINTVAL pos = offset;
     UINTVAL end = offset + count;
+    ASSERT_ARGS(find_not_cclass);
 
-    PARROT_ASSERT(source_string);
     end = source_string->strlen < end ? source_string->strlen : end;
     for (; pos < end; ++pos) {
         const UINTVAL codepoint = ENCODING_GET_CODEPOINT(interp, source_string, pos);
@@ -628,6 +642,7 @@
     char real_codepoint = (char)codepoint;
     STRING * const return_string = string_make(interp, &real_codepoint, 1,
             "iso-8859-1", 0);
+    ASSERT_ARGS(string_from_codepoint);
     return return_string;
 }
 
@@ -671,6 +686,7 @@
         ascii_compute_hash,
         NULL
     };
+    ASSERT_ARGS(Parrot_charset_iso_8859_1_init);
 
     STRUCT_COPY_FROM_STRUCT(return_set, base_set);
     return_set->preferred_encoding = Parrot_fixed_8_encoding_ptr;
@@ -695,6 +711,7 @@
         ARGMOD_NULLOK(STRING *dest))
 {
     UINTVAL offs;
+    ASSERT_ARGS(charset_cvt_iso_8859_1_to_ascii);
     if (dest) {
         Parrot_reallocate_string(interp, dest, src->strlen);
         dest->bufused = src->bufused;

Modified: trunk/src/charset/unicode.c
==============================================================================
--- trunk/src/charset/unicode.c	(original)
+++ trunk/src/charset/unicode.c	Wed Dec 31 11:20:05 2008
@@ -217,6 +217,7 @@
 set_graphemes(PARROT_INTERP, ARGIN(STRING *source_string),
         UINTVAL offset, UINTVAL replace_count, ARGMOD(STRING *insert_string))
 {
+    ASSERT_ARGS(set_graphemes);
     ENCODING_SET_CODEPOINTS(interp, source_string, offset,
             replace_count, insert_string);
 }
@@ -238,6 +239,7 @@
 get_graphemes(PARROT_INTERP, ARGIN(STRING *source_string),
         UINTVAL offset, UINTVAL count)
 {
+    ASSERT_ARGS(get_graphemes);
     return ENCODING_GET_CODEPOINTS(interp, source_string, offset, count);
 }
 
@@ -258,6 +260,7 @@
 get_graphemes_inplace(PARROT_INTERP, ARGIN(STRING *source_string),
         UINTVAL offset, UINTVAL count, ARGMOD(STRING *dest_string))
 {
+    ASSERT_ARGS(get_graphemes_inplace);
     return ENCODING_GET_CODEPOINTS_INPLACE(interp, source_string,
             offset, count, dest_string);
 }
@@ -280,6 +283,7 @@
     const charset_converter_t conversion_func =
             Parrot_find_charset_converter(interp, src->charset,
                     Parrot_unicode_charset_ptr);
+    ASSERT_ARGS(to_charset);
 
     if (conversion_func)
          return conversion_func(interp, src, dest);
@@ -309,6 +313,7 @@
     STRING *dest;
     int src_len, dest_len;
     UErrorCode err;
+    ASSERT_ARGS(compose);
     /*
        U_STABLE int32_t U_EXPORT2
        unorm_normalize(const UChar *source, int32_t sourceLength,
@@ -364,6 +369,7 @@
 static STRING*
 decompose(PARROT_INTERP, SHIM(STRING *src))
 {
+    ASSERT_ARGS(decompose);
     /* TODO: RT #59696 Implement this. */
     UNIMPL;
 }
@@ -389,6 +395,7 @@
 
     UErrorCode err;
     int dest_len, src_len, needed;
+    ASSERT_ARGS(upcase);
 
     if (src->bufused  == src->strlen
     &&  src->encoding == Parrot_utf8_encoding_ptr) {
@@ -478,6 +485,7 @@
 static void
 downcase(PARROT_INTERP, ARGIN(STRING *src))
 {
+    ASSERT_ARGS(downcase);
     if (src->bufused  == src->strlen
     &&  src->encoding == Parrot_utf8_encoding_ptr) {
         Parrot_ascii_charset_ptr->downcase(interp, src);
@@ -545,6 +553,7 @@
 
     UErrorCode err;
     int dest_len, src_len;
+    ASSERT_ARGS(titlecase);
 
     if (src->bufused  == src->strlen
     &&  src->encoding == Parrot_utf8_encoding_ptr) {
@@ -607,6 +616,7 @@
 static void
 upcase_first(PARROT_INTERP, SHIM(STRING *source_string))
 {
+    ASSERT_ARGS(upcase_first);
     /* TODO: RT #59696 Implement this. */
     UNIMPL;
 }
@@ -626,6 +636,7 @@
 static void
 downcase_first(PARROT_INTERP, SHIM(STRING *source_string))
 {
+    ASSERT_ARGS(downcase_first);
     /* TODO: RT #59696 Implement this. */
     UNIMPL;
 }
@@ -645,6 +656,7 @@
 static void
 titlecase_first(PARROT_INTERP, SHIM(STRING *source_string))
 {
+    ASSERT_ARGS(titlecase_first);
     /* TODO: RT #59696 Implement this. */
     UNIMPL;
 }
@@ -666,6 +678,7 @@
 {
     String_iter l_iter, r_iter;
     UINTVAL offs, cl, cr, min_len, l_len, r_len;
+    ASSERT_ARGS(compare);
 
     /* TODO make optimized equal - strings are equal length then already */
     ENCODING_ITER_INIT(interp, lhs, &l_iter);
@@ -709,6 +722,7 @@
 cs_rindex(PARROT_INTERP, SHIM(STRING *source_string),
         SHIM(STRING *search_string), UINTVAL offset)
 {
+    ASSERT_ARGS(cs_rindex);
     /* TODO: RT #59696 Implement this. */
     UNIMPL;
 }
@@ -729,6 +743,7 @@
 {
     UINTVAL     offset;
     String_iter iter;
+    ASSERT_ARGS(validate);
 
     ENCODING_ITER_INIT(interp, src, &iter);
     for (offset = 0; offset < string_length(interp, src); ++offset) {
@@ -757,6 +772,7 @@
 static int
 u_iscclass(PARROT_INTERP, UINTVAL codepoint, INTVAL flags)
 {
+    ASSERT_ARGS(u_iscclass);
 #if PARROT_HAS_ICU
             /* XXX which one
                return u_charDigitValue(codepoint);
@@ -854,6 +870,7 @@
           ARGIN(const STRING *source_string), UINTVAL offset)
 {
     UINTVAL codepoint;
+    ASSERT_ARGS(is_cclass);
 
     if (offset >= source_string->strlen)
         return 0;
@@ -885,8 +902,8 @@
     UINTVAL     codepoint;
     UINTVAL     pos = offset;
     UINTVAL     end = offset + count;
+    ASSERT_ARGS(find_cclass);
 
-    PARROT_ASSERT(source_string != 0);
     ENCODING_ITER_INIT(interp, source_string, &iter);
 
     iter.set_position(interp, &iter, pos);
@@ -928,8 +945,8 @@
     UINTVAL     pos = offset;
     UINTVAL     end = offset + count;
     int         bit;
+    ASSERT_ARGS(find_not_cclass);
 
-    PARROT_ASSERT(source_string);
     ENCODING_ITER_INIT(interp, source_string, &iter);
 
     if (pos)
@@ -975,6 +992,7 @@
 {
     String_iter    iter;
     STRING * const dest = string_make(interp, "", 1, "unicode", 0);
+    ASSERT_ARGS(string_from_codepoint);
 
     dest->strlen = 1;
 
@@ -1002,6 +1020,7 @@
     String_iter iter;
     UINTVAL     offs;
     size_t      hashval = seed;
+    ASSERT_ARGS(compute_hash);
 
     ENCODING_ITER_INIT(interp, src, &iter);
 
@@ -1056,6 +1075,7 @@
         compute_hash,
         NULL
     };
+    ASSERT_ARGS(Parrot_charset_unicode_init);
 
     STRUCT_COPY_FROM_STRUCT(return_set, base_set);
 

Modified: trunk/src/encodings/fixed_8.c
==============================================================================
--- trunk/src/encodings/fixed_8.c	(original)
+++ trunk/src/encodings/fixed_8.c	Wed Dec 31 11:20:05 2008
@@ -216,6 +216,7 @@
 static STRING *
 to_encoding(PARROT_INTERP, SHIM(STRING *src), SHIM(STRING *dest))
 {
+    ASSERT_ARGS(to_encoding);
     UNIMPL;
 }
 
@@ -235,6 +236,7 @@
 get_codepoint(PARROT_INTERP, ARGIN(const STRING *source_string),
         UINTVAL offset)
 {
+    ASSERT_ARGS(get_codepoint);
     return get_byte(interp, source_string, offset);
 }
 
@@ -252,6 +254,7 @@
 set_codepoint(PARROT_INTERP, ARGIN(STRING *source_string),
         UINTVAL offset, UINTVAL codepoint)
 {
+    ASSERT_ARGS(set_codepoint);
     set_byte(interp, source_string, offset, codepoint);
 }
 
@@ -270,6 +273,7 @@
 get_byte(PARROT_INTERP, ARGIN(const STRING *source_string), UINTVAL offset)
 {
     unsigned char *contents = (unsigned char *)source_string->strstart;
+    ASSERT_ARGS(get_byte);
 
     if (offset >= source_string->bufused) {
 /*        Parrot_ex_throw_from_c_args(interp, NULL, 0,
@@ -296,6 +300,7 @@
         UINTVAL offset, UINTVAL byte)
 {
     unsigned char *contents;
+    ASSERT_ARGS(set_byte);
 
     if (offset >= source_string->bufused)
         Parrot_ex_throw_from_c_args(interp, NULL, 0,
@@ -324,6 +329,7 @@
 {
     STRING * const return_string = get_bytes(interp, source_string,
             offset, count);
+    ASSERT_ARGS(get_codepoints);
     return_string->charset = source_string->charset;
     return return_string;
 }
@@ -346,6 +352,7 @@
 {
     STRING * const return_string = Parrot_make_COW_reference(interp,
             source_string);
+    ASSERT_ARGS(get_bytes);
     return_string->encoding = source_string->encoding;
     return_string->charset = source_string->charset;
 
@@ -376,7 +383,7 @@
 get_codepoints_inplace(PARROT_INTERP, ARGIN(STRING *source_string),
         UINTVAL offset, UINTVAL count, ARGMOD(STRING *dest_string))
 {
-
+    ASSERT_ARGS(get_codepoints_inplace);
     return get_bytes_inplace(interp, source_string, offset,
             count, dest_string);
 }
@@ -398,6 +405,7 @@
 get_bytes_inplace(PARROT_INTERP, ARGIN(STRING *source_string),
         UINTVAL offset, UINTVAL count, ARGMOD(STRING *return_string))
 {
+    ASSERT_ARGS(get_bytes_inplace);
     Parrot_reuse_COW_reference(interp, source_string, return_string);
 
     return_string->strstart = (char *)return_string->strstart + offset ;
@@ -423,6 +431,7 @@
 set_codepoints(PARROT_INTERP, ARGIN(STRING *source_string),
         UINTVAL offset, UINTVAL count, ARGMOD(STRING *new_codepoints))
 {
+    ASSERT_ARGS(set_codepoints);
     set_bytes(interp, source_string, offset, count, new_codepoints);
 }
 
@@ -441,6 +450,7 @@
 set_bytes(PARROT_INTERP, ARGIN(STRING *source_string),
         UINTVAL offset, UINTVAL count, ARGMOD(STRING *new_bytes))
 {
+    ASSERT_ARGS(set_bytes);
     string_replace(interp, source_string, offset, count, new_bytes, NULL);
 }
 
@@ -457,6 +467,7 @@
 static void
 become_encoding(PARROT_INTERP, SHIM(STRING *source_string))
 {
+    ASSERT_ARGS(become_encoding);
     UNIMPL;
 }
 
@@ -474,6 +485,7 @@
 static UINTVAL
 codepoints(PARROT_INTERP, ARGIN(STRING *source_string))
 {
+    ASSERT_ARGS(codepoints);
     return bytes(interp, source_string);
 }
 
@@ -490,6 +502,7 @@
 static UINTVAL
 bytes(SHIM_INTERP, ARGIN(STRING *source_string))
 {
+    ASSERT_ARGS(bytes);
     return source_string->bufused;
 }
 
@@ -511,6 +524,7 @@
 fixed8_get_next(PARROT_INTERP, ARGMOD(String_iter *iter))
 {
     const UINTVAL c = get_byte(interp, iter->str, iter->charpos++);
+    ASSERT_ARGS(fixed8_get_next);
     iter->bytepos++;
     return c;
 }
@@ -529,6 +543,7 @@
 static void
 fixed8_set_next(PARROT_INTERP, ARGMOD(String_iter *iter), UINTVAL c)
 {
+    ASSERT_ARGS(fixed8_set_next);
     set_byte(interp, iter->str, iter->charpos++, c);
     iter->bytepos++;
 }
@@ -546,6 +561,7 @@
 static void
 fixed8_set_position(SHIM_INTERP, ARGMOD(String_iter *iter), UINTVAL pos)
 {
+    ASSERT_ARGS(fixed8_set_position);
     iter->bytepos = iter->charpos = pos;
     PARROT_ASSERT(pos <= PObj_buflen(iter->str));
 }
@@ -564,6 +580,7 @@
 static void
 iter_init(SHIM_INTERP, ARGIN(const STRING *src), ARGOUT(String_iter *iter))
 {
+    ASSERT_ARGS(iter_init);
     iter->str             = src;
     iter->bytepos         = iter->charpos        = 0;
     iter->get_and_advance = fixed8_get_next;
@@ -607,6 +624,7 @@
         iter_init
 
     };
+    ASSERT_ARGS(Parrot_encoding_fixed_8_init);
     STRUCT_COPY_FROM_STRUCT(return_encoding, base_encoding);
     Parrot_register_encoding(interp, "fixed_8", return_encoding);
     return return_encoding;

Modified: trunk/src/encodings/ucs2.c
==============================================================================
--- trunk/src/encodings/ucs2.c	(original)
+++ trunk/src/encodings/ucs2.c	Wed Dec 31 11:20:05 2008
@@ -209,6 +209,7 @@
 {
     STRING * const result =
         Parrot_utf16_encoding_ptr->to_encoding(interp, src, dest);
+    ASSERT_ARGS(to_encoding);
 
     /* conversion to utf16 downgrads to ucs-2 if possible - check result */
     if (result->encoding == Parrot_utf16_encoding_ptr)
@@ -235,6 +236,7 @@
     UChar * const s = (UChar*) src->strstart;
     return s[offset];
 #else
+    ASSERT_ARGS(get_codepoint);
     Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_LIBRARY_ERROR,
         "no ICU lib loaded");
 #endif
@@ -257,6 +259,7 @@
     UChar * const s = (UChar*) src->strstart;
     s[offset] = codepoint;
 #else
+    ASSERT_ARGS(set_codepoint);
     UNUSED(src);
     Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_LIBRARY_ERROR,
         "no ICU lib loaded");
@@ -276,6 +279,7 @@
 static UINTVAL
 get_byte(PARROT_INTERP, SHIM(const STRING *src), UINTVAL offset)
 {
+    ASSERT_ARGS(get_byte);
     UNIMPL;
 }
 
@@ -292,6 +296,7 @@
 static void
 set_byte(PARROT_INTERP, SHIM(const STRING *src), UINTVAL offset, UINTVAL byte)
 {
+    ASSERT_ARGS(set_byte);
     UNIMPL;
 }
 
@@ -312,6 +317,7 @@
 get_codepoints(PARROT_INTERP, ARGIN(STRING *src), UINTVAL offset, UINTVAL count)
 {
     STRING * const return_string = Parrot_make_COW_reference(interp, src);
+    ASSERT_ARGS(get_codepoints);
 #if PARROT_HAS_ICU
     return_string->strstart = (char*)src->strstart + offset * sizeof (UChar);
     return_string->bufused = count * sizeof (UChar);
@@ -348,6 +354,7 @@
 static STRING *
 get_bytes(PARROT_INTERP, SHIM(STRING *src), UINTVAL offset, UINTVAL count)
 {
+    ASSERT_ARGS(get_bytes);
     UNIMPL;
 }
 
@@ -369,7 +376,7 @@
 get_codepoints_inplace(PARROT_INTERP, SHIM(STRING *src),
         UINTVAL offset, UINTVAL count, SHIM(STRING *dest_string))
 {
-
+    ASSERT_ARGS(get_codepoints_inplace);
     UNIMPL;
 }
 
@@ -390,6 +397,7 @@
 get_bytes_inplace(PARROT_INTERP, SHIM(STRING *src),
         UINTVAL offset, UINTVAL count, SHIM(STRING *return_string))
 {
+    ASSERT_ARGS(get_bytes_inplace);
     UNIMPL;
 }
 
@@ -408,6 +416,7 @@
 set_codepoints(PARROT_INTERP, SHIM(STRING *src),
         UINTVAL offset, UINTVAL count, SHIM(STRING *new_codepoints))
 {
+    ASSERT_ARGS(set_codepoints);
     UNIMPL;
 }
 
@@ -426,6 +435,7 @@
 set_bytes(PARROT_INTERP, SHIM(STRING *src),
         UINTVAL offset, UINTVAL count, SHIM(STRING *new_bytes))
 {
+    ASSERT_ARGS(set_bytes);
     UNIMPL;
 }
 
@@ -442,6 +452,7 @@
 static void
 become_encoding(PARROT_INTERP, SHIM(STRING *src))
 {
+    ASSERT_ARGS(become_encoding);
     UNIMPL;
 }
 
@@ -460,6 +471,7 @@
 static UINTVAL
 codepoints(PARROT_INTERP, ARGIN(STRING *src))
 {
+    ASSERT_ARGS(codepoints);
 #if PARROT_HAS_ICU
     return src->bufused / sizeof (UChar);
 #else
@@ -482,6 +494,7 @@
 static UINTVAL
 bytes(PARROT_INTERP, ARGIN(STRING *src))
 {
+    ASSERT_ARGS(bytes);
     return src->bufused;
 }
 
@@ -506,6 +519,7 @@
      *      iter versions
      */
     const UChar c = s[pos++];
+    ASSERT_ARGS(ucs2_decode_and_advance);
     i->charpos++;
     i->bytepos = pos * sizeof (UChar);
     return c;
@@ -527,6 +541,7 @@
 {
     UChar * const s = (UChar*) i->str->strstart;
     UINTVAL pos = i->bytepos / sizeof (UChar);
+    ASSERT_ARGS(ucs2_encode_and_advance);
     s[pos++] = (UChar)c;
     i->charpos++;
     i->bytepos = pos * sizeof (UChar);
@@ -545,6 +560,7 @@
 static void
 ucs2_set_position(SHIM_INTERP, ARGMOD(String_iter *i), UINTVAL n)
 {
+    ASSERT_ARGS(ucs2_set_position);
     i->charpos = n;
     i->bytepos = n * sizeof (UChar);
 }
@@ -564,6 +580,7 @@
 static void
 iter_init(PARROT_INTERP, ARGIN(const STRING *src), ARGOUT(String_iter *iter))
 {
+    ASSERT_ARGS(iter_init);
 #if PARROT_HAS_ICU
     iter->str             = src;
     iter->bytepos         = 0;
@@ -612,6 +629,7 @@
         bytes,
         iter_init
     };
+    ASSERT_ARGS(Parrot_encoding_ucs2_init);
     STRUCT_COPY_FROM_STRUCT(return_encoding, base_encoding);
     Parrot_register_encoding(interp, "ucs2", return_encoding);
     return return_encoding;

Modified: trunk/src/encodings/utf16.c
==============================================================================
--- trunk/src/encodings/utf16.c	(original)
+++ trunk/src/encodings/utf16.c	Wed Dec 31 11:20:05 2008
@@ -233,6 +233,7 @@
     int src_len;
     int in_place = dest == NULL;
     STRING *result;
+    ASSERT_ARGS(to_encoding);
 
     if (src->encoding == Parrot_utf16_encoding_ptr ||
             src->encoding == Parrot_ucs2_encoding_ptr)
@@ -333,6 +334,7 @@
 #if PARROT_HAS_ICU
     UChar * const s = (UChar*) src->strstart;
     UINTVAL c, pos;
+    ASSERT_ARGS(get_codepoint);
 
     pos = 0;
     U16_FWD_N_UNSAFE(s, pos, offset);
@@ -360,6 +362,7 @@
 static void
 set_codepoint(PARROT_INTERP, ARGIN(STRING *src), UINTVAL offset, UINTVAL codepoint)
 {
+    ASSERT_ARGS(set_codepoint);
     UNUSED(interp);
     UNUSED(src);
     UNUSED(offset);
@@ -381,6 +384,7 @@
 get_byte(SHIM_INTERP, ARGIN(const STRING *src), UINTVAL offset)
 {
     const unsigned char * const contents = (unsigned char *)src->strstart;
+    ASSERT_ARGS(get_byte);
     if (offset >= src->bufused) {
 /*        Parrot_ex_throw_from_c_args(interp, NULL, 0,
                 "get_byte past the end of the buffer (%i of %i)",
@@ -404,6 +408,7 @@
 set_byte(PARROT_INTERP, ARGIN(const STRING *src), UINTVAL offset, UINTVAL byte)
 {
     unsigned char *contents;
+    ASSERT_ARGS(set_byte);
 
     if (offset >= src->bufused)
         Parrot_ex_throw_from_c_args(interp, NULL, 0,
@@ -432,6 +437,7 @@
     String_iter iter;
     UINTVAL start;
     STRING * const return_string = Parrot_make_COW_reference(interp, src);
+    ASSERT_ARGS(get_codepoints);
 
     iter_init(interp, src, &iter);
     iter.set_position(interp, &iter, offset);
@@ -464,6 +470,7 @@
 {
     String_iter iter;
     UINTVAL start;
+    ASSERT_ARGS(get_codepoints_inplace);
     Parrot_reuse_COW_reference(interp, src, return_string);
     iter_init(interp, src, &iter);
     iter.set_position(interp, &iter, offset);
@@ -491,6 +498,7 @@
 static STRING *
 get_bytes(PARROT_INTERP, ARGIN(STRING *src), UINTVAL offset, UINTVAL count)
 {
+    ASSERT_ARGS(get_bytes);
     UNUSED(interp);
     UNUSED(src);
     UNUSED(offset)
@@ -515,6 +523,7 @@
 get_bytes_inplace(PARROT_INTERP, ARGIN(STRING *src),
         UINTVAL offset, UINTVAL count, ARGIN(STRING *return_string))
 {
+    ASSERT_ARGS(get_bytes_inplace);
     UNUSED(interp);
     UNUSED(src);
     UNUSED(offset)
@@ -538,6 +547,7 @@
 set_codepoints(PARROT_INTERP, ARGIN(STRING *src),
         UINTVAL offset, UINTVAL count, ARGIN(STRING *new_codepoints))
 {
+    ASSERT_ARGS(set_codepoints);
     UNUSED(interp);
     UNUSED(src);
     UNUSED(offset)
@@ -561,6 +571,7 @@
 set_bytes(PARROT_INTERP, SHIM(STRING *src),
         UINTVAL offset, UINTVAL count, SHIM(STRING *new_bytes))
 {
+    ASSERT_ARGS(set_bytes);
     UNUSED(interp);
     UNUSED(offset)
     UNUSED(count);
@@ -580,6 +591,7 @@
 static void
 become_encoding(PARROT_INTERP, SHIM(STRING *src))
 {
+    ASSERT_ARGS(become_encoding);
     UNIMPL;
 }
 
@@ -599,6 +611,7 @@
 codepoints(PARROT_INTERP, ARGIN(STRING *src))
 {
     String_iter iter;
+    ASSERT_ARGS(codepoints);
     /*
      * this is used to initially calculate src->strlen,
      * therefore we must scan the whole string
@@ -623,6 +636,7 @@
 static UINTVAL
 bytes(SHIM_INTERP, ARGIN(STRING *src))
 {
+    ASSERT_ARGS(bytes);
     return src->bufused;
 }
 
@@ -643,6 +657,7 @@
 {
     UChar *s = (UChar*) i->str->strstart;
     UINTVAL c, pos;
+    ASSERT_ARGS(utf16_decode_and_advance);
     pos = i->bytepos / sizeof (UChar);
     /* TODO either make sure that we don't go past end or use SAFE
      *      iter versions
@@ -669,6 +684,7 @@
 {
     UChar *s = (UChar*) i->str->strstart;
     UINTVAL pos;
+    ASSERT_ARGS(utf16_encode_and_advance);
     pos = i->bytepos / sizeof (UChar);
     U16_APPEND_UNSAFE(s, pos, c);
     i->charpos++;
@@ -690,6 +706,7 @@
 {
     UChar * const s = (UChar*) i->str->strstart;
     UINTVAL pos;
+    ASSERT_ARGS(utf16_set_position);
     pos = 0;
     U16_FWD_N_UNSAFE(s, pos, n);
     i->charpos = n;
@@ -711,6 +728,7 @@
 static void
 iter_init(PARROT_INTERP, ARGIN(const STRING *src), ARGOUT(String_iter *iter))
 {
+    ASSERT_ARGS(iter_init);
     iter->str = src;
     iter->bytepos = iter->charpos = 0;
 #if PARROT_HAS_ICU
@@ -758,6 +776,7 @@
         bytes,
         iter_init
     };
+    ASSERT_ARGS(Parrot_encoding_utf16_init);
     STRUCT_COPY_FROM_STRUCT(return_encoding, base_encoding);
     Parrot_register_encoding(interp, "utf16", return_encoding);
     return return_encoding;

Modified: trunk/src/encodings/utf8.c
==============================================================================
--- trunk/src/encodings/utf8.c	(original)
+++ trunk/src/encodings/utf8.c	Wed Dec 31 11:20:05 2008
@@ -256,6 +256,7 @@
     const utf8_t *u8ptr = ptr;
     const utf8_t *u8end = u8ptr + byte_len;
     UINTVAL characters = 0;
+    ASSERT_ARGS(utf8_characters);
 
     while (u8ptr < u8end) {
         u8ptr += UTF8SKIP(u8ptr);
@@ -284,6 +285,7 @@
 {
     const utf8_t *u8ptr = ptr;
     UINTVAL c = *u8ptr;
+    ASSERT_ARGS(utf8_decode);
 
     if (UTF8_IS_START(c)) {
         UINTVAL len = UTF8SKIP(u8ptr);
@@ -332,6 +334,7 @@
      * need to do a yucky cast to remove constness */
     const utf8_t * const u8ptr = (utf8_t *)ptr;
     utf8_t              *u8end = (utf8_t *)ptr + len - 1;
+    ASSERT_ARGS(utf8_encode);
 
     if (c > 0x10FFFF || UNICODE_IS_SURROGATE(c)) {
         Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_CHARACTER,
@@ -363,6 +366,7 @@
 utf8_skip_forward(ARGIN(const void *ptr), UINTVAL n)
 {
     const utf8_t *u8ptr = (const utf8_t *)ptr;
+    ASSERT_ARGS(utf8_skip_forward);
 
     while (n-- > 0) {
         u8ptr += UTF8SKIP(u8ptr);
@@ -387,6 +391,7 @@
 utf8_skip_backward(ARGIN(const void *ptr), UINTVAL n)
 {
     const utf8_t *u8ptr = (const utf8_t *)ptr;
+    ASSERT_ARGS(utf8_skip_backward);
 
     while (n-- > 0) {
         u8ptr--;
@@ -425,6 +430,7 @@
 {
     const utf8_t *u8ptr = (utf8_t *)((char *)i->str->strstart + i->bytepos);
     UINTVAL c = *u8ptr;
+    ASSERT_ARGS(utf8_decode_and_advance);
 
     if (UTF8_IS_START(c)) {
         UINTVAL len = UTF8SKIP(u8ptr);
@@ -474,6 +480,7 @@
     const STRING * const s = i->str;
     unsigned char * const pos = (unsigned char *)s->strstart + i->bytepos;
     unsigned char * const new_pos = (unsigned char *)utf8_encode(interp, pos, c);
+    ASSERT_ARGS(utf8_encode_and_advance);
 
     i->bytepos += (new_pos - pos);
     /* XXX possible buffer overrun exception? */
@@ -496,6 +503,7 @@
 utf8_set_position(SHIM_INTERP, ARGMOD(String_iter *i), UINTVAL pos)
 {
     const utf8_t *u8ptr = (const utf8_t *)i->str->strstart;
+    ASSERT_ARGS(utf8_set_position);
 
     /* start from last known charpos, if we can */
     if (i->charpos <= pos) {
@@ -535,6 +543,7 @@
     UINTVAL offs, dest_len, dest_pos, src_len;
     const int in_place = (dest == NULL);
     unsigned char *new_pos, *pos, *p;
+    ASSERT_ARGS(to_encoding);
 
     if (src->encoding == Parrot_utf8_encoding_ptr)
         return in_place ? src : string_copy(interp, src);
@@ -616,6 +625,7 @@
 get_codepoint(PARROT_INTERP, ARGIN(const STRING *src), UINTVAL offset)
 {
     const utf8_t * const start = (const utf8_t *)utf8_skip_forward(src->strstart, offset);
+    ASSERT_ARGS(get_codepoint);
     return utf8_decode(interp, start);
 }
 
@@ -635,6 +645,7 @@
     const void *start;
     void *p;
     DECL_CONST_CAST;
+    ASSERT_ARGS(set_codepoint);
 
     start = utf8_skip_forward(src->strstart, offset);
     p = PARROT_const_cast(void *, start);
@@ -655,6 +666,7 @@
 get_byte(SHIM_INTERP, ARGIN(const STRING *src), UINTVAL offset)
 {
     unsigned char *contents = (unsigned char *)src->strstart;
+    ASSERT_ARGS(get_byte);
     if (offset >= src->bufused) {
 /*        Parrot_ex_throw_from_c_args(interp, NULL, 0,
                 "get_byte past the end of the buffer (%i of %i)",
@@ -679,6 +691,7 @@
         UINTVAL offset, UINTVAL byte)
 {
     unsigned char *contents;
+    ASSERT_ARGS(set_byte);
 
     if (offset >= src->bufused)
         Parrot_ex_throw_from_c_args(interp, NULL, 0,
@@ -707,6 +720,7 @@
     STRING * const return_string = Parrot_make_COW_reference(interp, src);
     String_iter    iter;
     UINTVAL        start;
+    ASSERT_ARGS(get_codepoints);
 
     iter_init(interp, src, &iter);
 
@@ -741,6 +755,7 @@
 get_bytes(PARROT_INTERP, ARGMOD(STRING *src), UINTVAL offset, UINTVAL count)
 {
     STRING * const return_string = Parrot_make_COW_reference(interp, src);
+    ASSERT_ARGS(get_bytes);
 
     return_string->encoding = src->encoding;    /* XXX */
     return_string->charset = src->charset;
@@ -772,6 +787,7 @@
 {
     String_iter iter;
     UINTVAL start;
+    ASSERT_ARGS(get_codepoints_inplace);
 
     Parrot_reuse_COW_reference(interp, src, return_string);
     iter_init(interp, src, &iter);
@@ -805,6 +821,7 @@
 get_bytes_inplace(PARROT_INTERP, SHIM(STRING *src),
         UINTVAL offset, UINTVAL count, SHIM(STRING *return_string))
 {
+    ASSERT_ARGS(get_bytes_inplace);
     UNIMPL;
 }
 
@@ -823,6 +840,7 @@
 set_codepoints(PARROT_INTERP, SHIM(STRING *src),
         UINTVAL offset, UINTVAL count, SHIM(STRING *new_codepoints))
 {
+    ASSERT_ARGS(set_codepoints);
     UNIMPL;
 }
 
@@ -841,6 +859,7 @@
 set_bytes(PARROT_INTERP, SHIM(STRING *src),
         UINTVAL offset, UINTVAL count, SHIM(STRING *new_bytes))
 {
+    ASSERT_ARGS(set_bytes);
     UNIMPL;
 }
 
@@ -857,6 +876,7 @@
 static void
 become_encoding(PARROT_INTERP, SHIM(STRING *src))
 {
+    ASSERT_ARGS(become_encoding);
     UNIMPL;
 }
 
@@ -875,6 +895,7 @@
 codepoints(PARROT_INTERP, ARGMOD(STRING *src))
 {
     String_iter iter;
+    ASSERT_ARGS(codepoints);
     /*
      * this is used to initially calculate src->strlen,
      * therefore we must scan the whole string
@@ -899,6 +920,7 @@
 static UINTVAL
 bytes(SHIM_INTERP, ARGIN(STRING *src))
 {
+    ASSERT_ARGS(bytes);
     return src->bufused;
 }
 
@@ -915,6 +937,7 @@
 static void
 iter_init(SHIM_INTERP, ARGIN(const STRING *src), ARGOUT(String_iter *iter))
 {
+    ASSERT_ARGS(iter_init);
     iter->str             = src;
     iter->bytepos         = 0;
     iter->charpos         = 0;
@@ -958,6 +981,7 @@
         bytes,
         iter_init
     };
+    ASSERT_ARGS(Parrot_encoding_utf8_init);
     STRUCT_COPY_FROM_STRUCT(return_encoding, base_encoding);
     Parrot_register_encoding(interp, "utf8", return_encoding);
     return return_encoding;

Modified: trunk/src/events.c
==============================================================================
--- trunk/src/events.c	(original)
+++ trunk/src/events.c	Wed Dec 31 11:20:05 2008
@@ -230,6 +230,7 @@
 static void
 sig_handler(int signum)
 {
+    ASSERT_ARGS(sig_handler);
     switch (signum) {
         case SIGINT:
             sig_int = 1;
@@ -260,6 +261,7 @@
 #ifdef PARROT_HAS_SIGACTION
     struct sigaction action;
     sigset_t block_mask;
+    ASSERT_ARGS(Parrot_sigaction);
 
     /* install handler */
     action.sa_handler = handler;
@@ -272,6 +274,7 @@
     sigaddset(&block_mask, sig);
     sigprocmask(SIG_BLOCK, &block_mask, NULL);
 #else
+    ASSERT_ARGS(Parrot_sigaction);
     UNUSED(sig);
     UNUSED(handler);
 #endif
@@ -293,11 +296,13 @@
 {
 #ifdef PARROT_HAS_SIGACTION
     sigset_t block_mask;
+    ASSERT_ARGS(Parrot_unblock_signal);
 
     sigemptyset(&block_mask);
     sigaddset(&block_mask, sig);
     sigprocmask(SIG_UNBLOCK, &block_mask, NULL);
 #else
+    ASSERT_ARGS(Parrot_unblock_signal);
     UNUSED(sig);
 #endif
 }
@@ -318,6 +323,7 @@
 void
 Parrot_init_signals(void)
 {
+    ASSERT_ARGS(Parrot_init_signals);
     /*
      * SIGFPE is architecture specific - some signal an error,
      * some don't, so we have to use direct checks if we are dividing
@@ -349,6 +355,7 @@
 #ifndef WIN32
     Parrot_thread    io_handle;
 #endif
+    ASSERT_ARGS(init_events_first);
 
     /*
      * be sure all init is done only once
@@ -404,6 +411,7 @@
 static void
 init_events_all(PARROT_INTERP)
 {
+    ASSERT_ARGS(init_events_all);
     /*
      * create per interpreter task queue
      */
@@ -424,6 +432,7 @@
 void
 Parrot_init_events(PARROT_INTERP)
 {
+    ASSERT_ARGS(Parrot_init_events);
     if (!interp->parent_interpreter) {
         /* add the very first interpreter to the list of interps. */
         pt_add_to_interpreters(interp, NULL);
@@ -453,6 +462,7 @@
 Parrot_schedule_event(PARROT_INTERP, ARGMOD(parrot_event* ev))
 {
     QUEUE_ENTRY * const entry = mem_allocate_typed(QUEUE_ENTRY);
+    ASSERT_ARGS(Parrot_schedule_event);
     entry->next = NULL;
     ev->interp  = interp;
     entry->data = ev;
@@ -490,6 +500,7 @@
 {
     parrot_event* const ev    = mem_allocate_typed(parrot_event);
     QUEUE_ENTRY * const entry = mem_allocate_typed(QUEUE_ENTRY);
+    ASSERT_ARGS(schedule_signal_event);
 
     entry->next  = NULL;
     entry->type  = QUEUE_ENTRY_TYPE_EVENT;
@@ -521,6 +532,7 @@
     parrot_event* const ev = mem_allocate_typed(parrot_event);
 
     const FLOATVAL now = Parrot_floatval_time();
+    ASSERT_ARGS(Parrot_new_timer_event);
 
     ev->type                   = typ;
     ev->u.timer_event.timer    = timer;
@@ -551,6 +563,7 @@
 {
     parrot_event* const ev    = mem_allocate_typed(parrot_event);
     QUEUE_ENTRY*  const entry = mem_allocate_typed(QUEUE_ENTRY);
+    ASSERT_ARGS(Parrot_new_cb_event);
 
     entry->next = NULL;
     entry->data = ev;
@@ -576,6 +589,7 @@
 Parrot_del_timer_event(PARROT_INTERP, ARGIN(const PMC *timer))
 {
     QUEUE_ENTRY *entry;
+    ASSERT_ARGS(Parrot_del_timer_event);
 
     LOCK(event_queue->queue_mutex);
 
@@ -611,6 +625,7 @@
 Parrot_new_terminate_event(PARROT_INTERP)
 {
     parrot_event* const ev = mem_allocate_typed(parrot_event);
+    ASSERT_ARGS(Parrot_new_terminate_event);
     ev->type = EVENT_TYPE_TERMINATE;
     Parrot_schedule_event(interp, ev);
 }
@@ -632,6 +647,7 @@
 {
     QUEUE_ENTRY *qe;
     parrot_event* const ev = mem_allocate_typed(parrot_event);
+    ASSERT_ARGS(Parrot_new_suspend_for_gc_event);
     ev->type = EVENT_TYPE_SUSPEND_FOR_GC;
     qe = mem_allocate_typed(QUEUE_ENTRY);
     qe->next = NULL;
@@ -658,6 +674,7 @@
 Parrot_kill_event_loop(PARROT_INTERP)
 {
     parrot_event* const ev = mem_allocate_typed(parrot_event);
+    ASSERT_ARGS(Parrot_kill_event_loop);
     ev->type = EVENT_TYPE_EVENT_TERMINATE;
     Parrot_schedule_event(interp, ev);
 }
@@ -678,6 +695,7 @@
 Parrot_schedule_interp_qentry(PARROT_INTERP, ARGIN(struct QUEUE_ENTRY *entry))
 {
     parrot_event * const event = (parrot_event *)entry->data;
+    ASSERT_ARGS(Parrot_schedule_interp_qentry);
     /*
      * sleep checks events when it awakes
      */
@@ -716,6 +734,7 @@
 Parrot_schedule_broadcast_qentry(ARGIN(struct QUEUE_ENTRY *entry))
 {
     parrot_event * const event = (parrot_event *)entry->data;
+    ASSERT_ARGS(Parrot_schedule_broadcast_qentry);
 
     switch (event->type) {
         case EVENT_TYPE_SIGNAL:
@@ -794,6 +813,7 @@
 static void
 store_io_event(ARGMOD(pending_io_events *ios), ARGIN(parrot_event *ev))
 {
+    ASSERT_ARGS(store_io_event);
     if (!ios->alloced) {
         ios->alloced = 16;
         ios->events  = mem_allocate_n_zeroed_typed(ios->alloced, parrot_event *);
@@ -821,6 +841,7 @@
 io_thread_ready_rd(ARGMOD(pending_io_events *ios), int ready_rd)
 {
     size_t i;
+    ASSERT_ARGS(io_thread_ready_rd);
 
     for (i = 0; i < ios->n; ++i) {
         parrot_event * const ev  = ios->events[i];
@@ -861,6 +882,7 @@
     int n_highest, i;
     int  running = 1;
     pending_io_events ios;
+    ASSERT_ARGS(io_thread);
 
     ios.n       = 0;
     ios.alloced = 0;
@@ -986,6 +1008,7 @@
 {
 #ifndef WIN32
     io_thread_msg buf;
+    ASSERT_ARGS(stop_io_thread);
     /*
      * tell IO thread to stop
      */
@@ -1013,6 +1036,7 @@
 {
     io_thread_msg buf;
     parrot_event * const event = mem_allocate_typed(parrot_event);
+    ASSERT_ARGS(Parrot_event_add_io_event);
 
     event->type   = EVENT_TYPE_IO;
     event->interp = interp;
@@ -1057,6 +1081,7 @@
 dup_entry(ARGIN(const QUEUE_ENTRY *entry))
 {
     QUEUE_ENTRY * const new_entry = mem_allocate_typed(QUEUE_ENTRY);
+    ASSERT_ARGS(dup_entry);
 
     new_entry->next = NULL;
     new_entry->type = entry->type;
@@ -1083,6 +1108,7 @@
 {
     QUEUE_ENTRY  * const new_entry = dup_entry(entry);
     parrot_event * const event     = (parrot_event *)new_entry->data;
+    ASSERT_ARGS(dup_entry_interval);
 
     event->u.timer_event.abs_time  = now + event->u.timer_event.interval;
 
@@ -1105,6 +1131,7 @@
 {
     FLOATVAL     now;
     QUEUE_ENTRY *entry;
+    ASSERT_ARGS(process_events);
 
     while ((entry = peek_entry(event_q)) != NULL) {
         /*
@@ -1189,6 +1216,7 @@
 {
     QUEUE * const event_q = (QUEUE *) data;
     int running = 1;
+    ASSERT_ARGS(event_thread);
 
     LOCK(event_q->queue_mutex);
     /*
@@ -1260,6 +1288,7 @@
 wait_for_wakeup(PARROT_INTERP, ARGIN_NULLOK(opcode_t *next))
 {
     QUEUE * const tq = interp->task_queue;
+    ASSERT_ARGS(wait_for_wakeup);
 
     interp->sleeping = 1;
 
@@ -1306,6 +1335,7 @@
 opcode_t *
 Parrot_sleep_on_event(PARROT_INTERP, FLOATVAL t, ARGIN_NULLOK(opcode_t *next))
 {
+    ASSERT_ARGS(Parrot_sleep_on_event);
 #if PARROT_HAS_THREADS
 
     if (interp->sleeping)
@@ -1348,6 +1378,7 @@
 opcode_t *
 Parrot_do_check_events(PARROT_INTERP, ARGIN_NULLOK(opcode_t *next))
 {
+    ASSERT_ARGS(Parrot_do_check_events);
     if (peek_entry(interp->task_queue))
         return Parrot_do_handle_events(interp, 0, next);
 
@@ -1368,6 +1399,7 @@
 event_to_exception(PARROT_INTERP, ARGIN(const parrot_event* event))
 {
     const int exit_code = -event->u.signal;
+    ASSERT_ARGS(event_to_exception);
 
     switch (event->u.signal) {
         case SIGINT:
@@ -1408,6 +1440,7 @@
 static opcode_t *
 do_event(PARROT_INTERP, ARGIN(parrot_event* event), ARGIN_NULLOK(opcode_t *next))
 {
+    ASSERT_ARGS(do_event);
     edebug((stderr, "do_event %s\n", et(event)));
     switch (event->type) {
         case EVENT_TYPE_TERMINATE:
@@ -1471,6 +1504,7 @@
 Parrot_do_handle_events(PARROT_INTERP, int restore, ARGIN_NULLOK(opcode_t *next))
 {
     QUEUE * const tq = interp->task_queue;
+    ASSERT_ARGS(Parrot_do_handle_events);
 
     if (restore)
         disable_event_checking(interp);

Modified: trunk/src/gc/register.c
==============================================================================
--- trunk/src/gc/register.c	(original)
+++ trunk/src/gc/register.c	Wed Dec 31 11:20:05 2008
@@ -156,6 +156,7 @@
 {
     Parrot_Context *context = CONTEXT(interp);
     int             slot;
+    ASSERT_ARGS(destroy_context);
 
     while (context) {
         Parrot_Context * const prev = context->caller_ctx;
@@ -195,6 +196,7 @@
 {
     static INTVAL   num_regs[] = {32, 32, 32, 32};
     Parrot_Context *ignored;
+    ASSERT_ARGS(create_initial_context);
 
     /* Create some initial free_list slots. */
 
@@ -226,12 +228,14 @@
 {
 #if CHUNKED_CTX_MEM
     Parrot_Context ctx;
+    ASSERT_ARGS(parrot_gc_context);
 
     if (!interp->ctx_mem.threshold)
         return;
     LVALUE_CAST(char *, ctx.bp) = interp->ctx_mem.threshold
                                 - sizeof (parrot_regs_t);
 #else
+    ASSERT_ARGS(parrot_gc_context);
     UNUSED(interp);
 #endif
 }
@@ -253,6 +257,7 @@
 clear_regs(PARROT_INTERP, ARGMOD(Parrot_Context *ctx))
 {
     int i;
+    ASSERT_ARGS(clear_regs);
 
     /* NULL out registers - P/S have to be NULL for GC
      *
@@ -302,6 +307,7 @@
 init_context(PARROT_INTERP, ARGMOD(Parrot_Context *ctx),
         ARGIN_NULLOK(const Parrot_Context *old))
 {
+    ASSERT_ARGS(init_context);
     ctx->ref_count         = 0;    /* RT #46191 1 - Exceptions !!! */
     ctx->gc_mark           = 0;
     ctx->current_results   = NULL;
@@ -350,6 +356,7 @@
 {
     Parrot_Context * const old = CONTEXT(interp);
     Parrot_Context * const ctx = Parrot_set_new_context(interp, n_regs_used);
+    ASSERT_ARGS(Parrot_push_context);
 
     ctx->caller_ctx  = old;
 
@@ -378,6 +385,7 @@
 {
     Parrot_Context * const ctx = CONTEXT(interp);
     Parrot_Context * const old = ctx->caller_ctx;
+    ASSERT_ARGS(Parrot_pop_context);
 
 #if CTX_LEAK_DEBUG
     if (ctx->ref_count > 0 &&
@@ -430,6 +438,7 @@
 
     /* this gets attached to the context, which should free it */
     INTVAL * const n_regs_used = mem_allocate_n_zeroed_typed(4, INTVAL);
+    ASSERT_ARGS(Parrot_alloc_context);
     n_regs_used[REGNO_INT]     = number_regs_used[REGNO_INT];
     n_regs_used[REGNO_NUM]     = number_regs_used[REGNO_NUM];
     n_regs_used[REGNO_STR]     = number_regs_used[REGNO_STR];
@@ -513,6 +522,7 @@
 {
     Parrot_Context *old = CONTEXT(interp);
     Parrot_Context *ctx = Parrot_alloc_context(interp, number_regs_used, old);
+    ASSERT_ARGS(Parrot_set_new_context);
 
     CONTEXT(interp)          = ctx;
     interp->ctx.bp.regs_i    = ctx->bp.regs_i;
@@ -538,6 +548,7 @@
 void
 Parrot_free_context(PARROT_INTERP, ARGMOD(Parrot_Context *ctx), int deref)
 {
+    ASSERT_ARGS(Parrot_free_context);
     /*
      * The context structure has a reference count, initially 0.
      * This field is incremented when something outside of the normal
@@ -643,6 +654,7 @@
 Parrot_context_ref_trace(PARROT_INTERP, ARGMOD(Parrot_Context *ctx),
         ARGIN(const char *file), int line)
 {
+    ASSERT_ARGS(Parrot_context_ref_trace);
     if (Interp_debug_TEST(interp, PARROT_CTX_DESTROY_DEBUG_FLAG)) {
         const char *name = "unknown";
 
@@ -672,6 +684,7 @@
 void
 Parrot_set_context_threshold(SHIM_INTERP, SHIM(Parrot_Context *ctx))
 {
+    ASSERT_ARGS(Parrot_set_context_threshold);
     /* nothing to do */
 }
 
@@ -698,6 +711,7 @@
 Parrot_clear_i(PARROT_INTERP)
 {
     int i;
+    ASSERT_ARGS(Parrot_clear_i);
     for (i = 0; i < CONTEXT(interp)->n_regs_used[REGNO_INT]; ++i)
         REG_INT(interp, i) = 0;
 }
@@ -718,6 +732,7 @@
 Parrot_clear_s(PARROT_INTERP)
 {
     int i;
+    ASSERT_ARGS(Parrot_clear_s);
     for (i = 0; i < CONTEXT(interp)->n_regs_used[REGNO_STR]; ++i)
         REG_STR(interp, i) = NULL;
 }
@@ -738,6 +753,7 @@
 Parrot_clear_p(PARROT_INTERP)
 {
     int i;
+    ASSERT_ARGS(Parrot_clear_p);
     for (i = 0; i < CONTEXT(interp)->n_regs_used[REGNO_PMC]; ++i)
         REG_PMC(interp, i) = PMCNULL;
 }
@@ -758,6 +774,7 @@
 Parrot_clear_n(PARROT_INTERP)
 {
     int i;
+    ASSERT_ARGS(Parrot_clear_n);
     for (i = 0; i < CONTEXT(interp)->n_regs_used[REGNO_NUM]; ++i)
         REG_NUM(interp, i) = 0.0;
 }

Modified: trunk/src/gc/res_lea.c
==============================================================================
--- trunk/src/gc/res_lea.c	(original)
+++ trunk/src/gc/res_lea.c	Wed Dec 31 11:20:05 2008
@@ -45,6 +45,7 @@
 void
 Parrot_go_collect(PARROT_INTERP)
 {
+    ASSERT_ARGS(parrot_go_collect);
     if (interp->arena_base->GC_block_level) {
         return;
     }
@@ -66,6 +67,7 @@
 xmalloc(size_t size)
 {
     void *p = malloc(size);
+    ASSERT_ARGS(xmalloc);
     if (!p)
         do_panic(NULL, "malloc: out of mem", __FILE__, __LINE__);
     return p;
@@ -86,6 +88,7 @@
 xcalloc(size_t n, size_t size)
 {
     void * const p = calloc(n, size);
+    ASSERT_ARGS(xcalloc);
     if (!p)
         do_panic(NULL, "calloc: out of mem", __FILE__, __LINE__);
     return p;
@@ -106,6 +109,7 @@
 xrealloc(void *p, size_t size)
 {
     void * const n = realloc(p, size);
+    ASSERT_ARGS(xrealloc);
     if (!n)
         do_panic(NULL, "realloc: out of mem", __FILE__, __LINE__);
     return n;
@@ -127,6 +131,7 @@
 {
     const size_t oldlen = PObj_buflen(buffer);
     Buffer_alloc_unit *p;
+    ASSERT_ARGS(parrot_reallocate);
 
     if (!PObj_bufstart(buffer)) {
         Parrot_allocate_aligned(interp, buffer, newsize);
@@ -173,6 +178,7 @@
 Parrot_allocate_aligned(PARROT_INTERP, Buffer *buffer, size_t size)
 {
     Buffer_alloc_unit *p;
+    ASSERT_ARGS(parrot_allocate_aligned);
     p = (Buffer_alloc_unit *) xmalloc(Buffer_alloc_offset + size);
     p->ref_count = 0;
     PObj_bufstart(buffer) = p->buffer;
@@ -194,6 +200,7 @@
 Parrot_reallocate_string(PARROT_INTERP, STRING *str, size_t newsize)
 {
     Buffer_alloc_unit *p;
+    ASSERT_ARGS(parrot_reallocate_string);
 
     if (!PObj_bufstart(str)) {
         Parrot_allocate_string(interp, str, newsize);
@@ -221,6 +228,7 @@
 Parrot_allocate_string(PARROT_INTERP, STRING *str, size_t size)
 {
     Buffer_alloc_unit *p;
+    ASSERT_ARGS(parrot_allocate_string);
     p = (Buffer_alloc_unit *) xcalloc(Buffer_alloc_offset + size, 1);
     p->ref_count = 0;
     PObj_bufstart(str) = str->strstart = (char *) p->buffer;
@@ -240,6 +248,7 @@
 void
 Parrot_initialize_memory_pools(PARROT_INTERP)
 {
+    ASSERT_ARGS(parrot_initialize_memory_pools);
 }
 
 /*
@@ -254,6 +263,7 @@
 void
 Parrot_merge_memory_pools(Interp *dest, Interp *source)
 {
+    ASSERT_ARGS(parrot_merge_memory_pools);
 }
 
 /*
@@ -269,6 +279,7 @@
 void
 Parrot_destroy_memory_pools(PARROT_INTERP)
 {
+    ASSERT_ARGS(parrot_destroy_memory_pools);
 }
 
 /*

Modified: trunk/src/gc/resources.c
==============================================================================
--- trunk/src/gc/resources.c	(original)
+++ trunk/src/gc/resources.c	Wed Dec 31 11:20:05 2008
@@ -139,6 +139,7 @@
 
     const size_t alloc_size = (size > pool->minimum_block_size)
             ? size : pool->minimum_block_size;
+    ASSERT_ARGS(alloc_new_block);
 
 #if RESOURCE_DEBUG
     fprintf(stderr, "new_block (%s) size %u -> %u\n",
@@ -220,6 +221,7 @@
 mem_allocate(PARROT_INTERP, size_t size, ARGMOD(Memory_Pool *pool))
 {
     void *return_val;
+    ASSERT_ARGS(mem_allocate);
 
     /* we always should have one block at least */
     PARROT_ASSERT(pool->top_block);
@@ -299,6 +301,7 @@
     static char reg[10];
 
     Parrot_Context* const ctx = CONTEXT(interp);
+    ASSERT_ARGS(buffer_location);
 
     for (i = 0; i < ctx->n_regs_used[REGNO_STR]; ++i) {
         PObj * const obj = (PObj *) CTX_REG_STR(interp, ctx, i);
@@ -323,6 +326,7 @@
 static void
 debug_print_buf(PARROT_INTERP, ARGIN(const PObj *b))
 {
+    ASSERT_ARGS(debug_print_buf);
     fprintf(stderr, "found %p, len %d, flags 0x%08x at %s\n",
             b, (int)PObj_buflen(b), (uint)PObj_get_FLAGS(b),
             buffer_location(interp, b));
@@ -357,6 +361,7 @@
 
     Small_Object_Arena *cur_buffer_arena;
     Arenas * const      arena_base = interp->arena_base;
+    ASSERT_ARGS(compact_pool);
 
     /* Bail if we're blocked */
     if (arena_base->GC_block_level)
@@ -586,6 +591,7 @@
 void
 Parrot_go_collect(PARROT_INTERP)
 {
+    ASSERT_ARGS(Parrot_go_collect);
     compact_pool(interp, interp->arena_base->memory_pool);
 }
 
@@ -606,6 +612,7 @@
 static size_t
 aligned_size(ARGIN(const Buffer *buffer), size_t len)
 {
+    ASSERT_ARGS(aligned_size);
     if (PObj_is_COWable_TEST(buffer))
         len += sizeof (void*);
     if (PObj_aligned_TEST(buffer))
@@ -632,6 +639,7 @@
 static char *
 aligned_mem(ARGIN(const Buffer *buffer), ARGIN(char *mem))
 {
+    ASSERT_ARGS(aligned_mem);
     if (PObj_is_COWable_TEST(buffer))
         mem += sizeof (void*);
     if (PObj_aligned_TEST(buffer))
@@ -660,6 +668,7 @@
 static size_t
 aligned_string_size(size_t len)
 {
+    ASSERT_ARGS(aligned_string_size);
     len += sizeof (void*);
     len = (len + WORD_ALIGN_1) & WORD_ALIGN_MASK;
     return len;
@@ -682,6 +691,7 @@
 {
     Memory_Pool * const pool = interp->arena_base->memory_pool;
     Memory_Block * cur_block = pool->top_block;
+    ASSERT_ARGS(Parrot_in_memory_pool);
 
     while (cur_block) {
         if ((char *)bufstart >= cur_block->start &&
@@ -721,6 +731,7 @@
     char  *mem;
     Memory_Pool * const pool = interp->arena_base->memory_pool;
     size_t new_size, needed, old_size;
+    ASSERT_ARGS(Parrot_reallocate);
 
     /*
      * we don't shrink buffers
@@ -794,6 +805,7 @@
         PObj_constant_TEST(str)
             ? interp->arena_base->constant_string_pool
             : interp->arena_base->memory_pool;
+    ASSERT_ARGS(Parrot_reallocate_string);
 
     /* if the requested size is smaller then buflen, we are done */
     if (newsize <= PObj_buflen(str))
@@ -856,6 +868,7 @@
 void
 Parrot_allocate(PARROT_INTERP, ARGOUT(Buffer *buffer), size_t size)
 {
+    ASSERT_ARGS(Parrot_allocate);
     PObj_buflen(buffer) = 0;
     PObj_bufstart(buffer) = NULL;
     PARROT_ASSERT((size & WORD_ALIGN_1) == 0);
@@ -882,6 +895,7 @@
 {
     size_t new_size;
     char *mem;
+    ASSERT_ARGS(Parrot_allocate_aligned);
 
     PObj_buflen(buffer) = 0;
     PObj_bufstart(buffer) = NULL;
@@ -914,6 +928,7 @@
     size_t       new_size;
     Memory_Pool *pool;
     char        *mem;
+    ASSERT_ARGS(Parrot_allocate_string);
 
     PObj_buflen(str)   = 0;
     PObj_bufstart(str) = NULL;
@@ -954,6 +969,7 @@
 new_memory_pool(size_t min_block, NULLOK(compact_f compact))
 {
     Memory_Pool * const pool = mem_internal_allocate_typed(Memory_Pool);
+    ASSERT_ARGS(new_memory_pool);
 
     pool->top_block              = NULL;
     pool->compact                = compact;
@@ -983,6 +999,7 @@
 Parrot_initialize_memory_pools(PARROT_INTERP)
 {
     Arenas * const arena_base = interp->arena_base;
+    ASSERT_ARGS(Parrot_initialize_memory_pools);
 
     arena_base->memory_pool   = new_memory_pool(POOL_SIZE, &compact_pool);
     alloc_new_block(interp, POOL_SIZE, arena_base->memory_pool, "init");
@@ -1009,6 +1026,7 @@
 Parrot_destroy_memory_pools(PARROT_INTERP)
 {
     int i;
+    ASSERT_ARGS(Parrot_destroy_memory_pools);
 
     for (i = 0; i < 2; i++) {
         Memory_Pool * const pool = i ?
@@ -1044,6 +1062,7 @@
 merge_pools(ARGMOD(Memory_Pool *dest), ARGMOD(Memory_Pool *source))
 {
     Memory_Block *cur_block;
+    ASSERT_ARGS(merge_pools);
 
     cur_block = source->top_block;
 
@@ -1087,6 +1106,7 @@
 void
 Parrot_merge_memory_pools(ARGIN(Interp *dest_interp), ARGIN(Interp *source_interp))
 {
+    ASSERT_ARGS(Parrot_merge_memory_pools);
     merge_pools(dest_interp->arena_base->constant_string_pool,
                 source_interp->arena_base->constant_string_pool);
 

Modified: trunk/src/gc/smallobject.c
==============================================================================
--- trunk/src/gc/smallobject.c	(original)
+++ trunk/src/gc/smallobject.c	Wed Dec 31 11:20:05 2008
@@ -113,6 +113,7 @@
 contained_in_pool(ARGIN(const Small_Object_Pool *pool), ARGIN(const void *ptr))
 {
     const Small_Object_Arena *arena;
+    ASSERT_ARGS(contained_in_pool);
 
     ptr = PObj_to_ARENA(ptr);
 
@@ -145,6 +146,7 @@
 {
     Small_Object_Pool * const pool = interp->arena_base->constant_pmc_pool;
     const               int   c    = contained_in_pool(pool, pmc);
+    ASSERT_ARGS(Parrot_is_const_pmc);
 
     /* some paranoia first. */
     /* I wonder if it would save any machine cycles to write
@@ -170,6 +172,7 @@
 static void
 more_traceable_objects(PARROT_INTERP, ARGMOD(Small_Object_Pool *pool))
 {
+    ASSERT_ARGS(more_traceable_objects);
     if (pool->skip)
         pool->skip = 0;
     else {
@@ -204,6 +207,7 @@
 gc_ms_add_free_pmc_ext(SHIM_INTERP, ARGMOD(Small_Object_Pool *pool), ARGIN(void *to_add))
 {
     PMC_EXT *object        = (PMC_EXT *)to_add;
+    ASSERT_ARGS(gc_ms_add_free_pmc_ext);
     object->_metadata      = NULL;
 
     /* yes, this cast is a hack for now, but a pointer is a pointer */
@@ -226,6 +230,7 @@
 gc_ms_add_free_object(SHIM_INTERP, ARGMOD(Small_Object_Pool *pool), ARGIN(void *to_add))
 {
     PObj *object           = (PObj *)to_add;
+    ASSERT_ARGS(gc_ms_add_free_object);
 
     PObj_flags_SETTO(object, PObj_on_free_list_FLAG);
 
@@ -255,6 +260,7 @@
 {
     PObj *ptr;
     PObj *free_list = (PObj *)pool->free_list;
+    ASSERT_ARGS(gc_ms_get_free_object);
 
     /* if we don't have any objects */
     if (!free_list) {
@@ -289,6 +295,7 @@
 {
     PMC_EXT *ptr;
     PMC_EXT *free_list = (PMC_EXT *)pool->free_list;
+    ASSERT_ARGS(gc_ms_get_free_pmc_ext);
 
     /* if we don't have any objects */
     if (!free_list) {
@@ -323,6 +330,7 @@
     UINTVAL  i;
     void    *object;
     const UINTVAL num_objects = pool->objects_per_alloc;
+    ASSERT_ARGS(Parrot_add_to_free_list);
 
     pool->total_objects += num_objects;
     arena->used          = num_objects;
@@ -354,6 +362,7 @@
     ARGMOD(Small_Object_Pool *pool),
     ARGMOD(Small_Object_Arena *new_arena), size_t size)
 {
+    ASSERT_ARGS(Parrot_append_arena_in_pool);
 
     /* Maintain the *_arena_memory invariant for stack walking code. Set it
      * regardless if we're the first pool to be added. */
@@ -397,6 +406,7 @@
 
     const size_t size = pool->object_size * pool->objects_per_alloc;
     size_t alloc_size;
+    ASSERT_ARGS(gc_ms_alloc_objects);
 
     /* could be mem_internal_allocate too, but calloc is fast */
     new_arena->start_objects = mem_internal_allocate_zeroed(size);
@@ -445,6 +455,7 @@
 {
     Small_Object_Pool * const pool =
         mem_internal_allocate_zeroed_typed(Small_Object_Pool);
+    ASSERT_ARGS(new_small_object_pool);
 
     pool->last_Arena        = NULL;
     pool->free_list         = NULL;
@@ -469,6 +480,7 @@
 void
 gc_pmc_ext_pool_init(ARGMOD(Small_Object_Pool *pool))
 {
+    ASSERT_ARGS(gc_pmc_ext_pool_init);
     pool->add_free_object = gc_ms_add_free_pmc_ext;
     pool->get_free_object = gc_ms_get_free_pmc_ext;
     pool->alloc_objects   = gc_ms_alloc_objects;
@@ -490,6 +502,7 @@
 static void
 gc_ms_pool_init(SHIM_INTERP, ARGMOD(Small_Object_Pool *pool))
 {
+    ASSERT_ARGS(gc_ms_pool_init);
     pool->add_free_object = gc_ms_add_free_object;
     pool->get_free_object = gc_ms_get_free_object;
     pool->alloc_objects   = gc_ms_alloc_objects;
@@ -513,6 +526,7 @@
 Parrot_gc_ms_init(PARROT_INTERP)
 {
     Arenas * const arena_base     = interp->arena_base;
+    ASSERT_ARGS(Parrot_gc_ms_init);
 
     arena_base->do_gc_mark         = Parrot_dod_ms_run;
     arena_base->finalize_gc_system = NULL;
@@ -538,6 +552,7 @@
 {
     Small_Object_Arena  *cur_arena;
     void               **free_list_end;
+    ASSERT_ARGS(Parrot_small_object_pool_merge);
 
     /* XXX num_free_objects doesn't seem to be accounted correctly in, e.g.,
      * the PMC_EXT pool.

Modified: trunk/src/hash.c
==============================================================================
--- trunk/src/hash.c	(original)
+++ trunk/src/hash.c	Wed Dec 31 11:20:05 2008
@@ -171,6 +171,7 @@
 static size_t
 key_hash_STRING(PARROT_INTERP, ARGMOD(STRING *s), SHIM(size_t seed))
 {
+    ASSERT_ARGS(key_hash_STRING);
     if (s->hashval == 0) {
         return string_hash(interp, s);
     }
@@ -194,6 +195,7 @@
 {
     STRING const *s1 = (STRING const *)search_key;
     STRING const *s2 = (STRING const *)bucket_key;
+    ASSERT_ARGS(STRING_compare);
 
     if (!s2)
         return 1;
@@ -223,6 +225,7 @@
 static int
 pointer_compare(SHIM_INTERP, ARGIN_NULLOK(const void *a), ARGIN_NULLOK(const void *b))
 {
+    ASSERT_ARGS(pointer_compare);
     return a != b;
 }
 
@@ -241,6 +244,7 @@
 static size_t
 key_hash_pointer(SHIM_INTERP, ARGIN(const void *value), size_t seed)
 {
+    ASSERT_ARGS(key_hash_pointer);
     return ((size_t) value) ^ seed;
 }
 
@@ -266,6 +270,7 @@
 {
     register size_t h = seed;
     const unsigned char * p = (const unsigned char *) value;
+    ASSERT_ARGS(key_hash_cstring);
 
     while (*p) {
         h += h << 5;
@@ -289,6 +294,7 @@
 static int
 cstring_compare(SHIM_INTERP, ARGIN(const char *a), ARGIN(const char *b))
 {
+    ASSERT_ARGS(cstring_compare);
     return strcmp(a, b);
 }
 
@@ -307,6 +313,7 @@
 size_t
 key_hash_int(SHIM_INTERP, ARGIN(const void *value), size_t seed)
 {
+    ASSERT_ARGS(key_hash_int);
     return (size_t)value ^ seed;
 }
 
@@ -325,6 +332,7 @@
 int
 int_compare(SHIM_INTERP, ARGIN_NULLOK(const void *a), ARGIN_NULLOK(const void *b))
 {
+    ASSERT_ARGS(int_compare);
     return a != b;
 }
 
@@ -342,6 +350,7 @@
 void
 parrot_dump_hash(SHIM_INTERP, ARGIN(const Hash *hash))
 {
+    ASSERT_ARGS(parrot_dump_hash);
     UNUSED(hash);
 }
 
@@ -362,6 +371,7 @@
 {
     int mark_key   = 0;
     int mark_value = 0;
+    ASSERT_ARGS(parrot_mark_hash);
 
     if (hash->entry_type == (PARROT_DATA_TYPE) enum_hash_string
     ||  hash->entry_type == (PARROT_DATA_TYPE) enum_hash_pmc)
@@ -389,6 +399,7 @@
     UINTVAL entries = hash->entries;
     UINTVAL found   = 0;
     INTVAL  i;
+    ASSERT_ARGS(parrot_mark_hash_keys);
 
     for (i = hash->mask; i >= 0; --i) {
         HashBucket *bucket = hash->bi[i];
@@ -413,6 +424,7 @@
     UINTVAL entries = hash->entries;
     UINTVAL found   = 0;
     INTVAL  i;
+    ASSERT_ARGS(parrot_mark_hash_values);
 
     for (i = hash->mask; i >= 0; --i) {
         HashBucket *bucket = hash->bi[i];
@@ -437,6 +449,7 @@
     UINTVAL entries = hash->entries;
     UINTVAL found   = 0;
     INTVAL  i;
+    ASSERT_ARGS(parrot_mark_hash_both);
 
     for (i = hash->mask; i >= 0; --i) {
         HashBucket *bucket = hash->bi[i];
@@ -478,6 +491,7 @@
 
     /* during thaw info->extra is the key/value count */
     const size_t num_entries = (size_t) hash->entries;
+    ASSERT_ARGS(hash_thaw);
 
     hash->entries = 0;
 
@@ -546,6 +560,7 @@
 {
     size_t i;
     IMAGE_IO * const io = info->image_io;
+    ASSERT_ARGS(hash_freeze);
 
     for (i = 0; i <= hash->mask; i++) {
         HashBucket *b = hash->bi[i];
@@ -597,6 +612,7 @@
 parrot_hash_visit(PARROT_INTERP, ARGMOD(Hash *hash), ARGMOD(void *pinfo))
 {
     visit_info* const info = (visit_info*) pinfo;
+    ASSERT_ARGS(parrot_hash_visit);
 
     switch (info->what) {
         case VISIT_THAW_NORMAL:
@@ -669,6 +685,7 @@
      */
     HashBucket * const new_mem =
         (HashBucket *)mem_sys_realloc(old_mem, HASH_ALLOC_SIZE(new_size));
+    ASSERT_ARGS(expand_hash);
     /*
          +---+---+---+---+---+---+-+-+-+-+-+-+-+-+
          |  bs       | old_bi    |  new_bi       |
@@ -754,6 +771,7 @@
 void
 parrot_new_hash(PARROT_INTERP, ARGOUT(Hash **hptr))
 {
+    ASSERT_ARGS(parrot_new_hash);
     parrot_new_hash_x(interp,
             hptr,
             enum_type_PMC,
@@ -776,6 +794,7 @@
 void
 parrot_new_pmc_hash(PARROT_INTERP, ARGOUT(PMC *container))
 {
+    ASSERT_ARGS(parrot_new_pmc_hash);
     parrot_new_pmc_hash_x(interp,
             container,
             enum_type_PMC,
@@ -798,6 +817,7 @@
 void
 parrot_new_cstring_hash(PARROT_INTERP, ARGOUT(Hash **hptr))
 {
+    ASSERT_ARGS(parrot_new_cstring_hash);
     parrot_new_hash_x(interp,
             hptr,
             enum_type_PMC,
@@ -831,6 +851,7 @@
     HashBucket *bp;
 
     Hash * const hash = mem_allocate_zeroed_typed(Hash);
+    ASSERT_ARGS(create_hash);
 
     hash->compare    = compare;
     hash->hash_val   = keyhash;
@@ -890,6 +911,7 @@
 void
 parrot_hash_destroy(SHIM_INTERP, ARGMOD(Hash *hash))
 {
+    ASSERT_ARGS(parrot_hash_destroy);
     mem_sys_free(hash->bs);
     mem_sys_free(hash);
 }
@@ -909,6 +931,7 @@
 parrot_chash_destroy(PARROT_INTERP, ARGMOD(Hash *hash))
 {
     UINTVAL i;
+    ASSERT_ARGS(parrot_chash_destroy);
 
     for (i = 0; i <= hash->mask; i++) {
         HashBucket *bucket = hash->bi[i];
@@ -942,6 +965,7 @@
     ARGIN(value_free func))
 {
     UINTVAL i;
+    ASSERT_ARGS(parrot_chash_destroy_values);
 
     for (i = 0; i <= hash->mask; i++) {
         HashBucket *bucket = hash->bi[i];
@@ -983,6 +1007,7 @@
         NOTNULL(hash_comp_fn compare),
         NOTNULL(hash_hash_key_fn keyhash))
 {
+    ASSERT_ARGS(parrot_new_hash_x);
     *hptr = create_hash(interp, val_type, hkey_type, compare, keyhash);
 }
 
@@ -1007,6 +1032,7 @@
         NOTNULL(hash_hash_key_fn keyhash))
 {
     Hash * const hash = create_hash(interp, val_type, hkey_type, compare, keyhash);
+    ASSERT_ARGS(parrot_new_pmc_hash_x);
     PMC_struct_val(container) = hash;
     hash->container = container;
 }
@@ -1025,6 +1051,7 @@
 void
 parrot_new_pointer_hash(PARROT_INTERP, ARGOUT(Hash **hptr))
 {
+    ASSERT_ARGS(parrot_new_pointer_hash);
     parrot_new_hash_x(interp, hptr, enum_type_ptr, Hash_key_type_ptr,
             pointer_compare, key_hash_pointer);
 }
@@ -1050,6 +1077,7 @@
         (flags & PObj_constant_FLAG)
             ? constant_pmc_new_noinit(interp, enum_class_Hash)
             : pmc_new_noinit(interp, enum_class_Hash);
+    ASSERT_ARGS(Parrot_new_INTVAL_hash);
 
     parrot_new_pmc_hash_x(interp, h, enum_type_INTVAL, Hash_key_type_int,
             int_compare, key_hash_int);
@@ -1073,6 +1101,7 @@
 INTVAL
 parrot_hash_size(PARROT_INTERP, ARGIN(const Hash *hash))
 {
+    ASSERT_ARGS(parrot_hash_size);
     if (hash)
         return hash->entries;
     Parrot_ex_throw_from_c_args(interp, NULL, 1,
@@ -1105,6 +1134,7 @@
      */
     /* locate initial */
     const INTVAL size = (INTVAL)N_BUCKETS(hash->mask + 1);
+    ASSERT_ARGS(parrot_hash_get_idx);
 
     if (bi == INITBucketIndex) {
         i = 0;
@@ -1149,6 +1179,7 @@
 HashBucket *
 parrot_hash_get_bucket(PARROT_INTERP, ARGIN(const Hash *hash), ARGIN(const void *key))
 {
+    ASSERT_ARGS(parrot_hash_get_bucket);
     if (hash->entries > 0) {
         const UINTVAL hashval = (hash->hash_val)(interp, key, hash->seed);
         HashBucket   *bucket  = hash->bi[hashval & hash->mask];
@@ -1181,6 +1212,7 @@
 parrot_hash_get(PARROT_INTERP, ARGIN(Hash *hash), ARGIN(const void *key))
 {
     const HashBucket * const bucket = parrot_hash_get_bucket(interp, hash, key);
+    ASSERT_ARGS(parrot_hash_get);
     return bucket ? bucket->value : NULL;
 }
 
@@ -1200,6 +1232,7 @@
 parrot_hash_exists(PARROT_INTERP, ARGIN(Hash *hash), ARGIN(void *key))
 {
     const HashBucket * const bucket = parrot_hash_get_bucket(interp, hash, key);
+    ASSERT_ARGS(parrot_hash_exists);
     return bucket ? 1 : 0;
 }
 
@@ -1222,6 +1255,7 @@
 {
     const UINTVAL hashval = (hash->hash_val)(interp, key, hash->seed);
     HashBucket   *bucket  = hash->bi[hashval & hash->mask];
+    ASSERT_ARGS(parrot_hash_put);
 
     while (bucket) {
         /* store hash_val or not */
@@ -1279,6 +1313,7 @@
     HashBucket *prev = NULL;
 
     const UINTVAL hashval = (hash->hash_val)(interp, key, hash->seed) & hash->mask;
+    ASSERT_ARGS(parrot_hash_delete);
 
     for (bucket = hash->bi[hashval]; bucket; bucket = bucket->next) {
         if ((hash->compare)(interp, key, bucket->key) == 0) {
@@ -1315,6 +1350,7 @@
 parrot_hash_clone(PARROT_INTERP, ARGIN(const Hash *hash), ARGOUT(Hash *dest))
 {
     UINTVAL i;
+    ASSERT_ARGS(parrot_hash_clone);
 
     for (i = 0; i <= hash->mask; i++) {
         HashBucket *b = hash->bi[i];

Modified: trunk/src/pmc_freeze.c
==============================================================================
--- trunk/src/pmc_freeze.c	(original)
+++ trunk/src/pmc_freeze.c	Wed Dec 31 11:20:05 2008
@@ -441,6 +441,7 @@
 {
     const size_t used = s->bufused;
     const int need_free = (int)PObj_buflen(s) - used - len;
+    ASSERT_ARGS(str_append);
     /*
      * grow by factor 1.5 or such
      */
@@ -472,6 +473,7 @@
 {
     char buffer[20];
     const size_t len = snprintf(buffer, sizeof (buffer), "%d ", (int) v);
+    ASSERT_ARGS(push_ascii_integer);
     str_append(interp, io->image, buffer, len);
 }
 
@@ -491,6 +493,7 @@
 {
     char buffer[40];
     const size_t len = snprintf(buffer, sizeof (buffer), "%g ", (double) v);
+    ASSERT_ARGS(push_ascii_number);
     str_append(interp, io->image, buffer, len);
 }
 
@@ -516,6 +519,7 @@
     char * const buffer = (char *)malloc(4*length); /* XXX Why 4?  What does that mean? */
     char *cursor = buffer;
     UINTVAL idx = 0;
+    ASSERT_ARGS(push_ascii_string);
 
     /* temporary--write out in UTF-8 */
     for (idx = 0; idx < length; ++idx) {
@@ -544,6 +548,7 @@
 {
     char buffer[20];
     const size_t len = snprintf(buffer, sizeof (buffer), "%p ", (const void *)v);
+    ASSERT_ARGS(push_ascii_pmc);
     str_append(interp, io->image, buffer, len);
 }
 
@@ -563,6 +568,7 @@
     char * const start = (char*)io->image->strstart;
     char *p = start;
     const INTVAL i = strtoul(p, &p, 10);
+    ASSERT_ARGS(shift_ascii_integer);
 
     ++p;
     PARROT_ASSERT(p <= start + io->image->bufused);
@@ -588,6 +594,7 @@
     char * const start = (char*)io->image->strstart;
     char *p = start;
     const FLOATVAL f = (FLOATVAL) strtod(p, &p);
+    ASSERT_ARGS(shift_ascii_number);
 
     ++p;
     PARROT_ASSERT(p <= start + io->image->bufused);
@@ -616,6 +623,7 @@
 
     char * const start = (char*)io->image->strstart;
     char *p = start;
+    ASSERT_ARGS(shift_ascii_string);
 
     while (*p != ' ')
         ++p;
@@ -647,6 +655,7 @@
     char * const start = (char*)io->image->strstart;
     char *p = start;
     const unsigned long i = strtoul(p, &p, 16);
+    ASSERT_ARGS(shift_ascii_pmc);
     ++p;
     PARROT_ASSERT(p <= start + io->image->bufused);
     io->image->strstart = p;
@@ -678,6 +687,7 @@
 {
     const size_t used = s->bufused;
     const int need_free = (int)PObj_buflen(s) - used - len;
+    ASSERT_ARGS(op_check_size);
     /*
      * grow by factor 1.5 or such
      */
@@ -706,6 +716,7 @@
 static void
 op_append(PARROT_INTERP, ARGIN(STRING *s), opcode_t b, size_t len)
 {
+    ASSERT_ARGS(op_append);
     op_check_size(interp, s, len);
     *((opcode_t *)((ptrcast_t)s->strstart + s->bufused)) = b;
     s->bufused += len;
@@ -727,6 +738,7 @@
 static void
 push_opcode_integer(PARROT_INTERP, ARGIN(IMAGE_IO *io), INTVAL v)
 {
+    ASSERT_ARGS(push_opcode_integer);
     PARROT_ASSERT(sizeof (opcode_t) == sizeof (INTVAL));
     op_append(interp, io->image, (opcode_t)v, sizeof (opcode_t));
 }
@@ -748,6 +760,7 @@
     STRING * const s    = io->image;
     const size_t   used = s->bufused;
     opcode_t      *ignored;
+    ASSERT_ARGS(push_opcode_number);
 
     op_check_size(interp, s, len);
     ignored = PF_store_number((opcode_t *)((ptrcast_t)s->strstart + used), &v);
@@ -774,6 +787,7 @@
     STRING * const s = io->image;
     const size_t used = s->bufused;
     opcode_t      *ignored;
+    ASSERT_ARGS(push_opcode_string);
 
     op_check_size(interp, s, len);
     ignored = PF_store_string((opcode_t *)((ptrcast_t)s->strstart + used), v);
@@ -796,6 +810,7 @@
 static void
 push_opcode_pmc(PARROT_INTERP, ARGIN(IMAGE_IO *io), ARGIN(PMC* v))
 {
+    ASSERT_ARGS(push_opcode_pmc);
     op_append(interp, io->image, (opcode_t)v, sizeof (opcode_t));
 }
 
@@ -819,6 +834,7 @@
     char               **opcode = &io->image->strstart;
     const INTVAL i              = PF_fetch_integer(io->pf,
                                     (const opcode_t **)opcode);
+    ASSERT_ARGS(shift_opcode_integer);
 
     io->image->bufused -= ((char *)io->image->strstart - start);
     PARROT_ASSERT((int)io->image->bufused >= 0);
@@ -844,6 +860,7 @@
 shift_opcode_pmc(PARROT_INTERP, ARGIN(IMAGE_IO *io))
 {
     INTVAL i = shift_opcode_integer(interp, io);
+    ASSERT_ARGS(shift_opcode_pmc);
     return (PMC *)i;
 }
 
@@ -864,6 +881,7 @@
     char               **opcode = &io->image->strstart;
     const FLOATVAL       f      = PF_fetch_number(io->pf,
                                     (const opcode_t **)opcode);
+    ASSERT_ARGS(shift_opcode_number);
 
     io->image->bufused -= ((char *)io->image->strstart - start);
     PARROT_ASSERT((int)io->image->bufused >= 0);
@@ -890,6 +908,7 @@
     char         **opcode = &io->image->strstart;
     STRING * const s      = PF_fetch_string(interp, io->pf,
                                 (const opcode_t **)opcode);
+    ASSERT_ARGS(shift_opcode_string);
 
     io->image->bufused -= ((char *)io->image->strstart - start);
     PARROT_ASSERT((int)io->image->bufused >= 0);
@@ -916,6 +935,7 @@
 static void
 pmc_add_ext(PARROT_INTERP, ARGIN(PMC *pmc))
 {
+    ASSERT_ARGS(pmc_add_ext);
     if (pmc->vtable->flags & VTABLE_PMC_NEEDS_EXT)
         add_pmc_ext(interp, pmc);
 }
@@ -934,6 +954,7 @@
 cleanup_next_for_GC_pool(ARGIN(Small_Object_Pool *pool))
 {
     Small_Object_Arena *arena;
+    ASSERT_ARGS(cleanup_next_for_GC_pool);
 
     for (arena = pool->last_Arena; arena; arena = arena->prev) {
         PMC *p = (PMC *)arena->start_objects;
@@ -962,6 +983,7 @@
 static void
 cleanup_next_for_GC(PARROT_INTERP)
 {
+    ASSERT_ARGS(cleanup_next_for_GC);
     cleanup_next_for_GC_pool(interp->arena_base->pmc_pool);
     cleanup_next_for_GC_pool(interp->arena_base->constant_pmc_pool);
 }
@@ -1017,6 +1039,7 @@
     const unsigned int header_length = PACKFILE_HEADER_BYTES +
         (PACKFILE_HEADER_BYTES % 16 ?
          16 - PACKFILE_HEADER_BYTES % 16 : 0);
+    ASSERT_ARGS(ft_init);
 
     info->image_io = mem_allocate_typed(IMAGE_IO);
     info->image_io->image = s = info->image;
@@ -1066,6 +1089,7 @@
 static void
 todo_list_init(PARROT_INTERP, ARGOUT(visit_info *info))
 {
+    ASSERT_ARGS(todo_list_init);
     info->visit_pmc_now = visit_todo_list;
     info->visit_pmc_later = add_pmc_todo_list;
     /* we must use PMCs here, so that they get marked properly */
@@ -1094,6 +1118,7 @@
 {
     IMAGE_IO * const io = info->image_io;
     INTVAL type;
+    ASSERT_ARGS(freeze_pmc);
 
     if (PMC_IS_NULL(pmc)) {
         /* NULL + seen bit */
@@ -1153,6 +1178,7 @@
     PMC *n;
     IMAGE_IO * const io = info->image_io;
     int seen = 0;
+    ASSERT_ARGS(thaw_pmc);
 
     info->extra_flags = EXTRA_IS_NULL;
     n = VTABLE_shift_pmc(interp, io);
@@ -1201,6 +1227,7 @@
 do_action(PARROT_INTERP, ARGIN_NULLOK(PMC *pmc), ARGIN(visit_info *info),
         int seen, UINTVAL id)
 {
+    ASSERT_ARGS(do_action);
     switch (info->what) {
         case VISIT_FREEZE_AT_DESTRUCT:
         case VISIT_FREEZE_NORMAL:
@@ -1231,6 +1258,7 @@
         INTVAL type)
 {
     PMC *pmc;
+    ASSERT_ARGS(thaw_create_pmc);
     switch (info->what) {
         case VISIT_THAW_NORMAL:
             pmc = pmc_new_noinit(interp, type);
@@ -1264,6 +1292,7 @@
     INTVAL type;
     PMC ** pos;
     int must_have_seen;
+    ASSERT_ARGS(do_thaw);
     type = 0; /* it's set below, avoid compiler warning. */
     must_have_seen = thaw_pmc(interp, info, &id, &type);
 
@@ -1360,6 +1389,7 @@
     UINTVAL id = 1;     /* first PMC in first arena */
     Small_Object_Arena *arena;
     Small_Object_Pool *pool;
+    ASSERT_ARGS(id_from_pmc);
 
     pmc = (PMC*)PObj_to_ARENA(pmc);
     pool = interp->arena_base->pmc_pool;
@@ -1402,6 +1432,7 @@
 static void
 add_pmc_next_for_GC(SHIM_INTERP, ARGIN(PMC *pmc), ARGOUT(visit_info *info))
 {
+    ASSERT_ARGS(add_pmc_next_for_GC);
     if (pmc->pmc_ext) {
         PMC_next_for_GC(info->mark_ptr) = pmc;
         info->mark_ptr = PMC_next_for_GC(pmc) = pmc;
@@ -1427,6 +1458,7 @@
         ARGIN(visit_info *info), ARGOUT(UINTVAL *id))
 {
     int seen = 0;
+    ASSERT_ARGS(next_for_GC_seen);
 
     if (PMC_IS_NULL(pmc)) {
         *id = 0;
@@ -1466,6 +1498,7 @@
 static void
 add_pmc_todo_list(PARROT_INTERP, ARGIN_NULLOK(PMC *pmc), ARGIN(visit_info *info))
 {
+    ASSERT_ARGS(add_pmc_todo_list);
     list_push(interp, (List *)PMC_data(info->todo), pmc, enum_type_PMC);
 }
 
@@ -1488,6 +1521,7 @@
 {
     HashBucket * const b =
         parrot_hash_get_bucket(interp, (Hash *)PMC_struct_val(info->seen), pmc);
+    ASSERT_ARGS(todo_list_seen);
 
     if (b) {
         *id = (UINTVAL) b->value;
@@ -1521,6 +1555,7 @@
 {
     UINTVAL id;
     const int seen = next_for_GC_seen(interp, pmc, info, &id);
+    ASSERT_ARGS(visit_next_for_GC);
     UNUSED(seen);
 
     Parrot_ex_throw_from_c_args(interp, NULL, 1, "todo convert to depth first");
@@ -1552,6 +1587,7 @@
 {
     UINTVAL id;
     int seen;
+    ASSERT_ARGS(visit_todo_list);
 
     if (PMC_IS_NULL(pmc)) {
         seen = 1;
@@ -1579,6 +1615,7 @@
 static void
 visit_todo_list_thaw(PARROT_INTERP, ARGIN_NULLOK(PMC* old), ARGIN(visit_info* info))
 {
+    ASSERT_ARGS(visit_todo_list_thaw);
     do_thaw(interp, old, info);
 }
 
@@ -1597,6 +1634,7 @@
 visit_loop_next_for_GC(PARROT_INTERP, ARGIN(PMC *current),
         ARGIN(visit_info *info))
 {
+    ASSERT_ARGS(visit_loop_next_for_GC);
     visit_next_for_GC(interp, current, info);
     if (current->pmc_ext) {
         PMC *prev = NULL;
@@ -1631,6 +1669,7 @@
     const int    thawing        = info->what == VISIT_THAW_CONSTANTS
                                || info->what == VISIT_THAW_NORMAL;
     int          i;
+    ASSERT_ARGS(visit_loop_todo_list);
 
     /* create a list that contains PMCs that need thawfinish */
     if (thawing) {
@@ -1702,6 +1741,7 @@
     STRING *array = CONST_STRING(interp, "array");
     STRING *hash  = CONST_STRING(interp, "hash");
     INTVAL  len;
+    ASSERT_ARGS(create_image);
 
     if (!PMC_IS_NULL(pmc) && (VTABLE_does(interp, pmc, array) ||
         VTABLE_does(interp, pmc, hash))) {
@@ -1743,6 +1783,7 @@
     visit_info info;
     int dod_block = 0;
     const UINTVAL bufused = image->bufused;
+    ASSERT_ARGS(run_thaw);
 
     info.image = image;
     /*
@@ -1816,6 +1857,7 @@
 Parrot_freeze_at_destruct(PARROT_INTERP, ARGIN(PMC* pmc))
 {
     visit_info info;
+    ASSERT_ARGS(Parrot_freeze_at_destruct);
 
     Parrot_block_GC_mark(interp);
     cleanup_next_for_GC(interp);
@@ -1852,6 +1894,7 @@
 Parrot_freeze(PARROT_INTERP, ARGIN(PMC* pmc))
 {
 #if FREEZE_USE_NEXT_FOR_GC
+    ASSERT_ARGS(Parrot_freeze);
     /*
      * we could do a DOD run here before, to free resources
      */
@@ -1863,6 +1906,7 @@
      * can call mark on the PMCs
      */
     visit_info info;
+    ASSERT_ARGS(Parrot_freeze);
 
     info.what = VISIT_FREEZE_NORMAL;
     create_image(interp, pmc, &info);
@@ -1892,6 +1936,7 @@
 PMC*
 Parrot_thaw(PARROT_INTERP, ARGIN(STRING* image))
 {
+    ASSERT_ARGS(Parrot_thaw);
     return run_thaw(interp, image, VISIT_THAW_NORMAL);
 }
 
@@ -1912,6 +1957,7 @@
 PMC*
 Parrot_thaw_constants(PARROT_INTERP, ARGIN(STRING* image))
 {
+    ASSERT_ARGS(Parrot_thaw_constants);
     return run_thaw(interp, image, VISIT_THAW_CONSTANTS);
 }
 
@@ -1933,6 +1979,7 @@
 PMC*
 Parrot_clone(PARROT_INTERP, ARGIN(PMC* pmc))
 {
+    ASSERT_ARGS(Parrot_clone);
     return VTABLE_clone(interp, pmc);
 }
 

Modified: trunk/src/runops_cores.c
==============================================================================
--- trunk/src/runops_cores.c	(original)
+++ trunk/src/runops_cores.c	Wed Dec 31 11:20:05 2008
@@ -60,6 +60,7 @@
 opcode_t *
 runops_fast_core(PARROT_INTERP, ARGIN(opcode_t *pc))
 {
+    ASSERT_ARGS(runops_fast_core);
     while (pc) {
         DO_OP(pc, interp);
     }
@@ -87,6 +88,7 @@
 opcode_t *
 runops_cgoto_core(PARROT_INTERP, ARGIN(opcode_t *pc))
 {
+    ASSERT_ARGS(runops_cgoto_core);
 #ifdef HAVE_COMPUTED_GOTO
     pc = cg_core(pc, interp);
     return pc;
@@ -128,6 +130,7 @@
     static size_t dod, gc;
     Arenas * const arena_base = interp->arena_base;
     Interp *debugger;
+    ASSERT_ARGS(runops_trace_core);
 
     dod = arena_base->dod_runs;
     gc = arena_base->collect_runs;
@@ -205,6 +208,7 @@
 opcode_t *
 runops_slow_core(PARROT_INTERP, ARGIN(opcode_t *pc))
 {
+    ASSERT_ARGS(runops_slow_core);
 
     if (Interp_trace_TEST(interp, PARROT_TRACE_OPS_FLAG))
         return runops_trace_core(interp, pc);
@@ -244,6 +248,7 @@
 opcode_t *
 runops_gc_debug_core(PARROT_INTERP, ARGIN(opcode_t *pc))
 {
+    ASSERT_ARGS(runops_gc_debug_core);
     while (pc) {
         if (pc < code_start || pc >= code_end)
             Parrot_ex_throw_from_c_args(interp, NULL, 1,
@@ -280,6 +285,7 @@
 {
     RunProfile * const profile = interp->profile;
     const opcode_t     old_op  = profile->cur_op;
+    ASSERT_ARGS(runops_profile_core);
 
     /* if reentering the runloop, remember old op and calc time 'til now */
     if (old_op)
@@ -325,6 +331,7 @@
 opcode_t *
 runops_debugger_core(PARROT_INTERP, ARGIN(opcode_t *pc))
 {
+    ASSERT_ARGS(runops_debugger_core);
     /*fprintf(stderr, "Enter runops_debugger_core\n");*/
 
     PARROT_ASSERT(interp->pdb);

Modified: trunk/src/scheduler.c
==============================================================================
--- trunk/src/scheduler.c	(original)
+++ trunk/src/scheduler.c	Wed Dec 31 11:20:05 2008
@@ -70,6 +70,7 @@
 void
 Parrot_cx_init_scheduler(PARROT_INTERP)
 {
+    ASSERT_ARGS(Parrot_cx_init_scheduler);
     if (!interp->parent_interpreter) {
         PMC *scheduler;
 
@@ -96,6 +97,7 @@
 void
 Parrot_cx_check_tasks(PARROT_INTERP, ARGMOD(PMC *scheduler))
 {
+    ASSERT_ARGS(Parrot_cx_check_tasks);
     if (SCHEDULER_wake_requested_TEST(scheduler))
         Parrot_cx_handle_tasks(interp, interp->scheduler);
 }
@@ -116,6 +118,7 @@
 void
 Parrot_cx_handle_tasks(PARROT_INTERP, ARGMOD(PMC *scheduler))
 {
+    ASSERT_ARGS(Parrot_cx_handle_tasks);
     SCHEDULER_wake_requested_CLEAR(scheduler);
     Parrot_cx_refresh_task_list(interp, scheduler);
 
@@ -170,6 +173,7 @@
 void
 Parrot_cx_refresh_task_list(PARROT_INTERP, ARGMOD(PMC *scheduler))
 {
+    ASSERT_ARGS(Parrot_cx_refresh_task_list);
     scheduler_process_wait_list(interp, scheduler);
     scheduler_process_messages(interp, scheduler);
 
@@ -193,6 +197,7 @@
 void
 Parrot_cx_runloop_wake(PARROT_INTERP, ARGMOD(PMC *scheduler))
 {
+    ASSERT_ARGS(Parrot_cx_runloop_wake);
     enable_event_checking(interp);
     SCHEDULER_wake_requested_SET(scheduler);
 }
@@ -212,8 +217,9 @@
 void
 Parrot_cx_runloop_end(PARROT_INTERP)
 {
-      SCHEDULER_terminate_requested_SET(interp->scheduler);
-      Parrot_cx_handle_tasks(interp, interp->scheduler);
+    ASSERT_ARGS(Parrot_cx_runloop_end);
+    SCHEDULER_terminate_requested_SET(interp->scheduler);
+    Parrot_cx_handle_tasks(interp, interp->scheduler);
 }
 
 /*
@@ -231,6 +237,7 @@
 void
 Parrot_cx_schedule_task(PARROT_INTERP, ARGIN(PMC *task))
 {
+    ASSERT_ARGS(Parrot_cx_schedule_task);
     if (!interp->scheduler)
         Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION,
             "Scheduler was not initialized for this interpreter.\n");
@@ -254,6 +261,7 @@
 PMC *
 Parrot_cx_peek_task(PARROT_INTERP)
 {
+    ASSERT_ARGS(Parrot_cx_peek_task);
     if (!interp->scheduler)
         Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION,
             "Scheduler was not initialized for this interpreter.\n");
@@ -279,6 +287,7 @@
         INTVAL repeat, ARGIN_NULLOK(PMC *sub))
 {
     PMC * const timer = pmc_new(interp, enum_class_Timer);
+    ASSERT_ARGS(Parrot_cx_schedule_timer);
 
     VTABLE_set_number_keyed_int(interp, timer, PARROT_TIMER_NSEC, duration);
     VTABLE_set_number_keyed_int(interp, timer, PARROT_TIMER_INTERVAL, interval);
@@ -314,6 +323,7 @@
             PARROT_TIMER_REPEAT);
     FLOATVAL duration = VTABLE_get_number_keyed_int(interp, task,
             PARROT_TIMER_INTERVAL);
+    ASSERT_ARGS(Parrot_cx_schedule_repeat);
     if (repeat != 0) {
         PMC *repeat_task = VTABLE_clone(interp, task);
         VTABLE_set_number_keyed_int(interp, repeat_task, PARROT_TIMER_NSEC, duration);
@@ -343,6 +353,7 @@
 {
     PMC *callback = pmc_new(interp, enum_class_Task);
     Parrot_Task_attributes * const task_struct = PARROT_TASK(callback);
+    ASSERT_ARGS(Parrot_cx_schedule_callback);
 
     task_struct->type    = CONST_STRING(interp, "callback");
     task_struct->data    = user_data;
@@ -365,6 +376,7 @@
 void
 Parrot_cx_request_suspend_for_gc(PARROT_INTERP)
 {
+    ASSERT_ARGS(Parrot_cx_request_suspend_for_gc);
 #if CX_DEBUG
     fprintf(stderr, "requesting gc suspend [interp=%p]\n", interp);
 #endif
@@ -385,6 +397,7 @@
 void
 Parrot_cx_delete_task(PARROT_INTERP, ARGIN(PMC *task))
 {
+    ASSERT_ARGS(Parrot_cx_delete_task);
     if (interp->scheduler) {
         const INTVAL tid = VTABLE_get_integer(interp, task);
         VTABLE_delete_keyed_int(interp, interp->scheduler, tid);
@@ -411,6 +424,7 @@
 PMC *
 Parrot_cx_delete_suspend_for_gc(PARROT_INTERP)
 {
+    ASSERT_ARGS(Parrot_cx_delete_suspend_for_gc);
     if (interp->scheduler) {
         STRING *suspend_str = CONST_STRING(interp, "suspend_for_gc");
         Parrot_Scheduler_attributes * sched_struct = PARROT_SCHEDULER(interp->scheduler);
@@ -463,6 +477,7 @@
 void
 Parrot_cx_add_handler_local(PARROT_INTERP, ARGIN(PMC *handler))
 {
+    ASSERT_ARGS(Parrot_cx_add_handler_local);
     if (PMC_IS_NULL(CONTEXT(interp)->handlers))
         CONTEXT(interp)->handlers = pmc_new(interp, enum_class_ResizablePMCArray);
 
@@ -486,6 +501,7 @@
 Parrot_cx_delete_handler_local(PARROT_INTERP, ARGIN(STRING *handler_type))
 {
     PMC *handlers  = CONTEXT(interp)->handlers;
+    ASSERT_ARGS(Parrot_cx_delete_handler_local);
 
     if (PMC_IS_NULL(handlers))
         Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION,
@@ -554,6 +570,7 @@
 Parrot_cx_add_handler(PARROT_INTERP, ARGIN(PMC *handler))
 {
     STRING *add_handler = CONST_STRING(interp, "add_handler");
+    ASSERT_ARGS(Parrot_cx_add_handler);
     if (!interp->scheduler)
         Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION,
             "Scheduler was not initialized for this interpreter.\n");
@@ -576,6 +593,7 @@
 void
 Parrot_cx_delete_handler_typed(PARROT_INTERP, ARGIN(STRING *handler_type))
 {
+    ASSERT_ARGS(Parrot_cx_delete_handler_typed);
     if (!interp->scheduler)
         Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION,
             "Scheduler was not initialized for this interpreter.\n");
@@ -599,6 +617,7 @@
 Parrot_cx_count_handlers_typed(PARROT_INTERP, ARGIN(STRING *handler_type))
 {
     INTVAL count = 0;
+    ASSERT_ARGS(Parrot_cx_count_handlers_typed);
 
     if (!interp->scheduler)
         Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION,
@@ -632,6 +651,7 @@
 void
 Parrot_cx_send_message(PARROT_INTERP, ARGIN(STRING *messagetype), ARGIN_NULLOK(PMC *payload))
 {
+    ASSERT_ARGS(Parrot_cx_send_message);
     if (interp->scheduler) {
         Parrot_Scheduler_attributes * sched_struct = PARROT_SCHEDULER(interp->scheduler);
         PMC *message = pmc_new(interp, enum_class_SchedulerMessage);
@@ -673,6 +693,7 @@
 Parrot_cx_broadcast_message(PARROT_INTERP, ARGIN(STRING *messagetype), ARGIN_NULLOK(PMC *data))
 {
     UINTVAL i;
+    ASSERT_ARGS(Parrot_cx_broadcast_message);
     LOCK(interpreter_array_mutex);
     for (i = 0; i < n_interpreters; ++i) {
         Parrot_Interp other_interp = interpreter_array[i];
@@ -709,6 +730,7 @@
 Parrot_cx_find_handler_for_task(PARROT_INTERP, ARGIN(PMC *task))
 {
     PMC *handler = PMCNULL;
+    ASSERT_ARGS(Parrot_cx_find_handler_for_task);
 #if CX_DEBUG
     fprintf(stderr, "searching for handler\n");
 #endif
@@ -746,6 +768,7 @@
     PMC            *iter        = PMCNULL;
     STRING * const  handled_str = CONST_STRING(interp, "handled");
     STRING * const  iter_str    = CONST_STRING(interp, "handler_iter");
+    ASSERT_ARGS(Parrot_cx_find_handler_local);
 
     /* Exceptions store the handler iterator for rethrow, other kinds of
      * tasks don't (though they could). */
@@ -808,6 +831,7 @@
 Parrot_cx_timer_invoke(PARROT_INTERP, ARGIN(PMC *timer))
 {
     Parrot_Timer_attributes * const timer_struct = PARROT_TIMER(timer);
+    ASSERT_ARGS(Parrot_cx_timer_invoke);
 #if CX_DEBUG
     fprintf(stderr, "current timer time: %f, %f\n",
                     timer_struct->birthtime + timer_struct->duration,
@@ -833,6 +857,7 @@
 Parrot_cx_invoke_callback(PARROT_INTERP, ARGIN(PMC *callback))
 {
     Parrot_Task_attributes * const task_struct = PARROT_TASK(callback);
+    ASSERT_ARGS(Parrot_cx_invoke_callback);
     if (!PMC_IS_NULL(task_struct->data)) {
         Parrot_run_callback(interp, task_struct->data,
                 task_struct->cb_data);
@@ -871,6 +896,7 @@
     Parrot_mutex lock;
     FLOATVAL timer_end = time + Parrot_floatval_time();
     struct timespec time_struct;
+    ASSERT_ARGS(Parrot_cx_schedule_sleep);
 
     /* Tell the scheduler runloop to wake, this is a good time to process
      * pending tasks. */
@@ -887,6 +913,7 @@
     COND_DESTROY(condition);
     MUTEX_DESTROY(lock);
 #else
+    ASSERT_ARGS(parrot_cx_schedule_sleep);
     /* A more primitive, platform-specific, non-threaded form of sleep. */
     if (time > 1000) {
         /* prevent integer overflow when converting to microseconds */
@@ -924,6 +951,7 @@
 {
     Parrot_Scheduler_attributes * sched_struct = PARROT_SCHEDULER(scheduler);
     INTVAL num_tasks, index;
+    ASSERT_ARGS(scheduler_process_wait_list);
 
     /* Sweep the wait list for completed timers */
     num_tasks = VTABLE_elements(interp, sched_struct->wait_index);
@@ -971,6 +999,7 @@
 
     PMC    *message;
     STRING *suspend_str = CONST_STRING(interp, "suspend_for_gc");
+    ASSERT_ARGS(scheduler_process_messages);
 
 #if CX_DEBUG
     fprintf(stderr, "processing messages [interp=%p]\n", interp);

Modified: trunk/src/stacks.c
==============================================================================
--- trunk/src/stacks.c	(original)
+++ trunk/src/stacks.c	Wed Dec 31 11:20:05 2008
@@ -52,6 +52,7 @@
 void
 stack_system_init(SHIM_INTERP)
 {
+    ASSERT_ARGS(stack_system_init);
 }
 
 /*
@@ -72,6 +73,7 @@
 {
     Small_Object_Pool * const pool = chunk->pool;
     Stack_Chunk_t * const new_chunk = (Stack_Chunk_t *)pool->get_free_object(interp, pool);
+    ASSERT_ARGS(cst_new_stack_chunk);
 
     PObj_bufstart(new_chunk) = NULL;
     PObj_buflen(new_chunk)   = 0;
@@ -101,6 +103,7 @@
 {
     Small_Object_Pool * const pool = make_bufferlike_pool(interp, sizeof (Stack_Chunk_t));
     Stack_Chunk_t     * const chunk = (Stack_Chunk_t *)(pool->get_free_object)(interp, pool);
+    ASSERT_ARGS(new_stack);
 
     chunk->prev = chunk;        /* mark the top of the stack */
     chunk->name = name;
@@ -124,6 +127,7 @@
 void
 mark_stack(PARROT_INTERP, ARGMOD(Stack_Chunk_t *chunk))
 {
+    ASSERT_ARGS(mark_stack);
     for (; ; chunk = chunk->prev) {
         Stack_Entry_t  *entry;
 
@@ -153,6 +157,7 @@
 void
 stack_destroy(SHIM(Stack_Chunk_t *top))
 {
+    ASSERT_ARGS(stack_destroy);
     /* GC does it all */
 }
 
@@ -172,6 +177,7 @@
 stack_height(SHIM_INTERP, ARGIN(const Stack_Chunk_t *chunk))
 {
     size_t height = 0;
+    ASSERT_ARGS(stack_height);
 
     for (; ; chunk = chunk->prev) {
         if (chunk == chunk->prev)
@@ -204,6 +210,7 @@
 {
     Stack_Chunk_t *chunk;
     size_t         offset = (size_t)depth;
+    ASSERT_ARGS(stack_entry);
 
     if (depth < 0)
         return NULL;
@@ -242,6 +249,7 @@
 {
     Stack_Chunk_t * const chunk     = *stack_p;
     Stack_Chunk_t * const new_chunk = cst_new_stack_chunk(interp, chunk);
+    ASSERT_ARGS(stack_prepare_push);
 
     new_chunk->prev = chunk;
     *stack_p        = new_chunk;
@@ -270,6 +278,7 @@
            ARGIN(void *thing), Stack_entry_type type, NULLOK(Stack_cleanup_method cleanup))
 {
     Stack_Entry_t * const entry = (Stack_Entry_t *)stack_prepare_push(interp, stack_p);
+    ASSERT_ARGS(stack_push);
 
     /* Remember the type */
     entry->entry_type = type;
@@ -312,6 +321,7 @@
 stack_prepare_pop(PARROT_INTERP, ARGMOD(Stack_Chunk_t **stack_p))
 {
     Stack_Chunk_t * const chunk = *stack_p;
+    ASSERT_ARGS(stack_prepare_pop);
 
     /* the first entry (initial top) refers to itself */
     if (chunk == chunk->prev)
@@ -340,6 +350,7 @@
     Stack_Chunk_t     *cur_chunk   = *stack_p;
     Stack_Entry_t * const entry    =
         (Stack_Entry_t *)stack_prepare_pop(interp, stack_p);
+    ASSERT_ARGS(stack_pop);
 
     /* Types of 0 mean we don't care */
     if (type && entry->entry_type != type)
@@ -400,6 +411,7 @@
     /* We don't mind the extra call, so we do this: (previous comment
      * said we *do* mind, but I say let the compiler decide) */
     void *dest;
+    ASSERT_ARGS(pop_dest);
     (void)stack_pop(interp, &interp->dynamic_env,
                     &dest, STACK_ENTRY_DESTINATION);
     return dest;
@@ -423,6 +435,7 @@
            ARGMOD_NULLOK(Stack_entry_type *type))
 {
     const Stack_Entry_t * const entry = stack_entry(interp, stack_base, 0);
+    ASSERT_ARGS(stack_peek);
     if (entry == NULL)
         return NULL;
 
@@ -450,6 +463,7 @@
 Stack_entry_type
 get_entry_type(ARGIN(const Stack_Entry_t *entry))
 {
+    ASSERT_ARGS(get_entry_type);
     return entry->entry_type;
 }
 
@@ -469,6 +483,7 @@
 Parrot_dump_dynamic_environment(PARROT_INTERP, ARGIN(Stack_Chunk_t *dynamic_env))
 {
     int height = (int) stack_height(interp, dynamic_env);
+    ASSERT_ARGS(Parrot_dump_dynamic_environment);
 
     while (dynamic_env->prev != dynamic_env) {
         const Stack_Entry_t * const e = stack_entry(interp, dynamic_env, 0);
@@ -519,6 +534,7 @@
      * stack - run the action subroutine with an INTVAL arg of 0
      */
     PMC * const sub = UVal_pmc(e->entry);
+    ASSERT_ARGS(run_cleanup_action);
     Parrot_runops_fromc_args(interp, sub, "vI", 0);
 }
 
@@ -536,6 +552,7 @@
 void
 Parrot_push_action(PARROT_INTERP, ARGIN(PMC *sub))
 {
+    ASSERT_ARGS(Parrot_push_action);
     if (!VTABLE_isa(interp, sub, CONST_STRING(interp, "Sub")))
         Parrot_ex_throw_from_c_args(interp, NULL, 1,
             "Tried to push a non Sub PMC action");
@@ -558,6 +575,7 @@
 void
 Parrot_push_mark(PARROT_INTERP, INTVAL mark)
 {
+    ASSERT_ARGS(Parrot_push_mark);
     stack_push(interp, &interp->dynamic_env, &mark,
                STACK_ENTRY_MARK, STACK_CLEANUP_NULL);
 }
@@ -576,6 +594,7 @@
 void
 Parrot_pop_mark(PARROT_INTERP, INTVAL mark)
 {
+    ASSERT_ARGS(Parrot_pop_mark);
     do {
         const Stack_Entry_t * const e
             = stack_entry(interp, interp->dynamic_env, 0);

Modified: trunk/src/stm/backend.c
==============================================================================
--- trunk/src/stm/backend.c	(original)
+++ trunk/src/stm/backend.c	Wed Dec 31 11:20:05 2008
@@ -243,6 +243,7 @@
 Parrot_STM_destroy(PARROT_INTERP)
 {
     STM_tx_log *log;
+    ASSERT_ARGS(Parrot_STM_destroy);
 
     if (!interp->thread_data || !interp->thread_data->stm_log)
         return;
@@ -272,6 +273,7 @@
 {
     Parrot_STM_PMC_handle_data *handle;
     Small_Object_Pool *ignored;
+    ASSERT_ARGS(Parrot_STM_alloc);
     STM_TRACE("Parrot_STM_alloc");
 
     ignored = make_bufferlike_pool(interp, sizeof (Parrot_STM_PMC_handle_data));
@@ -314,6 +316,7 @@
 Parrot_freeze_STM_PMC_handle(PARROT_INTERP, ARGMOD(IMAGE_IO *io),
             ARGIN(Parrot_STM_PMC_handle handle))
 {
+    ASSERT_ARGS(Parrot_freeze_STM_PMC_handle);
     VTABLE_push_pmc(interp, io, (PMC*) handle);
 }
 
@@ -331,6 +334,7 @@
 Parrot_thaw_STM_PMC_handle(PARROT_INTERP, ARGIN(IMAGE_IO *io))
 {
     Parrot_STM_PMC_handle handle = (Parrot_STM_PMC_handle) VTABLE_shift_pmc(interp, io);
+    ASSERT_ARGS(Parrot_thaw_STM_PMC_handle);
     return handle;
 }
 
@@ -350,6 +354,7 @@
 static STM_write_record *
 get_write(SHIM_INTERP, ARGIN(STM_tx_log *log), int i)
 {
+    ASSERT_ARGS(get_write);
     PARROT_ASSERT(i >= 0);
     PARROT_ASSERT(i <= log->last_write);
     return &log->writes[i];
@@ -370,6 +375,7 @@
 static STM_read_record *
 get_read(SHIM_INTERP, ARGIN(STM_tx_log *log), int i)
 {
+    ASSERT_ARGS(get_read);
     PARROT_ASSERT(i >= 0);
     PARROT_ASSERT(i <= log->last_read);
     return &log->reads[i];
@@ -398,6 +404,7 @@
 {
     STM_write_record *write;
     const int         i = ++log->last_write;
+    ASSERT_ARGS(alloc_write);
 
     if (i >= log->writes_alloced) {
         log->writes_alloced *= 2;
@@ -428,6 +435,7 @@
 {
     STM_read_record *read;
     const int i = ++log->last_read;
+    ASSERT_ARGS(alloc_read);
 
     if (i >= log->reads_alloced) {
         log->reads_alloced *= 2;
@@ -457,6 +465,7 @@
 next_version(ARGIN(const void *old_version))
 {
     const UINTVAL v = PTR2UINTVAL(old_version) + 2;
+    ASSERT_ARGS(next_version);
 
     return UINTVAL2PTR(void *, v);
 }
@@ -476,6 +485,7 @@
 is_version(ARGIN(const void *maybe_version))
 {
     const UINTVAL v = PTR2UINTVAL(maybe_version);
+    ASSERT_ARGS(is_version);
     return v & 1;
 }
 
@@ -494,6 +504,7 @@
 static STM_tx_log_sub *
 get_sublog(ARGIN(STM_tx_log *log), int i)
 {
+    ASSERT_ARGS(get_sublog);
     PARROT_ASSERT(i > 0);
     PARROT_ASSERT(i <= log->depth);
     return &log->inner[i - 1];
@@ -516,6 +527,7 @@
 is_aborted(ARGIN(STM_tx_log *log))
 {
     int i;
+    ASSERT_ARGS(is_aborted);
 
     for (i = 1; i <= log->depth; ++i) {
         int status;
@@ -545,6 +557,7 @@
 {
     STM_tx_log     * const log = Parrot_STM_tx_log_get(interp);
     STM_tx_log_sub *       newsub;
+    ASSERT_ARGS(Parrot_STM_start_transaction);
 
     ++log->depth;
     newsub = get_sublog(log, log->depth);
@@ -584,6 +597,7 @@
     int i;
     int status;
     int need_abort = 0;
+    ASSERT_ARGS(merge_transactions);
 
     PARROT_ATOMIC_INT_GET(status, inner->status);
 
@@ -679,6 +693,7 @@
 force_sharing(PARROT_INTERP, ARGIN_NULLOK(PMC *pmc))
 {
     PMC *ret;
+    ASSERT_ARGS(force_sharing);
 
     if (PMC_IS_NULL(pmc))
         return PMCNULL;
@@ -705,6 +720,7 @@
     int i;
     int validp    = 1;
     int cur_depth = 1;
+    ASSERT_ARGS(get_read_valid_depth);
 
     if (log->depth == 0)
         return 0;
@@ -763,6 +779,7 @@
     int i;
     int successp;
     STM_tx_log_sub *inner;
+    ASSERT_ARGS(do_real_commit);
 
     PARROT_ASSERT(log->depth == 1);
 
@@ -836,6 +853,7 @@
 do_partial_abort(PARROT_INTERP, ARGIN(STM_tx_log *log), ARGIN(STM_tx_log_sub *inner))
 {
     int i;
+    ASSERT_ARGS(do_partial_abort);
 
     STM_TRACE_SAFE("partial abort");
     PARROT_ATOMIC_INT_SET(inner->status, STM_STATUS_ABORTED);
@@ -872,6 +890,7 @@
 static void
 do_real_abort(PARROT_INTERP, ARGMOD(STM_tx_log *log), ARGIN(STM_tx_log_sub *inner))
 {
+    ASSERT_ARGS(do_real_abort);
     STM_TRACE_SAFE("really aborting");
     do_partial_abort(interp, log, inner);
 
@@ -900,6 +919,7 @@
     int i;
     int validp    = 1;
     int cur_depth = from;
+    ASSERT_ARGS(replay_writes);
 
     while (validp && cur_depth <= to) {
         int last_write;
@@ -956,6 +976,7 @@
     STM_tx_log     * const log = Parrot_STM_tx_log_get(interp);
     STM_tx_log_sub *cursub;
     int             successp;
+    ASSERT_ARGS(Parrot_STM_commit);
 
     STM_TRACE("commit");
 
@@ -1005,6 +1026,7 @@
 {
     STM_tx_log     * const log = Parrot_STM_tx_log_get(interp);
     STM_tx_log_sub *cursub;
+    ASSERT_ARGS(Parrot_STM_abort);
 
     STM_TRACE_SAFE("abort");
 
@@ -1037,6 +1059,7 @@
 {
     int need_wait = 1;
     int i;
+    ASSERT_ARGS(setup_wait);
 
     for (i = 0; need_wait && i <= log->last_read; ++i) {
         void *version;
@@ -1106,6 +1129,7 @@
 {
     STM_tx_log *log;
     int         need_wait;
+    ASSERT_ARGS(Parrot_STM_wait);
 
     STM_TRACE("%p: wait", interp);
 
@@ -1157,6 +1181,7 @@
     STM_tx_log_sub *inner;
     int             status;
     STM_tx_log     * const log = Parrot_STM_tx_log_get(interp);
+    ASSERT_ARGS(Parrot_STM_validate);
 
     if (log->depth == 0)
         return 1;
@@ -1184,6 +1209,7 @@
 static void
 mark_write_record(PARROT_INTERP, ARGMOD(STM_write_record *write))
 {
+    ASSERT_ARGS(mark_write_record);
     if (!PMC_IS_NULL(write->value))
         pobject_lives(interp, (PObj *) write->value);
 
@@ -1203,6 +1229,7 @@
 static void
 mark_read_record(PARROT_INTERP, ARGMOD(STM_read_record *read))
 {
+    ASSERT_ARGS(mark_read_record);
     if (!PMC_IS_NULL(read->value))
         pobject_lives(interp, (PObj *) read->value);
 
@@ -1225,6 +1252,7 @@
 {
     int         i;
     STM_tx_log *log;
+    ASSERT_ARGS(Parrot_STM_mark_transaction);
 
     STM_TRACE("mark txlog");
 
@@ -1252,6 +1280,7 @@
 Parrot_STM_mark_pmc_handle(PARROT_INTERP, Parrot_STM_PMC_handle handle)
 {
     PMC *value;
+    ASSERT_ARGS(Parrot_STM_mark_pmc_handle);
 
     if (!handle)
         return;
@@ -1283,6 +1312,7 @@
 Parrot_STM_transaction_depth(PARROT_INTERP)
 {
     const STM_tx_log * const log = Parrot_STM_tx_log_get(interp);
+    ASSERT_ARGS(Parrot_STM_transaction_depth);
 
     return log->depth;
 }
@@ -1311,6 +1341,7 @@
     Parrot_atomic_pointer *in_what    = &handle->owner_or_version;
     UINTVAL                wait_count = 0;
     FLOATVAL               start_wait = 0.0;
+    ASSERT_ARGS(wait_for_version);
 
     STM_TRACE("%p: wait for version");
     for (;;) {
@@ -1435,6 +1466,7 @@
     void              *check_version;
     int                i;
     STM_tx_log * const log = Parrot_STM_tx_log_get(interp);
+    ASSERT_ARGS(Parrot_STM_read);
 
     if (log->depth == 0) {
         /* special case outside of transaction */
@@ -1514,6 +1546,7 @@
 static int
 safe_to_clone(SHIM_INTERP, ARGIN(const PMC *original))
 {
+    ASSERT_ARGS(safe_to_clone);
     if (original->vtable->base_type == enum_class_Integer
         ||  original->vtable->base_type == enum_class_Float
         ||  original->vtable->base_type == enum_class_BigInt
@@ -1540,6 +1573,7 @@
 static PMC *
 local_pmc_copy(PARROT_INTERP, ARGIN_NULLOK(PMC *original))
 {
+    ASSERT_ARGS(local_pmc_copy);
     if (PMC_IS_NULL(original))
         return PMCNULL;
 
@@ -1580,6 +1614,7 @@
     STM_write_record *write          = NULL;
     int               i;
     STM_tx_log       *log;
+    ASSERT_ARGS(find_write_record);
 
     STM_TRACE("finding write record for %p", handle);
 
@@ -1724,6 +1759,7 @@
 {
     STM_write_record   *write;
     const STM_tx_log * const log = Parrot_STM_tx_log_get(interp);
+    ASSERT_ARGS(Parrot_STM_begin_update);
 
     if (log->depth == 0)
         Parrot_ex_throw_from_c_args(interp, NULL, 1,
@@ -1750,6 +1786,7 @@
     /* XXX no transaction case */
     STM_write_record   *write;
     const STM_tx_log * const log = Parrot_STM_tx_log_get(interp);
+    ASSERT_ARGS(Parrot_STM_write);
 
     /* error for now */
     if (log->depth == 0)
@@ -1779,6 +1816,7 @@
     STM_saved_tx_log  *saved;
     STM_tx_log_sub    *cursub;
     STM_tx_log * const log = Parrot_STM_tx_log_get(interp);
+    ASSERT_ARGS(Parrot_STM_extract);
 
     if (log->depth == 0)
         return NULL;
@@ -1817,6 +1855,7 @@
 void
 Parrot_STM_replay_extracted(PARROT_INTERP, ARGMOD_NULLOK(void *saved_log_data))
 {
+    ASSERT_ARGS(Parrot_STM_replay_extracted);
     if (saved_log_data) {
         STM_saved_tx_log * const saved = (STM_saved_tx_log *)saved_log_data;
         STM_tx_log * const       log   = Parrot_STM_tx_log_get(interp);
@@ -1861,6 +1900,7 @@
 void
 Parrot_STM_mark_extracted(PARROT_INTERP, ARGMOD_NULLOK(void *saved_log_data))
 {
+    ASSERT_ARGS(Parrot_STM_mark_extracted);
     if (saved_log_data) {
         STM_saved_tx_log * const saved = (STM_saved_tx_log *)saved_log_data;
         int i;
@@ -1886,6 +1926,7 @@
 void
 Parrot_STM_destroy_extracted(SHIM_INTERP, ARGMOD_NULLOK(void *saved_log_data))
 {
+    ASSERT_ARGS(Parrot_STM_destroy_extracted);
     if (saved_log_data) {
         STM_saved_tx_log * const saved = (STM_saved_tx_log *)saved_log_data;
 
@@ -1914,6 +1955,7 @@
     STM_tx_log       *log;
     STM_profile_data *profile;
     INTVAL            i;
+    ASSERT_ARGS(parrot_stm_dump_profile);
 
     Parrot_block_GC_mark(interp);
 
@@ -1968,6 +2010,7 @@
 
     const STM_profile_date * const from = &PROFILE(Parrot_STM_tx_log_get(s));
     STM_profile_date * const to   = &PROFILE(Parrot_STM_tx_log_get(d));
+    ASSERT_ARGS(parrot_stm_merge_profile);
 
     to->attempted_commits += from->attempted_commits;
     to->failed_commits    += from->failed_commits;

Modified: trunk/src/stm/waitlist.c
==============================================================================
--- trunk/src/stm/waitlist.c	(original)
+++ trunk/src/stm/waitlist.c	Wed Dec 31 11:20:05 2008
@@ -115,6 +115,7 @@
 get_thread(PARROT_INTERP)
 {
     STM_tx_log * const txlog = Parrot_STM_tx_log_get(interp);
+    ASSERT_ARGS(get_thread);
 
     if (!txlog->waitlist_data) {
         txlog->waitlist_data =
@@ -144,6 +145,7 @@
 get_thread_noalloc(PARROT_INTERP)
 {
     const STM_tx_log * const txlog = Parrot_STM_tx_log_get(interp);
+    ASSERT_ARGS(get_thread_noalloc);
     return txlog->waitlist_data;
 }
 
@@ -165,6 +167,7 @@
     size_t i;
 
     struct waitlist_thread_data * const thr = get_thread(interp);
+    ASSERT_ARGS(alloc_entry);
 
     if (!thr->entries) {
         thr->entries = (waitlist_entry**)mem_sys_allocate_zeroed(sizeof (*thr->entries) * 4);
@@ -205,6 +208,7 @@
 {
     int successp = -1;
     void *result;
+    ASSERT_ARGS(add_entry);
     PARROT_ASSERT(entry->next == NULL);
     do {
         PARROT_ATOMIC_PTR_GET(result, waitlist->first);
@@ -233,6 +237,7 @@
 remove_first(ARGMOD(STM_waitlist *waitlist), ARGIN(struct waitlist_entry *expect_first))
 {
     int successp;
+    ASSERT_ARGS(remove_first);
     PARROT_ATOMIC_PTR_CAS(successp, waitlist->first, expect_first,
                         expect_first->next);
 #if WAITLIST_DEBUG
@@ -259,6 +264,7 @@
 {
     struct waitlist_entry *cur;
     void *result;
+    ASSERT_ARGS(waitlist_remove);
 
     if (!waitlist)
         return;
@@ -316,6 +322,7 @@
 waitlist_remove_check(ARGMOD_NULLOK(STM_waitlist *waitlist), ARGIN(struct waitlist_entry *what))
 {
     struct waitlist_entry *cur;
+    ASSERT_ARGS(waitlist_remove_check);
 
     if (!waitlist)
         return;
@@ -344,6 +351,7 @@
 waitlist_signal_one(ARGMOD(struct waitlist_entry *who))
 {
     struct waitlist_thread_data *thread;
+    ASSERT_ARGS(waitlist_signal_one);
 
     thread = who->thread;
     LOCK(thread->signal_mutex);
@@ -374,6 +382,7 @@
     int successp;
     struct waitlist_entry *cur;
     void *result;
+    ASSERT_ARGS(waitlist_signal_all);
 
     /* make sure we are not interrupted by a concurrent removal */
     LOCK(list->remove_mutex);
@@ -418,6 +427,7 @@
 Parrot_STM_waitlist_add_self(PARROT_INTERP, ARGMOD(STM_waitlist *waitlist))
 {
     struct waitlist_entry * const entry = alloc_entry(interp);
+    ASSERT_ARGS(Parrot_STM_waitlist_add_self);
 
     entry->head = waitlist;
 
@@ -440,6 +450,7 @@
 void
 Parrot_STM_waitlist_signal(PARROT_INTERP, ARGMOD(STM_waitlist *waitlist))
 {
+    ASSERT_ARGS(Parrot_STM_waitlist_signal);
 #if WAITLIST_DEBUG
     fprintf(stderr, "%p: signal %p\n", interp, waitlist);
 #endif
@@ -461,6 +472,7 @@
 {
     struct waitlist_thread_data *thr;
     size_t i;
+    ASSERT_ARGS(Parrot_STM_waitlist_remove_all);
 #if WAITLIST_DEBUG
     fprintf(stderr, "%p: remove all\n", interp);
 #endif
@@ -498,6 +510,7 @@
 Parrot_STM_waitlist_wait(PARROT_INTERP)
 {
     struct waitlist_thread_data *thr;
+    ASSERT_ARGS(Parrot_STM_waitlist_wait);
     thr = get_thread(interp);
     LOCK(thr->signal_mutex);
 #if WAITLIST_DEBUG
@@ -528,6 +541,7 @@
 void
 Parrot_STM_waitlist_init(PARROT_INTERP, ARGMOD(STM_waitlist *waitlist))
 {
+    ASSERT_ARGS(Parrot_STM_waitlist_init);
     PARROT_ATOMIC_PTR_INIT(waitlist->first);
     PARROT_ATOMIC_PTR_SET(waitlist->first, NULL);
     MUTEX_INIT(waitlist->remove_mutex);
@@ -548,6 +562,7 @@
 {
     struct waitlist_thread_data *thr;
     size_t i;
+    ASSERT_ARGS(Parrot_STM_waitlist_destroy_thread);
 
     thr = get_thread_noalloc(interp);
     if (!thr)
@@ -580,6 +595,7 @@
 {
     int                i;
     STM_tx_log * const log       = (STM_tx_log *)mem_sys_allocate_zeroed(size);
+    ASSERT_ARGS(Parrot_STM_tx_log_alloc);
     interp->thread_data->stm_log = log;
 
     /* initialize the various fields of the transaction log */
@@ -623,6 +639,7 @@
 Parrot_STM_tx_log_get(PARROT_INTERP)
 {
     STM_tx_log *log = interp->thread_data->stm_log;
+    ASSERT_ARGS(Parrot_STM_tx_log_get);
 
     if (!log)
         log = Parrot_STM_tx_log_alloc(interp, sizeof (*log));

Modified: trunk/src/string.c
==============================================================================
--- trunk/src/string.c	(original)
+++ trunk/src/string.c	Wed Dec 31 11:20:05 2008
@@ -81,7 +81,7 @@
 void
 Parrot_unmake_COW(PARROT_INTERP, ARGMOD(STRING *s))
 {
-    PARROT_ASSERT(s);
+    ASSERT_ARGS(Parrot_unmake_COW);
 
     /* COW_FLAG | constant_FLAG | external_FLAG) */
     if (PObj_is_cowed_TESTALL(s)) {
@@ -136,8 +136,7 @@
 Parrot_make_COW_reference(PARROT_INTERP, ARGMOD(STRING *s))
 {
     STRING *d;
-
-    PARROT_ASSERT(s);
+    ASSERT_ARGS(Parrot_make_COW_reference);
 
     if (PObj_constant_TEST(s)) {
         d = new_string_header(interp, PObj_get_FLAGS(s) & ~PObj_constant_FLAG);
@@ -188,7 +187,7 @@
 STRING *
 Parrot_reuse_COW_reference(SHIM_INTERP, ARGMOD(STRING *s), ARGOUT(STRING *d))
 {
-    PARROT_ASSERT(s);
+    ASSERT_ARGS(Parrot_reuse_COW_reference);
 
     if (PObj_constant_TEST(s)) {
         PObj_COW_SET(s);
@@ -220,6 +219,7 @@
 STRING *
 string_set(PARROT_INTERP, ARGIN_NULLOK(STRING *dest), ARGMOD(STRING *src))
 {
+    ASSERT_ARGS(string_set);
     if (dest == src)
         return dest;
     if (dest) { /* && dest != src */
@@ -252,6 +252,7 @@
 void
 string_free(PARROT_INTERP, ARGIN(STRING *s))
 {
+    ASSERT_ARGS(string_free);
     if (!PObj_constant_TEST(s)) {
         Small_Object_Pool * const pool = interp->arena_base->string_header_pool;
         pool->add_free_object(interp, pool, s);
@@ -284,6 +285,7 @@
     size_t       i;
     const size_t n_parrot_cstrings =
         sizeof (parrot_cstrings) / sizeof (parrot_cstrings[0]);
+    ASSERT_ARGS(string_init);
 
     if (interp->parent_interpreter) {
         interp->hash_seed = interp->parent_interpreter->hash_seed;
@@ -340,6 +342,7 @@
 void
 string_deinit(PARROT_INTERP)
 {
+    ASSERT_ARGS(string_deinit);
     /* all are shared between interpreters */
     if (!interp->parent_interpreter) {
         mem_sys_free(interp->const_cstring_table);
@@ -366,7 +369,7 @@
 UINTVAL
 string_capacity(SHIM_INTERP, ARGIN(const STRING *s))
 {
-    PARROT_ASSERT(s);
+    ASSERT_ARGS(string_capacity);
 
     return ((ptrcast_t)PObj_bufstart(s) + PObj_buflen(s) -
             (ptrcast_t)s->strstart);
@@ -389,6 +392,7 @@
     parrot_string_representation_t representation, UINTVAL capacity)
 {
     STRING * const s = new_string_header(interp, 0);
+    ASSERT_ARGS(string_make_empty);
 
     /* TODO adapt string creation functions */
     if (representation != enum_stringrep_one)
@@ -426,6 +430,7 @@
 string_rep_compatible(SHIM_INTERP,
     ARGIN(const STRING *a), ARGIN(const STRING *b), ARGOUT(const ENCODING **e))
 {
+    ASSERT_ARGS(string_rep_compatible);
     if (a->encoding == b->encoding && a->charset == b->charset) {
         *e = a->encoding;
         return a->charset;
@@ -490,6 +495,7 @@
 string_concat(PARROT_INTERP, ARGIN_NULLOK(STRING *a),
             ARGIN_NULLOK(STRING *b), UINTVAL Uflags)
 {
+    ASSERT_ARGS(string_concat);
     if (a != NULL && a->strlen != 0) {
         if (b != NULL && b->strlen != 0) {
             const ENCODING *enc;
@@ -545,6 +551,7 @@
 
     /* If B isn't real, we just bail */
     const UINTVAL b_len = b ? string_length(interp, b) : 0;
+    ASSERT_ARGS(string_append);
     if (!b_len)
         return a;
 
@@ -614,6 +621,7 @@
 STRING *
 string_from_cstring(PARROT_INTERP, ARGIN_NULLOK(const char * const buffer), const UINTVAL len)
 {
+    ASSERT_ARGS(string_from_cstring);
     return string_make_direct(interp, buffer, len ? len :
             buffer ? strlen(buffer) : 0,
                               PARROT_DEFAULT_ENCODING, PARROT_DEFAULT_CHARSET,
@@ -639,6 +647,7 @@
 string_primary_encoding_for_representation(PARROT_INTERP,
     parrot_string_representation_t representation)
 {
+    ASSERT_ARGS(string_primary_encoding_for_representation);
     if (representation == enum_stringrep_one)
         return "ascii";
 
@@ -667,8 +676,7 @@
     DECL_CONST_CAST;
     STRING *s;
     Hash   * const cstring_cache = (Hash *)interp->const_cstring_hash;
-
-    PARROT_ASSERT(buffer);
+    ASSERT_ARGS(const_string);
 
     s = (STRING *)parrot_hash_get(interp, cstring_cache, buffer);
 
@@ -720,6 +728,7 @@
         UINTVAL len, ARGIN_NULLOK(const char *charset_name), UINTVAL flags)
 {
     const CHARSET  *charset;
+    ASSERT_ARGS(string_make);
 
     if (!charset_name)
         charset_name = "ascii";
@@ -756,6 +765,7 @@
 {
     DECL_CONST_CAST;
     STRING * const s = new_string_header(interp, flags);
+    ASSERT_ARGS(string_make_direct);
     s->encoding      = encoding;
     s->charset       = charset;
 
@@ -813,6 +823,7 @@
 STRING *
 string_grow(PARROT_INTERP, ARGMOD(STRING *s), UINTVAL addlen)
 {
+    ASSERT_ARGS(string_grow);
     Parrot_unmake_COW(interp, s);
 
     /* Don't check buflen, if we are here, we already checked. */
@@ -843,7 +854,7 @@
 UINTVAL
 string_length(SHIM_INTERP, ARGIN(const STRING *s))
 {
-    PARROT_ASSERT(s);
+    ASSERT_ARGS(string_length);
 
     return s->strlen;
 }
@@ -869,6 +880,7 @@
 INTVAL
 string_index(PARROT_INTERP, ARGIN(const STRING *s), UINTVAL idx)
 {
+    ASSERT_ARGS(string_index);
     saneify_string(s);
     return (INTVAL)CHARSET_GET_CODEPOINT(interp, s, idx);
 }
@@ -895,6 +907,7 @@
     STRING *src, *search;
     UINTVAL len;
     DECL_CONST_CAST;
+    ASSERT_ARGS(string_str_index);
 
     if (start < 0)
         return -1;
@@ -935,6 +948,7 @@
 {
     const UINTVAL len        = s ? string_length(interp, s) : 0;
     UINTVAL       true_index = (UINTVAL)idx;
+    ASSERT_ARGS(string_ord);
 
     if (len == 0)
         Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_ORD_OUT_OF_STRING,
@@ -975,6 +989,7 @@
 STRING *
 string_chr(PARROT_INTERP, UINTVAL character)
 {
+    ASSERT_ARGS(string_chr);
     if (character > 0xff)
         return Parrot_unicode_charset_ptr->string_from_codepoint(interp,
                 character);
@@ -1005,6 +1020,7 @@
 STRING *
 string_copy(PARROT_INTERP, ARGMOD(STRING *s))
 {
+    ASSERT_ARGS(string_copy);
     return Parrot_make_COW_reference(interp, s);
 }
 
@@ -1030,7 +1046,7 @@
 INTVAL
 string_compute_strlen(PARROT_INTERP, ARGMOD(STRING *s))
 {
-    PARROT_ASSERT(s);
+    ASSERT_ARGS(string_compute_strlen);
 
     s->strlen = CHARSET_CODEPOINTS(interp, s);
     return s->strlen;
@@ -1053,6 +1069,7 @@
 INTVAL
 string_max_bytes(SHIM_INTERP, ARGIN(const STRING *s), UINTVAL nchars)
 {
+    ASSERT_ARGS(string_max_bytes);
     PARROT_ASSERT(s->encoding);
     return ENCODING_MAX_BYTES_PER_CODEPOINT(interp, s) * nchars;
 }
@@ -1081,6 +1098,7 @@
     STRING * const dest = string_make_direct(interp, NULL,
                         s->bufused * num,
                         s->encoding, s->charset, 0);
+    ASSERT_ARGS(string_repeat);
 
     if (num == 0)
         return dest;
@@ -1121,6 +1139,7 @@
         ARGIN_NULLOK(STRING *src), INTVAL offset, INTVAL length,
         ARGOUT_NULLOK(STRING **d), int replace_dest)
 {
+    ASSERT_ARGS(string_substr);
     if (src == NULL)
         Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_SUBSTR_OUT_OF_STRING,
             "Cannot substr on a null string");
@@ -1212,6 +1231,7 @@
     STRING         *dest        = NULL;
     UINTVAL         true_offset = (UINTVAL)offset;
     UINTVAL         true_length = (UINTVAL)length;
+    ASSERT_ARGS(string_replace);
 
     /* special case */
     if (d             == NULL
@@ -1344,6 +1364,7 @@
 string_chopn(PARROT_INTERP, ARGMOD(STRING *s), INTVAL n)
 {
     STRING * const chopped = string_copy(interp, s);
+    ASSERT_ARGS(string_chopn);
     string_chopn_inplace(interp, chopped, n);
     return chopped;
 }
@@ -1366,6 +1387,7 @@
 string_chopn_inplace(PARROT_INTERP, ARGMOD(STRING *s), INTVAL n)
 {
     UINTVAL new_length, uchar_size;
+    ASSERT_ARGS(string_chopn_inplace);
 
     if (n < 0) {
         new_length = -n;
@@ -1425,6 +1447,7 @@
 INTVAL
 string_compare(PARROT_INTERP, ARGIN_NULLOK(const STRING *s1), ARGIN_NULLOK(const STRING *s2))
 {
+    ASSERT_ARGS(string_compare);
     if (!s2)
         return s1 && (s1->strlen != 0);
 
@@ -1457,6 +1480,7 @@
 INTVAL
 string_equal(PARROT_INTERP, ARGIN_NULLOK(const STRING *s1), ARGIN_NULLOK(const STRING *s2))
 {
+    ASSERT_ARGS(string_equal);
     if ((s1 == s2) || (!s1 && !s2)) {
         return 0;
     }
@@ -1505,6 +1529,7 @@
 make_writable(PARROT_INTERP, ARGMOD(STRING **s),
     const size_t len, parrot_string_representation_t representation)
 {
+    ASSERT_ARGS(make_writable);
     if (!*s)
         *s = string_make_empty(interp, representation, len);
     else if ((*s)->strlen < len)
@@ -1534,6 +1559,7 @@
 {
     STRING *res;
     size_t  minlen;
+    ASSERT_ARGS(string_bitwise_and);
 
     /* we could also trans_charset to iso-8859-1 */
     if (s1 && s1->encoding != Parrot_fixed_8_encoding_ptr)
@@ -1684,6 +1710,7 @@
 {
     STRING *res;
     size_t  maxlen = 0;
+    ASSERT_ARGS(string_bitwise_or);
 
     if (s1) {
         if (s1->encoding != Parrot_fixed_8_encoding_ptr)
@@ -1758,6 +1785,7 @@
 {
     STRING *res;
     size_t  maxlen = 0;
+    ASSERT_ARGS(string_bitwise_xor);
 
     if (s1) {
         if (s1->encoding != Parrot_fixed_8_encoding_ptr)
@@ -1843,6 +1871,7 @@
 {
     STRING *res;
     size_t  len;
+    ASSERT_ARGS(string_bitwise_not);
 
     if (s) {
         if (s->encoding != Parrot_fixed_8_encoding_ptr)
@@ -1905,6 +1934,7 @@
 string_bool(PARROT_INTERP, ARGIN_NULLOK(const STRING *s))
 {
     const INTVAL len = s ? string_length(interp, s) : 0;
+    ASSERT_ARGS(string_bool);
 
     if (len == 0)
         return 0;
@@ -1941,6 +1971,7 @@
 {
     STRING *output;
     va_list args;
+    ASSERT_ARGS(string_printf);
 
     va_start(args, format);
     output = Parrot_vsprintf_c(interp, format, args);
@@ -1978,6 +2009,7 @@
 INTVAL
 string_to_int(SHIM_INTERP, ARGIN_NULLOK(const STRING *s))
 {
+    ASSERT_ARGS(string_to_int);
     if (s == NULL)
         return 0;
     {
@@ -2042,8 +2074,7 @@
     const char *p;
 
     DECL_CONST_CAST;
-
-    PARROT_ASSERT(s);
+    ASSERT_ARGS(string_to_num);
 
     /*
      * XXX C99 atof interprets 0x prefix
@@ -2089,6 +2120,7 @@
 string_from_int(PARROT_INTERP, INTVAL i)
 {
     char buf[128];
+    ASSERT_ARGS(string_from_int);
     return int_to_str(interp, buf, (HUGEINTVAL)i, 10);
 }
 
@@ -2109,6 +2141,7 @@
 STRING *
 string_from_num(PARROT_INTERP, FLOATVAL f)
 {
+    ASSERT_ARGS(string_from_num);
     /* Too damn hard--hand it off to Parrot_sprintf, which'll probably
        use the system sprintf anyway, but has gigantic buffers that are
        awfully hard to overflow. */
@@ -2134,6 +2167,7 @@
 char *
 string_to_cstring(PARROT_INTERP, ARGIN_NULLOK(const STRING *s))
 {
+    ASSERT_ARGS(string_to_cstring);
     if (! s) {
         Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_UNEXPECTED_NULL,
             "Can't convert NULL string");
@@ -2161,6 +2195,7 @@
 char *
 string_to_cstring_nullable(SHIM_INTERP, ARGIN_NULLOK(const STRING *s))
 {
+    ASSERT_ARGS(string_to_cstring_nullable);
     if (!s)
         return NULL;
     else {
@@ -2189,6 +2224,7 @@
 void
 string_cstring_free(ARGIN_NULLOK(char *p))
 {
+    ASSERT_ARGS(string_cstring_free);
     mem_sys_free((void *)p);
 }
 
@@ -2209,6 +2245,7 @@
 {
     char  *memory;
     size_t size;
+    ASSERT_ARGS(string_pin);
 
     /* XXX -lt: COW strings have the external_FLAG set, so this will
      *          not work for these
@@ -2244,6 +2281,7 @@
 {
     void  *memory;
     size_t size;
+    ASSERT_ARGS(string_unpin);
 
     /* If this string is not marked using system memory,
      * we just don't do this
@@ -2294,6 +2332,7 @@
 {
     register size_t h;
     const UINTVAL seed = interp->hash_seed;
+    ASSERT_ARGS(string_hash);
 
     if (!s)
         return seed;
@@ -2327,6 +2366,7 @@
 STRING *
 string_escape_string(PARROT_INTERP, ARGIN_NULLOK(const STRING *src))
 {
+    ASSERT_ARGS(string_escape_string);
     return string_escape_string_delimited(interp, src, (UINTVAL) ~0);
 }
 
@@ -2353,6 +2393,7 @@
     UINTVAL i, len, charlen;
     String_iter iter;
     unsigned char *dp;
+    ASSERT_ARGS(string_escape_string_delimited);
 
     if (!src)
         return NULL;
@@ -2493,6 +2534,7 @@
 
     /* we are constructing const table strings here */
     const UINTVAL   flags = PObj_constant_FLAG;
+    ASSERT_ARGS(string_unescape_cstring);
 
     if (delimiter && clength)
         --clength;
@@ -2584,6 +2626,7 @@
 STRING *
 string_upcase(PARROT_INTERP, ARGIN_NULLOK(const STRING *s))
 {
+    ASSERT_ARGS(string_upcase);
     if (STRING_IS_NULL(s)) {
         Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_UNEXPECTED_NULL,
             "Can't upcase NULL string");
@@ -2611,6 +2654,7 @@
 void
 string_upcase_inplace(PARROT_INTERP, ARGMOD_NULLOK(STRING *s))
 {
+    ASSERT_ARGS(string_upcase_inplace);
     if (STRING_IS_NULL(s)) {
         Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_UNEXPECTED_NULL,
             "Can't upcase NULL string");
@@ -2641,6 +2685,7 @@
 {
     DECL_CONST_CAST;
     STRING * const dest = string_copy(interp, PARROT_const_cast(STRING *, s));
+    ASSERT_ARGS(string_downcase);
     string_downcase_inplace(interp, dest);
     return dest;
 }
@@ -2660,6 +2705,7 @@
 void
 string_downcase_inplace(PARROT_INTERP, ARGMOD(STRING *s))
 {
+    ASSERT_ARGS(string_downcase_inplace);
     /*
      * TODO get rid of all the inplace variants. We have for utf8:
      * * 1 string_copy from the non-incase variant
@@ -2690,6 +2736,7 @@
 {
     DECL_CONST_CAST;
     STRING * const dest = string_copy(interp, PARROT_const_cast(STRING *, s));
+    ASSERT_ARGS(string_titlecase);
     string_titlecase_inplace(interp, dest);
     return dest;
 }
@@ -2709,6 +2756,7 @@
 void
 string_titlecase_inplace(PARROT_INTERP, ARGMOD(STRING *s))
 {
+    ASSERT_ARGS(string_titlecase_inplace);
     Parrot_unmake_COW(interp, s);
     CHARSET_TITLECASE(interp, s);
 }
@@ -2732,8 +2780,7 @@
 string_increment(PARROT_INTERP, ARGIN(const STRING *s))
 {
     UINTVAL o;
-
-    PARROT_ASSERT(s);
+    ASSERT_ARGS(string_increment);
 
     if (string_length(interp, s) != 1)
         Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_UNIMPLEMENTED,
@@ -2769,6 +2816,7 @@
 const char *
 Parrot_string_cstring(SHIM_INTERP, ARGIN(const STRING *str))
 {
+    ASSERT_ARGS(Parrot_string_cstring);
     /* TODO handle NUL and friends */
     return str->strstart;
 }
@@ -2792,6 +2840,7 @@
 Parrot_string_is_cclass(PARROT_INTERP, INTVAL flags,
         ARGIN(const STRING *s), UINTVAL offset)
 {
+    ASSERT_ARGS(Parrot_string_is_cclass);
     if (!string_length(interp, s))
         return 0;
 
@@ -2816,6 +2865,7 @@
 Parrot_string_find_cclass(PARROT_INTERP, INTVAL flags, ARGIN_NULLOK(STRING *s),
                           UINTVAL offset, UINTVAL count)
 {
+    ASSERT_ARGS(Parrot_string_find_cclass);
     if (!s)
         return -1;
 
@@ -2841,6 +2891,7 @@
 Parrot_string_find_not_cclass(PARROT_INTERP, INTVAL flags,
     ARGIN_NULLOK(STRING *s), UINTVAL offset, UINTVAL count)
 {
+    ASSERT_ARGS(Parrot_string_find_not_cclass);
     if (!s)
         return -1;
 
@@ -2867,6 +2918,7 @@
         INTVAL charset_nr, ARGOUT_NULLOK(STRING *dest))
 {
     const CHARSET *new_charset;
+    ASSERT_ARGS(Parrot_string_trans_charset);
 
     if (!src)
         return NULL;
@@ -2924,6 +2976,7 @@
         INTVAL encoding_nr, ARGOUT_NULLOK(STRING *dest))
 {
     const ENCODING *new_encoding;
+    ASSERT_ARGS(Parrot_string_trans_encoding);
 
     if (!src)
         return NULL;
@@ -2972,6 +3025,7 @@
 STRING *
 string_compose(PARROT_INTERP, ARGIN_NULLOK(STRING *src))
 {
+    ASSERT_ARGS(string_compose);
     if (!src)
         return NULL;
 
@@ -3003,6 +3057,7 @@
     STRING *s;
     const int ar_len = VTABLE_elements(interp, ar);
     int i;
+    ASSERT_ARGS(string_join);
 
     if (ar_len == 0)
         return string_make_empty(interp, enum_stringrep_one, 0);
@@ -3043,6 +3098,7 @@
 
     int dlen;
     int ps, pe;
+    ASSERT_ARGS(string_split);
 
     if (!slen)
         return res;
@@ -3109,6 +3165,7 @@
 Parrot_string_split(PARROT_INTERP,
     ARGIN_NULLOK(STRING *delim), ARGIN_NULLOK(STRING *str))
 {
+    ASSERT_ARGS(Parrot_string_split);
     return (delim && str) ? string_split(interp, delim, str) : NULL;
 }
 
@@ -3137,6 +3194,7 @@
     /* the buffer must be at least as long as this */
     char               *p    = tc + sizeof (UHUGEINTVAL)*8 + 1;
     const char * const  tail = p;
+    ASSERT_ARGS(uint_to_str);
 
     PARROT_ASSERT(base >= 2 && base <= 36);
 
@@ -3177,6 +3235,7 @@
 int_to_str(PARROT_INTERP, ARGOUT(char *tc), HUGEINTVAL num, unsigned int base)
 {
     const int is_neg = (num < 0);
+    ASSERT_ARGS(int_to_str);
 
     if (is_neg)
         num = -num;

Modified: trunk/src/string_primitives.c
==============================================================================
--- trunk/src/string_primitives.c	(original)
+++ trunk/src/string_primitives.c	Wed Dec 31 11:20:05 2008
@@ -46,6 +46,7 @@
 void
 string_set_data_directory(PARROT_INTERP, ARGIN(const char *dir))
 {
+    ASSERT_ARGS(string_set_data_directory);
 #if PARROT_HAS_ICU
     u_setDataDirectory(dir);
 
@@ -88,6 +89,7 @@
     const UINTVAL len = string_length(interp, string);
     /* Well, not right now */
     UINTVAL codepoint = CHARSET_GET_BYTE(interp, string, *offset);
+    ASSERT_ARGS(string_unescape_one);
     ++*offset;
     switch (codepoint) {
         case 'x':
@@ -320,6 +322,7 @@
 INTVAL
 Parrot_char_digit_value(SHIM_INTERP, UINTVAL character)
 {
+    ASSERT_ARGS(Parrot_char_digit_value);
 #if PARROT_HAS_ICU
     return u_charDigitValue(character);
 #else
@@ -348,6 +351,7 @@
 {
     const size_t bytes = strlen(old) + 1;
     char * const copy = (char *)mem_sys_allocate(bytes);
+    ASSERT_ARGS(str_dup);
     memcpy(copy, old, bytes);
 #ifdef MEMDEBUG
     debug(interp, 1, "line %d str_dup %s [%x]\n", line, old, copy);
@@ -377,6 +381,7 @@
     /* 2 for the beginning and ending quote chars */
     const size_t newlen = oldlen - 2;
     char * const copy   = (char *)mem_sys_allocate(newlen);
+    ASSERT_ARGS(str_dup_remove_quotes);
 
     memcpy(copy, old + 1, newlen);
     copy[newlen - 1] = 0;

Modified: trunk/src/sub.c
==============================================================================
--- trunk/src/sub.c	(original)
+++ trunk/src/sub.c	Wed Dec 31 11:20:05 2008
@@ -40,6 +40,7 @@
 void
 mark_context_start(void)
 {
+    ASSERT_ARGS(mark_context_start);
     if (++context_gc_mark == 0) context_gc_mark = 1;
 }
 
@@ -59,6 +60,7 @@
 {
     PObj *obj;
     int   i;
+    ASSERT_ARGS(mark_context);
 
     if (ctx->gc_mark == context_gc_mark) return;
     ctx->gc_mark = context_gc_mark;
@@ -137,6 +139,7 @@
 {
     /* Using system memory until I figure out GC issues */
     Parrot_sub * const newsub = mem_allocate_zeroed_typed(Parrot_sub);
+    ASSERT_ARGS(new_sub);
     newsub->seg               = interp->code;
     return newsub;
 }
@@ -159,6 +162,7 @@
 new_closure(PARROT_INTERP)
 {
     Parrot_sub * const newsub = new_sub(interp);
+    ASSERT_ARGS(new_closure);
     return newsub;
 }
 
@@ -181,6 +185,7 @@
 {
     Parrot_cont    * const cc     = mem_allocate_typed(Parrot_cont);
     Parrot_Context * const to_ctx = to ? to->to_ctx : CONTEXT(interp);
+    ASSERT_ARGS(new_continuation);
 
     cc->to_ctx        = to_ctx;
     cc->from_ctx      = Parrot_context_ref(interp, CONTEXT(interp));
@@ -215,6 +220,7 @@
 new_ret_continuation(PARROT_INTERP)
 {
     Parrot_cont * const cc = mem_allocate_typed(Parrot_cont);
+    ASSERT_ARGS(new_ret_continuation);
 
     cc->to_ctx          = CONTEXT(interp);
     cc->from_ctx        = CONTEXT(interp);    /* filled in during a call */
@@ -244,6 +250,7 @@
 new_coroutine(PARROT_INTERP)
 {
     Parrot_coro * const co = mem_allocate_zeroed_typed(Parrot_coro);
+    ASSERT_ARGS(new_coroutine);
 
     co->seg                = interp->code;
     co->ctx                = NULL;
@@ -270,6 +277,7 @@
 new_ret_continuation_pmc(PARROT_INTERP, ARGIN_NULLOK(opcode_t *address))
 {
     PMC* const continuation = pmc_new(interp, enum_class_RetContinuation);
+    ASSERT_ARGS(new_ret_continuation_pmc);
     VTABLE_set_pointer(interp, continuation, address);
     return continuation;
 }
@@ -288,6 +296,7 @@
 invalidate_retc_context(PARROT_INTERP, ARGMOD(PMC *cont))
 {
     Parrot_Context *ctx = PMC_cont(cont)->from_ctx;
+    ASSERT_ARGS(invalidate_retc_context);
     cont = ctx->current_cont;
 
     Parrot_set_context_threshold(interp, ctx);
@@ -323,6 +332,7 @@
 STRING*
 Parrot_full_sub_name(PARROT_INTERP, ARGIN_NULLOK(PMC* sub))
 {
+    ASSERT_ARGS(Parrot_full_sub_name);
     if (sub && VTABLE_defined(interp, sub)) {
         Parrot_sub * const s = PMC_sub(sub);
 
@@ -391,6 +401,7 @@
 {
     Parrot_sub *sub;
     DECL_CONST_CAST;
+    ASSERT_ARGS(Parrot_Context_get_info);
 
     /* set file/line/pc defaults */
     info->file     = CONST_STRING(interp, "(unknown file)");
@@ -485,6 +496,7 @@
     const char * const  msg = (CONTEXT(interp) == ctx)
         ? "current instr.:"
         : "called from Sub";
+    ASSERT_ARGS(Parrot_Context_infostr);
 
     Parrot_block_GC_mark(interp);
     if (Parrot_Context_get_info(interp, ctx, &info)) {
@@ -514,6 +526,7 @@
 PMC*
 Parrot_find_pad(PARROT_INTERP, ARGIN(STRING *lex_name), ARGIN(const Parrot_Context *ctx))
 {
+    ASSERT_ARGS(Parrot_find_pad);
     while (1) {
         PMC                    * const lex_pad = ctx->lex_pad;
         const Parrot_Context   * const outer   = ctx->outer_ctx;
@@ -558,6 +571,7 @@
     Parrot_sub * const current_sub  = PMC_sub(ctx->current_sub);
     Parrot_sub * const sub          = PMC_sub(sub_pmc);
     Parrot_Context *old;
+    ASSERT_ARGS(Parrot_capture_lex);
 
     /* MultiSub gets special treatment */
     if (VTABLE_isa(interp, sub_pmc, CONST_STRING(interp, "MultiSub"))) {
@@ -622,6 +636,7 @@
 parrot_new_closure(PARROT_INTERP, ARGIN(PMC *sub_pmc))
 {
     PMC        * const clos_pmc = VTABLE_clone(interp, sub_pmc);
+    ASSERT_ARGS(parrot_new_closure);
     Parrot_capture_lex(interp, clos_pmc);
     return clos_pmc;
 }
@@ -643,6 +658,7 @@
 {
     Parrot_Context *to_ctx       = cc->to_ctx;
     Parrot_Context *from_ctx     = CONTEXT(interp);
+    ASSERT_ARGS(Parrot_continuation_check);
 
 #if CTX_LEAK_DEBUG
     if (Interp_debug_TEST(interp, PARROT_CTX_DESTROY_DEBUG_FLAG))
@@ -671,6 +687,7 @@
         ARGIN(Parrot_cont *cc))
 {
     Parrot_Context * const to_ctx = cc->to_ctx;
+    ASSERT_ARGS(Parrot_continuation_rewind_environment);
 
     /* debug print before context is switched */
     if (Interp_trace_TEST(interp, PARROT_TRACE_SUB_CALL_FLAG)) {

Modified: trunk/src/thread.c
==============================================================================
--- trunk/src/thread.c	(original)
+++ trunk/src/thread.c	Wed Dec 31 11:20:05 2008
@@ -157,6 +157,7 @@
     PMC            *ret_val;
     STRING * const  _sub       = interp->vtables[enum_class_Sub]->whoami;
     STRING * const  _multi_sub = interp->vtables[enum_class_MultiSub]->whoami;
+    ASSERT_ARGS(make_local_copy);
 
     if (PMC_IS_NULL(arg)) {
         ret_val = PMCNULL;
@@ -210,6 +211,7 @@
 static Shared_gc_info *
 get_pool(PARROT_INTERP)
 {
+    ASSERT_ARGS(get_pool);
     return shared_gc_info;
 }
 
@@ -227,6 +229,7 @@
 void
 pt_free_pool(PARROT_INTERP)
 {
+    ASSERT_ARGS(pt_free_pool);
     if (shared_gc_info) {
         COND_DESTROY(shared_gc_info->gc_cond);
         PARROT_ATOMIC_INT_DESTROY(shared_gc_info->gc_block_level);
@@ -252,6 +255,7 @@
     PMC   *ret_val;
     INTVAL old_size;
     INTVAL i;
+    ASSERT_ARGS(make_local_args_copy);
 
     if (PMC_IS_NULL(args))
         return PMCNULL;
@@ -298,6 +302,7 @@
     INTVAL        type_num;
     Parrot_Interp master = interpreter_array[0];
     const int     is_ro  = pmc->vtable->flags & VTABLE_IS_READONLY_FLAG;
+    ASSERT_ARGS(pt_shared_fixup);
 
     /* This lock is paired with one in objects.c. It is necessary to protect
      * against the master interpreter adding classes and consequently
@@ -346,6 +351,7 @@
 static void
 pt_thread_signal(NOTNULL(Parrot_Interp self), PARROT_INTERP)
 {
+    ASSERT_ARGS(pt_thread_signal);
     COND_SIGNAL(interp->thread_data->interp_cond);
 }
 
@@ -365,6 +371,7 @@
 void
 pt_thread_wait_with(PARROT_INTERP, ARGMOD(Parrot_mutex *mutex))
 {
+    ASSERT_ARGS(pt_thread_wait_with);
     LOCK(interpreter_array_mutex);
     if (interp->thread_data->state & THREAD_STATE_SUSPEND_GC_REQUESTED) {
         interp->thread_data->state |= THREAD_STATE_SUSPENDED_GC;
@@ -418,6 +425,7 @@
 static void
 pt_thread_wait(PARROT_INTERP)
 {
+    ASSERT_ARGS(pt_thread_wait);
     if (interp->thread_data->state & THREAD_STATE_SUSPEND_GC_REQUESTED) {
         interp->thread_data->state |= THREAD_STATE_SUSPENDED_GC;
         /* fprintf(stderr, "%p: pt_thread_wait, before sleep, doing GC run\n",
@@ -469,6 +477,7 @@
     PMC * const      self    = (PMC*) arg;
     PMC             *ret_val = NULL;
     Parrot_Interp    interp  = (Parrot_Interp)PMC_data(self);
+    ASSERT_ARGS(thread_func);
 
     Parrot_block_GC_mark(interp);
     Parrot_block_GC_sweep(interp);
@@ -550,6 +559,7 @@
 void
 pt_clone_code(Parrot_Interp d, Parrot_Interp s)
 {
+    ASSERT_ARGS(pt_clone_code);
     Parrot_block_GC_mark(d);
     Interp_flags_SET(d, PARROT_EXTERN_CODE_FLAG);
     d->code = NULL;
@@ -574,6 +584,7 @@
     PMC * const iter = VTABLE_get_iter(s, source_ns);
     const INTVAL n   = VTABLE_elements(s, source_ns);
     INTVAL i;
+    ASSERT_ARGS(pt_ns_clone);
 
     for (i = 0; i < n; ++i) {
         /* XXX what if 'key' is a non-constant-pool string? */
@@ -619,6 +630,7 @@
 void
 pt_clone_globals(Parrot_Interp d, Parrot_Interp s)
 {
+    ASSERT_ARGS(pt_clone_globals);
     Parrot_block_GC_mark(d);
     pt_ns_clone(d, d->root_namespace, s, s->root_namespace);
     Parrot_unblock_GC_mark(d);
@@ -637,6 +649,7 @@
 void
 pt_thread_prepare_for_run(Parrot_Interp d, Parrot_Interp s)
 {
+    ASSERT_ARGS(pt_thread_prepare_for_run);
     Parrot_setup_event_func_ptrs(d);
 }
 
@@ -666,6 +679,7 @@
 PMC *
 pt_transfer_sub(ARGOUT(Parrot_Interp d), ARGIN(Parrot_Interp s), ARGIN(PMC *sub))
 {
+    ASSERT_ARGS(pt_transfer_sub);
 #if defined THREAD_DEBUG && THREAD_DEBUG
     Parrot_io_eprintf(s, "copying over subroutine [%Ss]\n",
         Parrot_full_sub_name(s, sub));
@@ -692,6 +706,7 @@
     PMC *old_dest_interp;
     PMC *parent;
     Interp * const interpreter = (Parrot_Interp)PMC_data(dest_interp);
+    ASSERT_ARGS(pt_thread_run);
 
     Parrot_block_GC_sweep(interpreter);
     Parrot_block_GC_mark(interpreter);
@@ -773,6 +788,7 @@
 int
 pt_thread_run_1(PARROT_INTERP, ARGOUT(PMC* dest_interp), ARGIN(PMC* sub), ARGIN(PMC *arg))
 {
+    ASSERT_ARGS(pt_thread_run_1);
     interp->flags |= PARROT_THR_TYPE_1;
     return pt_thread_run(interp, dest_interp, sub, arg);
 }
@@ -791,6 +807,7 @@
 int
 pt_thread_run_2(PARROT_INTERP, ARGOUT(PMC* dest_interp), ARGIN(PMC* sub), ARGIN(PMC *arg))
 {
+    ASSERT_ARGS(pt_thread_run_2);
     interp->flags |= PARROT_THR_TYPE_2;
     return pt_thread_run(interp, dest_interp, sub, arg);
 }
@@ -809,6 +826,7 @@
 int
 pt_thread_run_3(PARROT_INTERP, ARGOUT(PMC* dest_interp), ARGIN(PMC* sub), ARGIN(PMC *arg))
 {
+    ASSERT_ARGS(pt_thread_run_3);
     interp->flags |= PARROT_THR_TYPE_3;
     return pt_thread_run(interp, dest_interp, sub, arg);
 }
@@ -826,6 +844,7 @@
 void
 pt_thread_yield(void)
 {
+    ASSERT_ARGS(pt_thread_yield);
     YIELD;
 }
 
@@ -843,6 +862,7 @@
 static Parrot_Interp
 pt_check_tid(UINTVAL tid, ARGIN(const char *from))
 {
+    ASSERT_ARGS(pt_check_tid);
     if (tid >= n_interpreters) {
         UNLOCK(interpreter_array_mutex);
         exit_fatal(1, "%s: illegal thread tid %d", from, tid);
@@ -871,6 +891,7 @@
 static void
 mutex_unlock(ARGMOD(void *arg))
 {
+    ASSERT_ARGS(mutex_unlock);
     UNLOCK(*(Parrot_mutex *) arg);
 }
 
@@ -889,6 +910,7 @@
 static int
 is_suspended_for_gc(PARROT_INTERP)
 {
+    ASSERT_ARGS(is_suspended_for_gc);
     if (!interp)
         return 1;
     else if (interp->thread_data->wants_shared_gc)
@@ -921,6 +943,7 @@
     QUEUE        *queue = interp->task_queue;
     QUEUE_ENTRY  *prev  = NULL;
     QUEUE_ENTRY  *cur;
+    ASSERT_ARGS(remove_queued_suspend_gc);
 
     queue_lock(queue);
     cur = queue->head;
@@ -973,6 +996,7 @@
 {
     UINTVAL i;
     int     count = 0;
+    ASSERT_ARGS(pt_gc_count_threads);
 
     for (i = 0; i < n_interpreters; ++i) {
         Parrot_Interp cur;
@@ -1006,6 +1030,7 @@
 {
     Shared_gc_info * const info = shared_gc_info;
     int             thread_count;
+    ASSERT_ARGS(pt_gc_wait_for_stage);
 
     DEBUG_ONLY(fprintf(stderr, "%p: gc_wait_for_stage: %d->%d\n", interp, from_stage, to_stage));
 
@@ -1058,6 +1083,7 @@
 {
     Shared_gc_info * const info = shared_gc_info;
     int             thread_count;
+    ASSERT_ARGS(pt_gc_wakeup_check);
 
     /* XXX: maybe a little hack; see RT #49532 */
     if (!info)
@@ -1087,6 +1113,7 @@
 static void
 pt_suspend_one_for_gc(PARROT_INTERP)
 {
+    ASSERT_ARGS(pt_suspend_one_for_gc);
     DEBUG_ONLY(fprintf(stderr, "suspend one: %p\n", interp));
     if (is_suspended_for_gc(interp)) {
         DEBUG_ONLY(fprintf(stderr, "ignoring already suspended\n"));
@@ -1119,6 +1146,7 @@
 pt_suspend_all_for_gc(PARROT_INTERP)
 {
     UINTVAL i;
+    ASSERT_ARGS(pt_suspend_all_for_gc);
 
     DEBUG_ONLY(fprintf(stderr, "suspend_all_for_gc [interp=%p]\n", interp));
 
@@ -1190,6 +1218,7 @@
 void
 pt_suspend_self_for_gc(PARROT_INTERP)
 {
+    ASSERT_ARGS(pt_suspend_self_for_gc);
     PARROT_ASSERT(interp);
     PARROT_ASSERT(!interp->arena_base->DOD_block_level);
     DEBUG_ONLY(fprintf(stderr, "%p: suspend_self_for_gc\n", interp));
@@ -1240,6 +1269,7 @@
 {
     int           state;
     Parrot_Interp interp;
+    ASSERT_ARGS(pt_thread_join);
 
     LOCK(interpreter_array_mutex);
 
@@ -1350,6 +1380,7 @@
 {
     size_t          i;
     pt_free_pool(interp);
+    ASSERT_ARGS(pt_join_threads);
 
     /* if no threads were started - fine */
     LOCK(interpreter_array_mutex);
@@ -1399,6 +1430,7 @@
 detach(UINTVAL tid)
 {
     Parrot_Interp interp;
+    ASSERT_ARGS(detach);
 
     LOCK(interpreter_array_mutex);
     interp = pt_check_tid(tid, "detach");
@@ -1434,6 +1466,7 @@
 void
 pt_thread_detach(UINTVAL tid)
 {
+    ASSERT_ARGS(pt_thread_detach);
     (void) detach(tid);
 }
 
@@ -1451,6 +1484,7 @@
 pt_thread_kill(UINTVAL tid)
 {
     PARROT_INTERP = detach(tid);
+    ASSERT_ARGS(pt_thread_kill);
 
     /* schedule a terminate event for that interpreter */
     if (interp)
@@ -1478,6 +1512,7 @@
 pt_add_to_interpreters(PARROT_INTERP, ARGIN_NULLOK(Parrot_Interp new_interp))
 {
     size_t i;
+    ASSERT_ARGS(pt_add_to_interpreters);
     DEBUG_ONLY(fprintf(stderr, "interp = %p\n", interp));
 
     if (!new_interp) {
@@ -1565,6 +1600,7 @@
 {
     Shared_gc_info *info;
     int             block_level;
+    ASSERT_ARGS(pt_DOD_start_mark);
 
     DEBUG_ONLY(fprintf(stderr, "%p: pt_DOD_start_mark\n", interp));
     /* if no other threads are running, we are safe */
@@ -1640,6 +1676,7 @@
 void
 pt_DOD_mark_root_finished(PARROT_INTERP)
 {
+    ASSERT_ARGS(pt_DOD_mark_root_finished);
     if (!running_threads)
         return;
     /*
@@ -1664,6 +1701,7 @@
 void
 pt_DOD_stop_mark(PARROT_INTERP)
 {
+    ASSERT_ARGS(pt_DOD_stop_mark);
     if (!running_threads)
         return;
     /*
@@ -1707,6 +1745,7 @@
 Parrot_shared_DOD_block(PARROT_INTERP)
 {
     Shared_gc_info * const info = get_pool(interp);
+    ASSERT_ARGS(Parrot_shared_DOD_block);
 
     if (info) {
         int level;
@@ -1730,6 +1769,7 @@
 Parrot_shared_DOD_unblock(PARROT_INTERP)
 {
     Shared_gc_info * const info = get_pool(interp);
+    ASSERT_ARGS(Parrot_shared_DOD_unblock);
     if (info) {
         int level;
         PARROT_ATOMIC_INT_DEC(level, info->gc_block_level);

Modified: trunk/src/trace.c
==============================================================================
--- trunk/src/trace.c	(original)
+++ trunk/src/trace.c	Wed Dec 31 11:20:05 2008
@@ -56,6 +56,7 @@
 trace_class_name(ARGIN(const PMC* pmc))
 {
     STRING *class_name;
+    ASSERT_ARGS(trace_class_name);
     if (PObj_is_class_TEST(pmc)) {
         SLOTTYPE * const class_array = (SLOTTYPE *)PMC_data(pmc);
         PMC * const class_name_pmc = get_attrib_num(class_array,
@@ -81,6 +82,7 @@
 trace_pmc_dump(PARROT_INTERP, ARGIN_NULLOK(PMC *pmc))
 {
     Interp * const debugger = interp->debugger;
+    ASSERT_ARGS(trace_pmc_dump);
 
     if (!pmc) {
         Parrot_io_eprintf(debugger, "(null)");
@@ -172,6 +174,7 @@
     Interp * const debugger = interp->debugger;
 
     int len = Parrot_io_eprintf(debugger, "[");
+    ASSERT_ARGS(trace_key_dump);
 
     while (key) {
         switch (PObj_get_FLAGS(key) & KEY_type_FLAGS) {
@@ -259,6 +262,7 @@
     int type;
     int len;
 #define ARGS_COLUMN 40
+    ASSERT_ARGS(trace_op_dump);
 
     PARROT_ASSERT(debugger);
     sig = NULL; /* silence compiler uninit warning */
@@ -466,6 +470,7 @@
         ARGIN(const opcode_t *code_end),
         ARGIN_NULLOK(const opcode_t *pc))
 {
+    ASSERT_ARGS(trace_op);
     if (!pc) {
         return;
     }

Modified: trunk/src/tsq.c
==============================================================================
--- trunk/src/tsq.c	(original)
+++ trunk/src/tsq.c	Wed Dec 31 11:20:05 2008
@@ -35,6 +35,7 @@
 pop_entry(ARGMOD(QUEUE *queue))
 {
     QUEUE_ENTRY *returnval;
+    ASSERT_ARGS(pop_entry);
     queue_lock(queue);
     returnval = nosync_pop_entry(queue);
     queue_unlock(queue);
@@ -58,6 +59,7 @@
 QUEUE_ENTRY *
 peek_entry(ARGIN(const QUEUE *queue))
 {
+    ASSERT_ARGS(peek_entry);
     return queue->head;
 }
 
@@ -78,6 +80,7 @@
 nosync_pop_entry(ARGMOD(QUEUE *queue))
 {
     QUEUE_ENTRY *returnval;
+    ASSERT_ARGS(nosync_pop_entry);
     if (!queue->head) {
         return NULL;
     }
@@ -109,6 +112,7 @@
 wait_for_entry(ARGMOD(QUEUE *queue))
 {
     QUEUE_ENTRY *returnval;
+    ASSERT_ARGS(wait_for_entry);
 
     queue_lock(queue);
     while (queue->head == NULL) {
@@ -133,6 +137,7 @@
 void
 push_entry(ARGMOD(QUEUE *queue), ARGIN(QUEUE_ENTRY *entry))
 {
+    ASSERT_ARGS(push_entry);
     queue_lock(queue);
     /* Is there something in the queue? */
     if (queue->tail) {
@@ -161,6 +166,7 @@
 unshift_entry(ARGMOD(QUEUE *queue), ARGIN(QUEUE_ENTRY *entry))
 {
     QUEUE_ENTRY *cur;
+    ASSERT_ARGS(unshift_entry);
 
     queue_lock(queue);
     cur = queue->head;
@@ -195,6 +201,7 @@
     QUEUE_ENTRY *prev;
     parrot_event *event;
     FLOATVAL abs_time;
+    ASSERT_ARGS(nosync_insert_entry);
 
     PARROT_ASSERT(entry->type == QUEUE_ENTRY_TYPE_TIMED_EVENT);
     /*
@@ -242,6 +249,7 @@
 void
 insert_entry(ARGMOD(QUEUE *queue), ARGIN(QUEUE_ENTRY *entry))
 {
+    ASSERT_ARGS(insert_entry);
     queue_lock(queue);
     nosync_insert_entry(queue, entry);
     queue_signal(queue);
@@ -261,6 +269,7 @@
 void
 queue_lock(ARGMOD(QUEUE *queue))
 {
+    ASSERT_ARGS(queue_lock);
     LOCK(queue->queue_mutex);
 }
 
@@ -277,6 +286,7 @@
 void
 queue_unlock(ARGMOD(QUEUE *queue))
 {
+    ASSERT_ARGS(queue_unlock);
     UNLOCK(queue->queue_mutex);
 }
 
@@ -293,6 +303,7 @@
 void
 queue_broadcast(ARGMOD(QUEUE *queue))
 {
+    ASSERT_ARGS(queue_broadcast);
     COND_BROADCAST(queue->queue_condition);
 }
 
@@ -309,6 +320,7 @@
 void
 queue_signal(ARGMOD(QUEUE *queue))
 {
+    ASSERT_ARGS(queue_signal);
     COND_SIGNAL(queue->queue_condition);
 }
 
@@ -325,6 +337,7 @@
 void
 queue_wait(ARGMOD(QUEUE *queue))
 {
+    ASSERT_ARGS(queue_wait);
     COND_WAIT(queue->queue_condition, queue->queue_mutex);
 }
 
@@ -341,6 +354,7 @@
 void
 queue_timedwait(ARGMOD(QUEUE *queue), ARGIN(const struct timespec *abs_time))
 {
+    ASSERT_ARGS(queue_timedwait);
     COND_TIMED_WAIT(queue->queue_condition, queue->queue_mutex, abs_time);
 }
 
@@ -360,6 +374,7 @@
 queue_init(UINTVAL prio)
 {
     QUEUE * const queue = mem_allocate_typed(QUEUE);
+    ASSERT_ARGS(queue_init);
 
     queue->head = queue->tail = NULL;
     queue->max_prio = prio;
@@ -381,6 +396,7 @@
 void
 queue_destroy(ARGMOD(QUEUE *queue))
 {
+    ASSERT_ARGS(queue_destroy);
     if (peek_entry(queue))
         exit_fatal(1, "Queue not empty on destroy");
 

Modified: trunk/src/vtables.c
==============================================================================
--- trunk/src/vtables.c	(original)
+++ trunk/src/vtables.c	Wed Dec 31 11:20:05 2008
@@ -37,6 +37,7 @@
 VTABLE *
 Parrot_new_vtable(SHIM_INTERP)
 {
+    ASSERT_ARGS(Parrot_new_vtable);
     return mem_allocate_zeroed_typed(VTABLE);
 }
 
@@ -57,6 +58,7 @@
 Parrot_clone_vtable(PARROT_INTERP, ARGIN(const VTABLE *base_vtable))
 {
     VTABLE * const new_vtable = mem_allocate_typed(VTABLE);
+    ASSERT_ARGS(Parrot_clone_vtable);
 
     STRUCT_COPY(new_vtable, base_vtable);
 
@@ -86,9 +88,9 @@
 void
 Parrot_destroy_vtable(PARROT_INTERP, ARGMOD(VTABLE *vtable))
 {
+    ASSERT_ARGS(Parrot_destroy_vtable);
     /* We sometimes get a type number allocated without any corresponding
      * vtable. E.g. if you load perl_group, perlscalar is this way.  */
-    PARROT_ASSERT(vtable);
 
     if (vtable->ro_variant_vtable) {
         VTABLE *ro_vtable = vtable->ro_variant_vtable;
@@ -126,6 +128,7 @@
 void
 parrot_alloc_vtables(PARROT_INTERP)
 {
+    ASSERT_ARGS(parrot_alloc_vtables);
     interp->vtables          = mem_allocate_n_zeroed_typed(PARROT_MAX_CLASSES, VTABLE *);
     interp->n_vtable_max     = enum_class_core_max;
     interp->n_vtable_alloced = PARROT_MAX_CLASSES - 1;
@@ -150,6 +153,7 @@
     const INTVAL new_max     = interp->n_vtable_alloced + 16;
     const INTVAL new_size    = new_max              * sizeof (VTABLE *);
     const INTVAL old_size    = interp->n_vtable_max * sizeof (VTABLE *);
+    ASSERT_ARGS(parrot_realloc_vtables);
 
     /* arrays start at zero, but we compare type numbers starting at 1 */
     interp->n_vtable_alloced = new_max - 1;
@@ -173,6 +177,7 @@
 parrot_free_vtables(PARROT_INTERP)
 {
     int i;
+    ASSERT_ARGS(parrot_free_vtables);
 
     for (i = 1; i < interp->n_vtable_max; i++)
         Parrot_destroy_vtable(interp, interp->vtables[i]);
@@ -194,6 +199,7 @@
 mark_vtables(PARROT_INTERP)
 {
     INTVAL i;
+    ASSERT_ARGS(mark_vtables);
 
     for (i = 1; i < interp->n_vtable_max; i++) {
         const VTABLE * const vtable = interp->vtables[i];

Modified: trunk/src/warnings.c
==============================================================================
--- trunk/src/warnings.c	(original)
+++ trunk/src/warnings.c	Wed Dec 31 11:20:05 2008
@@ -48,6 +48,7 @@
 print_pbc_location(PARROT_INTERP)
 {
     Interp * const tracer = interp->debugger ? interp->debugger : interp;
+    ASSERT_ARGS(print_pbc_location);
     Parrot_io_eprintf(tracer, "%Ss\n",
             Parrot_Context_infostr(interp,
                 CONTEXT(interp)));
@@ -66,6 +67,7 @@
 static INTVAL
 print_warning(PARROT_INTERP, ARGIN_NULLOK(STRING *msg))
 {
+    ASSERT_ARGS(print_warning);
     if (!msg)
         Parrot_io_puts(interp, Parrot_io_STDERR(interp), "Unknown warning\n");
     else {
@@ -102,7 +104,7 @@
 Parrot_warn(PARROT_INTERP, INTVAL warnclass,
             ARGIN(const char *message), ...)
 {
-    PARROT_ASSERT(interp);
+    ASSERT_ARGS(Parrot_warn);
     if (!PARROT_WARNINGS_test(interp, warnclass))
         return 2;
     else {



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About