develooper Front page | perl.cvs.parrot | Postings from January 2009

[svn:parrot] r34773 - trunk/src

From:
infinoid
Date:
January 1, 2009 15:55
Subject:
[svn:parrot] r34773 - trunk/src
Message ID:
20090101235411.08C09CB9FA@x12.develooper.com
Author: infinoid
Date: Thu Jan  1 15:54:09 2009
New Revision: 34773

Modified:
   trunk/src/debug.c
   trunk/src/dynext.c
   trunk/src/global.c
   trunk/src/inter_create.c
   trunk/src/list.c
   trunk/src/packfile.c
   trunk/src/spf_render.c

Log:
[core] Tag another couple hundred functions with argument asserts.

Modified: trunk/src/debug.c
==============================================================================
--- trunk/src/debug.c	(original)
+++ trunk/src/debug.c	Thu Jan  1 15:54:09 2009
@@ -609,7 +609,9 @@
 static void
 chop_newline(ARGMOD(char * buf))
 {
-    int l = strlen(buf);
+    int l;
+    ASSERT_ARGS(chop_newline);
+    l = strlen(buf);
     if (l > 0 && buf [l - 1] == '\n')
         buf [l - 1] = '\0';
 }
@@ -631,6 +633,7 @@
 static const char *
 nextarg(ARGIN_NULLOK(const char *command))
 {
+    ASSERT_ARGS(nextarg);
     /* as long as the character pointed to by command is not NULL,
      * and it is either alphanumeric, a comma or a closing bracket,
      * continue looking for the next argument.
@@ -661,6 +664,7 @@
 static const char *
 skip_command(ARGIN(const char *str))
 {
+    ASSERT_ARGS(skip_command);
     /* while str is not null and it contains a command (no spaces),
      * skip the character
      */
@@ -688,6 +692,7 @@
 parse_int(ARGIN(const char *str), ARGOUT(int *intP))
 {
     char *end;
+    ASSERT_ARGS(parse_int);
 
     *intP = strtol(str, &end, 0);
 
@@ -712,6 +717,7 @@
 parse_string(PARROT_INTERP, ARGIN(const char *str), ARGOUT(STRING **strP))
 {
     const char *string_start;
+    ASSERT_ARGS(parse_string);
 
     /* if this is not a quoted string, there's nothing to parse */
     if (*str != '"')
@@ -758,6 +764,7 @@
 static const char*
 parse_key(PARROT_INTERP, ARGIN(const char *str), ARGOUT(PMC **keyP))
 {
+    ASSERT_ARGS(parse_key);
     /* clear output parameter */
     *keyP = NULL;
 
@@ -812,6 +819,7 @@
 {
     int           i;
     unsigned long c = 0;
+    ASSERT_ARGS(parse_command);
 
     /* Skip leading whitespace. */
     command = skip_whitespace(command);
@@ -849,6 +857,7 @@
 static void
 debugger_cmdline(PARROT_INTERP)
 {
+    ASSERT_ARGS(debugger_cmdline);
     TRACEDEB_MSG("debugger_cmdline");
 
     /*while (!(interp->pdb->state & PDB_EXIT)) {*/
@@ -878,6 +887,7 @@
 static void
 close_script_file(PARROT_INTERP)
 {
+    ASSERT_ARGS(close_script_file);
     TRACEDEB_MSG("Closing debugger script file");
     if (interp->pdb->script_file) {
         fclose(interp->pdb->script_file);
@@ -902,6 +912,7 @@
 void
 Parrot_debugger_init(PARROT_INTERP)
 {
+    ASSERT_ARGS(Parrot_debugger_init);
     TRACEDEB_MSG("Parrot_debugger_init");
 
     if (! interp->pdb) {
@@ -940,6 +951,7 @@
        Free all debugger allocated resources.
      */
     PDB_t *pdb = interp->pdb;
+    ASSERT_ARGS(Parrot_debugger_destroy);
 
     TRACEDEB_MSG("Parrot_debugger_destroy");
 
@@ -968,6 +980,7 @@
 Parrot_debugger_load(PARROT_INTERP, ARGIN_NULLOK(STRING *filename))
 {
     char *file;
+    ASSERT_ARGS(Parrot_debugger_load);
 
     TRACEDEB_MSG("Parrot_debugger_load");
 
@@ -993,6 +1006,7 @@
 void
 Parrot_debugger_start(PARROT_INTERP, ARGIN(opcode_t * cur_opcode))
 {
+    ASSERT_ARGS(Parrot_debugger_start);
     TRACEDEB_MSG("Parrot_debugger_start");
 
     if (!interp->pdb)
@@ -1041,6 +1055,7 @@
 void
 Parrot_debugger_break(PARROT_INTERP, ARGIN(opcode_t * cur_opcode))
 {
+    ASSERT_ARGS(Parrot_debugger_break);
     TRACEDEB_MSG("Parrot_debugger_break");
 
     if (!interp->pdb)
@@ -1100,6 +1115,7 @@
     int           ch;
     char         *c;
     PDB_t        * const pdb = interp->pdb;
+    ASSERT_ARGS(PDB_get_command);
 
     /* flush the buffered data */
     fflush(stdout);
@@ -1185,6 +1201,7 @@
 PDB_script_file(PARROT_INTERP, ARGIN(const char *command))
 {
     FILE *fd;
+    ASSERT_ARGS(PDB_script_file);
 
     TRACEDEB_MSG("PDB_script_file");
 
@@ -1228,6 +1245,7 @@
     /* keep a pointer to the command, in case we need to report an error */
     /* get a number from what the user typed */
     const char * cmdline = parse_command(command, &c);
+    ASSERT_ARGS(PDB_run_command);
 
     TRACEDEB_MSG("PDB_run_command");
 
@@ -1278,6 +1296,7 @@
     unsigned long  n;
     PDB_t  * const pdb = interp->pdb;
     Interp *debugee;
+    ASSERT_ARGS(PDB_next);
 
     TRACEDEB_MSG("PDB_next");
 
@@ -1340,6 +1359,7 @@
     unsigned long  n;
     PDB_t *  const pdb = interp->pdb;
     Interp        *debugee;
+    ASSERT_ARGS(PDB_trace);
 
     TRACEDEB_MSG("PDB_trace");
 
@@ -1384,6 +1404,7 @@
 static unsigned short
 condition_regtype(ARGIN(const char *cmd))
 {
+    ASSERT_ARGS(condition_regtype);
     switch (*cmd) {
         case 'i':
         case 'I':
@@ -1423,6 +1444,7 @@
     unsigned short   cond_type;
     unsigned char    regleft;
     int              i, reg_number;
+    ASSERT_ARGS(PDB_cond);
 
     /* Return if no more arguments */
     if (!(command && *command)) {
@@ -1586,6 +1608,7 @@
 {
     PDB_t           * const pdb = interp->pdb;
     PDB_condition_t * const condition = PDB_cond(interp, command);
+    ASSERT_ARGS(PDB_watchpoint);
 
     if (!condition)
         return;
@@ -1618,6 +1641,7 @@
     opcode_t         *breakpos = NULL;
 
     unsigned long ln = get_ulong(& command, 0);
+    ASSERT_ARGS(PDB_set_break);
 
     TRACEDEB_MSG("PDB_set_break");
 
@@ -1734,6 +1758,7 @@
 PDB_init(PARROT_INTERP, SHIM(const char *command))
 {
     PDB_t * const pdb = interp->pdb;
+    ASSERT_ARGS(PDB_init);
 
     /* Restart if we are already running */
     if (pdb->state & PDB_RUNNING)
@@ -1759,6 +1784,7 @@
 {
     PDB_t * const pdb = interp->pdb;
     unsigned long ln = 0;
+    ASSERT_ARGS(PDB_continue);
 
     TRACEDEB_MSG("PDB_continue");
 
@@ -1817,6 +1843,7 @@
 {
     const char *oldcmd = command;
     const unsigned long n = get_ulong(&command, 0);
+    ASSERT_ARGS(PDB_find_breakpoint);
     if (command != oldcmd) {
         PDB_breakpoint_t *breakpoint = interp->pdb->breakpoint;
 
@@ -1855,6 +1882,7 @@
 PDB_disable_breakpoint(PARROT_INTERP, ARGIN(const char *command))
 {
     PDB_breakpoint_t * const breakpoint = PDB_find_breakpoint(interp, command);
+    ASSERT_ARGS(PDB_disable_breakpoint);
 
     /* if the breakpoint exists, disable it. */
     if (breakpoint)
@@ -1876,6 +1904,7 @@
 PDB_enable_breakpoint(PARROT_INTERP, ARGIN(const char *command))
 {
     PDB_breakpoint_t * const breakpoint = PDB_find_breakpoint(interp, command);
+    ASSERT_ARGS(PDB_enable_breakpoint);
 
     /* if the breakpoint exists, and it was disabled, enable it. */
     if (breakpoint && breakpoint->skip == -1)
@@ -1896,6 +1925,7 @@
 PDB_delete_breakpoint(PARROT_INTERP, ARGIN(const char *command))
 {
     PDB_breakpoint_t * const breakpoint = PDB_find_breakpoint(interp, command);
+    ASSERT_ARGS(PDB_delete_breakpoint);
 
     if (breakpoint) {
         const PDB_line_t *line = interp->pdb->file->line;
@@ -1943,6 +1973,7 @@
 void
 PDB_delete_condition(SHIM_INTERP, ARGMOD(PDB_breakpoint_t *breakpoint))
 {
+    ASSERT_ARGS(PDB_delete_condition);
     if (breakpoint->condition->value) {
         if (breakpoint->condition->type & PDB_cond_str) {
             /* 'value' is a string, so we need to be careful */
@@ -1975,6 +2006,7 @@
 void
 PDB_skip_breakpoint(PARROT_INTERP, unsigned long i)
 {
+    ASSERT_ARGS(PDB_skip_breakpoint);
 #if TRACE_DEBUGGER
         fprintf(stderr, "PDB_skip_breakpoint: %li\n", i);
 #endif
@@ -1996,6 +2028,7 @@
 PDB_program_end(PARROT_INTERP)
 {
     PDB_t * const pdb = interp->pdb;
+    ASSERT_ARGS(PDB_program_end);
 
     TRACEDEB_MSG("PDB_program_end");
 
@@ -2021,6 +2054,7 @@
 PDB_check_condition(PARROT_INTERP, ARGIN(const PDB_condition_t *condition))
 {
     Parrot_Context *ctx = CONTEXT(interp);
+    ASSERT_ARGS(PDB_check_condition);
 
     TRACEDEB_MSG("PDB_check_condition");
 
@@ -2131,6 +2165,7 @@
 current_breakpoint(ARGIN(PDB_t * pdb))
 {
     PDB_breakpoint_t *breakpoint = pdb->breakpoint;
+    ASSERT_ARGS(current_breakpoint);
     while (breakpoint) {
         if (pdb->cur_opcode == breakpoint->pc)
             break;
@@ -2156,6 +2191,7 @@
     PDB_t            * const pdb = interp->pdb;
     PDB_condition_t  *watchpoint = pdb->watchpoint;
     PDB_breakpoint_t *breakpoint;
+    ASSERT_ARGS(PDB_break);
 
     TRACEDEB_MSG("PDB_break");
 
@@ -2226,6 +2262,7 @@
 {
     const char *end;
     char       *_new, *fill;
+    ASSERT_ARGS(PDB_escape);
 
     length = length > 20 ? 20 : length;
     end    = string + length;
@@ -2291,6 +2328,7 @@
 PDB_unescape(ARGMOD(char *string))
 {
     int l = 0;
+    ASSERT_ARGS(PDB_unescape);
 
     for (; *string; string++) {
         l++;
@@ -2352,6 +2390,7 @@
 
     /* Write the opcode name */
     const char * p = full_name ? info->full_name : info->name;
+    ASSERT_ARGS(PDB_disassemble_op);
 
     TRACEDEB_MSG("PDB_disassemble_op");
 
@@ -2652,6 +2691,7 @@
     const unsigned int default_size = 32768;
     size_t space;  /* How much space do we have? */
     size_t size, alloced, n;
+    ASSERT_ARGS(PDB_disassemble);
 
     TRACEDEB_MSG("PDB_disassemble");
 
@@ -2745,6 +2785,7 @@
 {
     PDB_label_t *_new;
     PDB_label_t *label = file->label;
+    ASSERT_ARGS(PDB_add_label);
 
     /* See if there is already a label at this line */
     while (label) {
@@ -2787,6 +2828,7 @@
 void
 PDB_free_file(SHIM_INTERP, ARGIN_NULLOK(PDB_file_t *file))
 {
+    ASSERT_ARGS(PDB_free_file);
     while (file) {
         /* Free all of the allocated line structures */
         PDB_line_t  *line = file->line;
@@ -2845,6 +2887,7 @@
     opcode_t      *pc         = interp->code->base.data;
 
     unsigned long  size = 0;
+    ASSERT_ARGS(PDB_load_source);
 
     TRACEDEB_MSG("PDB_load_source");
 
@@ -2953,6 +2996,7 @@
 PDB_hasinstruction(ARGIN(const char *c))
 {
     char h = 0;
+    ASSERT_ARGS(PDB_hasinstruction);
 
     /* as long as c is not NULL, we're not looking at a comment (#...) or a '\n'... */
     while (*c && *c != '#' && *c != '\n') {
@@ -2991,6 +3035,7 @@
     PDB_line_t    *line;
     PDB_t         *pdb = interp->pdb;
     unsigned long  n   = 10;
+    ASSERT_ARGS(PDB_list);
 
     if (!pdb->file) {
         Parrot_io_eprintf(pdb->debugger, "No source file loaded\n");
@@ -3054,6 +3099,7 @@
 {
     /* This code is almost certainly wrong. The Parrot debugger needs love. */
     opcode_t *run = PDB_compile(interp, command);
+    ASSERT_ARGS(PDB_eval);
 
     if (run)
         DO_OP(run, interp);
@@ -3084,6 +3130,7 @@
     PMC *compreg_hash    = VTABLE_get_pmc_keyed_int(interp,
             interp->iglobals, IGLOBALS_COMPREG_HASH);
     PMC        *compiler = VTABLE_get_pmc_keyed_str(interp, compreg_hash, key);
+    ASSERT_ARGS(PDB_compile);
 
     if (!VTABLE_defined(interp, compiler)) {
         fprintf(stderr, "Couldn't find PASM compiler");
@@ -3109,6 +3156,7 @@
 static void
 dump_string(PARROT_INTERP, ARGIN_NULLOK(const STRING *s))
 {
+    ASSERT_ARGS(dump_string);
     if (!s)
         return;
 
@@ -3135,6 +3183,7 @@
 PDB_print(PARROT_INTERP, ARGIN(const char *command))
 {
     const char * const s = GDB_P(interp->pdb->debugee, command);
+    ASSERT_ARGS(PDB_print);
     Parrot_io_eprintf(interp, "%s\n", s);
 }
 
@@ -3152,6 +3201,7 @@
 void
 PDB_info(PARROT_INTERP)
 {
+    ASSERT_ARGS(PDB_info);
     Parrot_io_eprintf(interp, "Total memory allocated = %ld\n",
             interpinfo(interp, TOTAL_MEM_ALLOC));
     Parrot_io_eprintf(interp, "DOD runs = %ld\n",
@@ -3199,6 +3249,7 @@
 
     /* Extract the command after leading whitespace (for error messages). */
     const char * cmdline = skip_whitespace(command);
+    ASSERT_ARGS(PDB_help);
     parse_command(cmdline, &c);
 
     cmd = get_command(c);
@@ -3261,6 +3312,7 @@
     /* information about the current sub */
     PMC              *sub = interpinfo_p(interp, CURRENT_SUB);
     Parrot_Context   *ctx = CONTEXT(interp);
+    ASSERT_ARGS(PDB_backtrace);
 
     if (!PMC_IS_NULL(sub)) {
         str = Parrot_Context_infostr(interp, ctx);
@@ -3342,6 +3394,7 @@
 static const char*
 GDB_print_reg(PARROT_INTERP, int t, int n)
 {
+    ASSERT_ARGS(GDB_print_reg);
 
     if (n >= 0 && n < CONTEXT(interp)->n_regs_used[t]) {
         switch (t) {
@@ -3382,6 +3435,7 @@
 {
     int t;
     char reg_type;
+    ASSERT_ARGS(GDB_P);
 
     /* Skip leading whitespace. */
     while (isspace((unsigned char)*s))
@@ -3447,6 +3501,7 @@
 static int
 GDB_B(PARROT_INTERP, ARGIN(const char *s))
 {
+    ASSERT_ARGS(GDB_B);
     if ((unsigned long)s < 0x10000) {
         /* HACK alarm pb 45 is passed as the integer not a string */
         /* RT #46145 check if in bounds */

Modified: trunk/src/dynext.c
==============================================================================
--- trunk/src/dynext.c	(original)
+++ trunk/src/dynext.c	Thu Jan  1 15:54:09 2009
@@ -140,6 +140,7 @@
 {
     STRING * const key  = const_string(interp, what);
     PMC    * const prop = constant_pmc_new(interp, enum_class_String);
+    ASSERT_ARGS(set_cstring_prop);
 
     VTABLE_set_string_native(interp, prop, name);
     VTABLE_setprop(interp, lib_pmc, key, prop);
@@ -162,6 +163,7 @@
     PMC * const iglobals = interp->iglobals;
     PMC * const dyn_libs = VTABLE_get_pmc_keyed_int(interp, iglobals,
             IGLOBALS_DYN_LIBS);
+    ASSERT_ARGS(store_lib_pmc);
 
     /* remember path/file in props */
     set_cstring_prop(interp, lib_pmc, "_filename", path);  /* XXX */
@@ -192,6 +194,7 @@
     PMC * const iglobals = interp->iglobals;
     PMC * const dyn_libs = VTABLE_get_pmc_keyed_int(interp, iglobals,
             IGLOBALS_DYN_LIBS);
+    ASSERT_ARGS(is_loaded);
     if (!VTABLE_exists_keyed_str(interp, dyn_libs, path))
         return PMCNULL;
     return VTABLE_get_pmc_keyed_str(interp, dyn_libs, path);
@@ -222,6 +225,7 @@
                                                      IGLOBALS_LIB_PATHS);
     PMC * const share_ext = VTABLE_get_pmc_keyed_int(interp, lib_paths,
                                                      PARROT_LIB_DYN_EXTS);
+    ASSERT_ARGS(get_path);
 
     if (lib == NULL) {
         *handle = Parrot_dlopen((char *)NULL);
@@ -336,6 +340,7 @@
                 ARGIN_NULLOK(void (*init_func)(PARROT_INTERP, ARGIN_NULLOK(PMC *))))
 {
     PMC *lib_pmc = NULL;
+    ASSERT_ARGS(Parrot_init_lib);
 
     if (load_func)
         lib_pmc = (*load_func)(interp);
@@ -373,6 +378,7 @@
     void (*init_func)(PARROT_INTERP, PMC *);
     char *cinit_func_name;
     PMC *lib_pmc;
+    ASSERT_ARGS(run_init_lib);
 
     /*
      * work around gcc 3.3.3 and other problem with dynpmcs
@@ -452,6 +458,7 @@
         string_make_direct(d, raw_str, strlen(raw_str),
             PARROT_DEFAULT_ENCODING, PARROT_DEFAULT_CHARSET,
             PObj_constant_FLAG);
+    ASSERT_ARGS(clone_string_into);
     string_cstring_free(raw_str);
     return ret;
 }
@@ -474,6 +481,7 @@
     PMC * const ret = VTABLE_new_from_string(interp,
         interp->vtables[enum_class_String]->pmc_class,
         string, PObj_constant_FLAG);
+    ASSERT_ARGS(make_string_pmc);
     return ret;
 }
 
@@ -506,6 +514,7 @@
     void * const handle = PMC_data(lib_pmc);
     STRING * const type =
         VTABLE_get_string(s, VTABLE_getprop(s, lib_pmc, type_str));
+    ASSERT_ARGS(Parrot_clone_lib_into);
 
     if (!string_equal(s, type, ops)) {
         /* we can't clone oplibs in the normal way, since they're actually
@@ -578,6 +587,7 @@
     STRING *path;
     STRING *lib_name, *wo_ext, *ext;    /* library stem without path
                                          * or extension.  */
+    ASSERT_ARGS(Parrot_load_lib);
     /* Find the pure library name, without path or extension.  */
     /*
      * TODO move the class_count_mutex here

Modified: trunk/src/global.c
==============================================================================
--- trunk/src/global.c	(original)
+++ trunk/src/global.c	Thu Jan  1 15:54:09 2009
@@ -120,6 +120,7 @@
 {
     PMC *ns = base_ns;
     INTVAL i, n;
+    ASSERT_ARGS(internal_ns_keyed);
 
     if (pmc_key->vtable->base_type == enum_class_String) {
         STRING *str_key = VTABLE_get_string(interp, pmc_key);
@@ -174,6 +175,7 @@
     ARGIN(STRING *key), int flags)
 {
     PMC *ns = VTABLE_get_pmc_keyed_str(interp, base_ns, key);
+    ASSERT_ARGS(internal_ns_keyed_str);
 
     if (!PMC_IS_NULL(ns) && VTABLE_isa(interp, ns, CONST_STRING(interp, "NameSpace")))
         return ns;
@@ -197,6 +199,7 @@
 static PMC *
 internal_ns_keyed_key(PARROT_INTERP, ARGIN(PMC *ns), ARGIN(PMC *key), int flags)
 {
+    ASSERT_ARGS(internal_ns_keyed_key);
     while (key) {
         STRING *part   = VTABLE_get_string(interp, key);
         PMC    *sub_ns = VTABLE_get_pmc_keyed_str(interp, ns, part);
@@ -235,6 +238,7 @@
 internal_ns_maybe_create(PARROT_INTERP, ARGIN(PMC *ns), ARGIN(STRING *key), int flags)
 {
     PMC *sub_ns;
+    ASSERT_ARGS(internal_ns_maybe_create);
 
     /* RT #46157 - stop depending on typed namespace */
     if (!(flags & INTERN_NS_CREAT))
@@ -271,6 +275,7 @@
 PMC *
 Parrot_get_namespace_keyed(PARROT_INTERP, ARGIN(PMC *base_ns), ARGIN_NULLOK(PMC *pmc_key))
 {
+    ASSERT_ARGS(Parrot_get_namespace_keyed);
     return internal_ns_keyed(interp, base_ns, pmc_key, 0);
 }
 
@@ -292,6 +297,7 @@
 Parrot_get_namespace_keyed_str(PARROT_INTERP, ARGIN(PMC *base_ns),
         ARGIN_NULLOK(STRING *str_key))
 {
+    ASSERT_ARGS(Parrot_get_namespace_keyed_str);
     return internal_ns_keyed_str(interp, base_ns, str_key, 0);
 }
 
@@ -314,6 +320,7 @@
 Parrot_make_namespace_keyed(PARROT_INTERP, ARGIN(PMC *base_ns),
         ARGIN_NULLOK(PMC *pmc_key))
 {
+    ASSERT_ARGS(Parrot_make_namespace_keyed);
     return internal_ns_keyed(interp, base_ns, pmc_key, INTERN_NS_CREAT);
 }
 
@@ -336,6 +343,7 @@
 Parrot_make_namespace_keyed_str(PARROT_INTERP, ARGIN(PMC *base_ns),
         ARGIN_NULLOK(STRING *str_key))
 {
+    ASSERT_ARGS(Parrot_make_namespace_keyed_str);
     return internal_ns_keyed_str(interp, base_ns, str_key, INTERN_NS_CREAT);
 }
 
@@ -360,6 +368,7 @@
 Parrot_make_namespace_autobase(PARROT_INTERP, ARGIN_NULLOK(PMC *key))
 {
     PMC *base_ns;
+    ASSERT_ARGS(Parrot_make_namespace_autobase);
     if (VTABLE_isa(interp, key, CONST_STRING(interp, "String")))
         base_ns = CONTEXT(interp)->current_namespace;
     else
@@ -388,6 +397,7 @@
 Parrot_get_namespace_autobase(PARROT_INTERP, ARGIN_NULLOK(PMC *key))
 {
     PMC *base_ns;
+    ASSERT_ARGS(Parrot_get_namespace_autobase);
     if (VTABLE_isa(interp, key, CONST_STRING(interp, "String")))
         base_ns = CONTEXT(interp)->current_namespace;
     else
@@ -413,6 +423,7 @@
 Parrot_ns_get_name(PARROT_INTERP, ARGIN(PMC *_namespace))
 {
     PMC *names;
+    ASSERT_ARGS(Parrot_ns_get_name);
     Parrot_PCCINVOKE(interp, _namespace, CONST_STRING(interp, "get_name"), "->P", &names);
     return names;
 }
@@ -455,6 +466,7 @@
 PMC *
 Parrot_get_global(PARROT_INTERP, ARGIN_NULLOK(PMC *ns), ARGIN_NULLOK(STRING *globalname))
 {
+    ASSERT_ARGS(Parrot_get_global);
     if (PMC_IS_NULL(ns))
         return PMCNULL;
 
@@ -476,6 +488,7 @@
 Parrot_set_global(PARROT_INTERP, ARGIN_NULLOK(PMC *ns),
         ARGIN_NULLOK(STRING *globalname), ARGIN_NULLOK(PMC *val))
 {
+    ASSERT_ARGS(Parrot_set_global);
     VTABLE_set_pmc_keyed_str(interp, ns, globalname, val);
 }
 
@@ -501,6 +514,7 @@
 Parrot_find_global_n(PARROT_INTERP, ARGIN_NULLOK(PMC *ns), ARGIN_NULLOK(STRING *globalname))
 {
     PMC *res;
+    ASSERT_ARGS(Parrot_find_global_n);
 
 #if DEBUG_GLOBAL
     if (globalname)
@@ -540,6 +554,7 @@
 Parrot_find_global_cur(PARROT_INTERP, ARGIN_NULLOK(STRING *globalname))
 {
     PMC * const ns = CONTEXT(interp)->current_namespace;
+    ASSERT_ARGS(Parrot_find_global_cur);
     return Parrot_find_global_n(interp, ns, globalname);
 }
 
@@ -568,6 +583,7 @@
         Parrot_get_namespace_keyed(interp,
                                    Parrot_get_ctx_HLL_namespace(interp),
                                    pmc_key);
+    ASSERT_ARGS(Parrot_find_global_k);
     return Parrot_find_global_n(interp, ns, globalname);
 }
 
@@ -597,6 +613,7 @@
         Parrot_get_namespace_keyed_str(interp,
                                        Parrot_get_ctx_HLL_namespace(interp),
                                        str_key);
+    ASSERT_ARGS(Parrot_find_global_s);
     return Parrot_find_global_n(interp, ns, globalname);
 }
 
@@ -615,6 +632,7 @@
 Parrot_store_global_n(PARROT_INTERP, ARGIN_NULLOK(PMC *ns),
         ARGIN_NULLOK(STRING *globalname), ARGIN_NULLOK(PMC *val))
 {
+    ASSERT_ARGS(Parrot_store_global_n);
 #if DEBUG_GLOBAL
     if (globalname)
         Parrot_io_printf(interp, "store_global name '%Ss'\n", globalname);
@@ -641,6 +659,7 @@
 Parrot_store_global_cur(PARROT_INTERP, ARGIN_NULLOK(STRING *globalname),
         ARGIN_NULLOK(PMC *val))
 {
+    ASSERT_ARGS(Parrot_store_global_cur);
     Parrot_store_global_n(interp,
                           CONTEXT(interp)->current_namespace,
                           globalname, val);
@@ -669,6 +688,7 @@
         ARGIN_NULLOK(STRING *globalname), ARGIN_NULLOK(PMC *val))
 {
     PMC *ns;
+    ASSERT_ARGS(Parrot_store_global_k);
 
     /*
      * RT #46167 - temporary hack to notice when key is actually a string, so that
@@ -709,6 +729,7 @@
     PMC * const ns = Parrot_make_namespace_keyed_str(interp,
                                          Parrot_get_ctx_HLL_namespace(interp),
                                          str_key);
+    ASSERT_ARGS(Parrot_store_global_s);
 
     Parrot_store_global_n(interp, ns, globalname, val);
 
@@ -736,6 +757,7 @@
         ARGIN_NULLOK(STRING *globalname), ARGIN_NULLOK(void *next))
 {
     PMC *res;
+    ASSERT_ARGS(Parrot_find_global_op);
 
     if (!globalname)
         Parrot_ex_throw_from_c_args(interp, next, EXCEPTION_GLOBAL_NOT_FOUND,
@@ -772,6 +794,7 @@
     Parrot_Context * const ctx = CONTEXT(interp);
     PMC * const lex_pad = Parrot_find_pad(interp, name, ctx);
     PMC *g;
+    ASSERT_ARGS(Parrot_find_name_op);
 
     if (PMC_IS_NULL(lex_pad))
         g = PMCNULL;
@@ -810,6 +833,7 @@
 {
     PMC * const nsname = PMC_sub(sub)->namespace_name;
     PMC * const nsroot = Parrot_get_HLL_namespace(interp, PMC_sub(sub)->HLL_id);
+    ASSERT_ARGS(get_namespace_pmc);
 
     /* If we have a NULL, return the HLL namespace */
     if (PMC_IS_NULL(nsname))
@@ -838,6 +862,7 @@
 {
     STRING * const ns_entry_name = PMC_sub(sub)->ns_entry_name;
     PMC    *multisub = VTABLE_get_pmc_keyed_str(interp, ns, ns_entry_name);
+    ASSERT_ARGS(store_sub_in_multi);
 
     /* is there an existing MultiSub PMC? or do we need to create one? */
     if (PMC_IS_NULL(multisub)) {
@@ -869,6 +894,7 @@
     const INTVAL cur_id = CONTEXT(interp)->current_HLL;
 
     PMC *ns;
+    ASSERT_ARGS(Parrot_store_sub_in_namespace);
     /* PF structures aren't fully constructed yet */
     Parrot_block_GC_mark(interp);
     /* store relative to HLL namespace */

Modified: trunk/src/inter_create.c
==============================================================================
--- trunk/src/inter_create.c	(original)
+++ trunk/src/inter_create.c	Thu Jan  1 15:54:09 2009
@@ -67,6 +67,7 @@
 {
     int free_it, retval;
     char* const value = Parrot_getenv(var, &free_it);
+    ASSERT_ARGS(is_env_var_set);
     if (value == NULL)
         retval = 0;
     else if (*value == '\0')
@@ -92,6 +93,7 @@
 setup_default_compreg(PARROT_INTERP)
 {
     STRING * const pasm1 = CONST_STRING(interp, "PASM1");
+    ASSERT_ARGS(setup_default_compreg);
 
     /* register the nci compiler object */
     Parrot_compreg(interp, pasm1, (Parrot_compiler_func_t)PDB_compile);
@@ -113,6 +115,7 @@
 make_interpreter(ARGIN_NULLOK(Interp *parent), INTVAL flags)
 {
     Interp *interp;
+    ASSERT_ARGS(make_interpreter);
 
     /* Get an empty interpreter from system memory */
 #if EXEC_CAPABLE
@@ -288,6 +291,7 @@
 void
 Parrot_destroy(PARROT_INTERP)
 {
+    ASSERT_ARGS(Parrot_destroy);
 #ifdef ATEXIT_DESTROY
     UNUSED(interp);
 #else
@@ -311,6 +315,7 @@
 void
 Parrot_really_destroy(PARROT_INTERP, SHIM(int exit_code), SHIM(void *arg))
 {
+    ASSERT_ARGS(Parrot_really_destroy);
     /* wait for threads to complete if needed; terminate the event loop */
     if (!interp->parent_interpreter) {
         Parrot_cx_runloop_end(interp);

Modified: trunk/src/list.c
==============================================================================
--- trunk/src/list.c	(original)
+++ trunk/src/list.c	Thu Jan  1 15:54:09 2009
@@ -343,6 +343,7 @@
 allocate_chunk(PARROT_INTERP, ARGIN(List *list), UINTVAL items, UINTVAL size)
 {
     List_chunk *chunk;
+    ASSERT_ARGS(allocate_chunk);
 
     Parrot_block_GC_mark(interp);
     /*Parrot_block_GC_sweep(interp); - why */
@@ -380,6 +381,7 @@
     List_chunk *chunk, *prev;
     UINTVAL len = 0, start = list->start;
     UINTVAL cap;
+    ASSERT_ARGS(rebuild_chunk_ptrs);
 
     cap = 0;
     for (prev = 0, chunk = list->first; chunk; chunk = chunk->next) {
@@ -429,6 +431,7 @@
     List_chunk *chunk = list->first;
     List_chunk *prev = NULL;
     int changes = 0;
+    ASSERT_ARGS(rebuild_sparse);
 
     for (; chunk; chunk = chunk->next) {
         if (prev && (prev->flags & sparse) &&
@@ -460,6 +463,7 @@
     List_chunk *chunk = list->first;
     List_chunk *prev = NULL;
     int changes = 0;
+    ASSERT_ARGS(rebuild_other);
 
     for (; chunk; chunk = chunk->next) {
         /* two adjacent irregular chunks */
@@ -526,6 +530,7 @@
 rebuild_fix_ends(ARGMOD(List *list))
 {
     List_chunk * const chunk = list->first;
+    ASSERT_ARGS(rebuild_fix_ends);
 
     /* first is irregular, next is empty */
     if (list->n_chunks <= 2 && (chunk->flags & no_power_2) &&
@@ -557,6 +562,7 @@
 {
     List_chunk *chunk, *prev, *first;
     UINTVAL len;
+    ASSERT_ARGS(rebuild_chunk_list);
 
     Parrot_block_GC_mark(interp);
     Parrot_block_GC_sweep(interp);
@@ -674,6 +680,7 @@
     List_chunk *new_chunk;
     const int much = idx - list->cap >= MIN_ITEMS;
     int do_sparse = (INTVAL)idx - (INTVAL)list->cap >= 10 * MAX_ITEMS;
+    ASSERT_ARGS(alloc_next_size);
 
     if (list->item_type == enum_type_sized) {
         do_sparse = 0;
@@ -775,6 +782,7 @@
 {
     List_chunk * const chunk = where ? list->last : list->first;
     List_chunk * const new_chunk = alloc_next_size(interp, list, where, idx);
+    ASSERT_ARGS(add_chunk);
 
     if (where) {                /* at end */
         if (chunk)
@@ -812,6 +820,7 @@
 ld(UINTVAL x)
 {
     UINTVAL m;                  /* bit position of highest set bit of m */
+    ASSERT_ARGS(ld);
 
     /* On intel, use BSRL instruction to find highest bit */
 #if defined(__GNUC__) && defined(i386)
@@ -906,6 +915,7 @@
 {
     List_chunk *chunk;
     UINTVAL i;
+    ASSERT_ARGS(get_chunk);
 
 #ifndef GC_IS_MALLOC
     if (list->collect_runs != interp->arena_base->collect_runs)
@@ -1023,6 +1033,7 @@
 static void
 split_chunk(PARROT_INTERP, ARGMOD(List *list), ARGMOD(List_chunk *chunk), UINTVAL ix)
 {
+    ASSERT_ARGS(split_chunk);
     /* allocate space at idx */
     if (chunk->items <= MAX_ITEMS) {
         /* it fits, just allocate */
@@ -1090,6 +1101,7 @@
 {
     const INTVAL oidx = idx;
     List_chunk *chunk = get_chunk(interp, list, (UINTVAL *)&idx);
+    ASSERT_ARGS(list_set);
 
     PARROT_ASSERT(chunk);
     /* if this is a sparse chunk: split in possibly 2 sparse parts before and
@@ -1157,6 +1169,7 @@
 list_item(PARROT_INTERP, ARGMOD(List *list), int type, INTVAL idx)
 {
     List_chunk * const chunk = get_chunk(interp, list, (UINTVAL *)&idx);
+    ASSERT_ARGS(list_item);
     /* if this is a sparse chunk return -1, the caller may decide to return 0
      * or undef or whatever */
     if (chunk->flags & sparse) {
@@ -1205,6 +1218,7 @@
 static void
 list_append(PARROT_INTERP, ARGMOD(List *list), ARGIN_NULLOK(void *item), int type, UINTVAL idx)
 {
+    ASSERT_ARGS(list_append);
     /* initially, list may be empty, also used by assign */
     while (idx >= list->cap)
         add_chunk(interp, list, enum_add_at_end, idx);
@@ -1237,6 +1251,7 @@
 list_new(PARROT_INTERP, PARROT_DATA_TYPE type)
 {
     List * const list = (List *)new_bufferlike_header(interp, sizeof (*list));
+    ASSERT_ARGS(list_new);
 
     list->item_type = type;
     switch (type) {
@@ -1284,6 +1299,7 @@
 list_pmc_new(PARROT_INTERP, ARGMOD(PMC *container))
 {
     List * const l = list_new(interp, enum_type_PMC);
+    ASSERT_ARGS(list_pmc_new);
     l->container = container;
     PMC_data(container) = l;
 }
@@ -1321,6 +1337,7 @@
     INTVAL items_per_chunk = 0;
 
     INTVAL i, len;
+    ASSERT_ARGS(list_new_init);
 
     if (!init->vtable)
         Parrot_ex_throw_from_c_args(interp, NULL, 1,
@@ -1401,6 +1418,7 @@
 list_pmc_new_init(PARROT_INTERP, ARGMOD(PMC *container), ARGIN(PMC *init))
 {
     List * const l = list_new_init(interp, enum_type_PMC, init);
+    ASSERT_ARGS(list_pmc_new_init);
     l->container = container;
     PMC_data(container) = l;
     /*
@@ -1432,6 +1450,7 @@
     UINTVAL i;
     PMC *op;
     STRING *s;
+    ASSERT_ARGS(list_clone);
 
     Parrot_block_GC_mark(interp);
     Parrot_block_GC_sweep(interp);
@@ -1502,6 +1521,7 @@
 list_mark(PARROT_INTERP, ARGMOD(List *list))
 {
     List_chunk *chunk;
+    ASSERT_ARGS(list_mark);
 
     for (chunk = list->first; chunk; chunk = chunk->next) {
         pobject_lives(interp, (PObj *)chunk);
@@ -1545,6 +1565,7 @@
     UINTVAL idx;
 
     const UINTVAL n = list_length(interp, list);
+    ASSERT_ARGS(list_visit);
     PARROT_ASSERT(list->item_type == enum_type_PMC);
     /* TODO intlist ... */
     for (idx = 0, chunk = list->first; chunk; chunk = chunk->next) {
@@ -1578,6 +1599,7 @@
 INTVAL
 list_length(SHIM_INTERP, ARGIN(const List *list))
 {
+    ASSERT_ARGS(list_length);
     return list->length;
 }
 
@@ -1595,6 +1617,7 @@
 void
 list_set_length(PARROT_INTERP, ARGMOD(List *list), INTVAL len)
 {
+    ASSERT_ARGS(list_set_length);
     if (len < 0)
         len += list->length;
     if (len >= 0) {
@@ -1635,6 +1658,7 @@
 list_insert(PARROT_INTERP, ARGMOD(List *list), INTVAL idx, INTVAL n_items)
 {
     List_chunk *chunk;
+    ASSERT_ARGS(list_insert);
 
     PARROT_ASSERT(idx >= 0);
     idx += list->start;
@@ -1708,6 +1732,7 @@
 list_delete(PARROT_INTERP, ARGMOD(List *list), INTVAL idx, INTVAL n_items)
 {
     List_chunk *chunk;
+    ASSERT_ARGS(list_delete);
 
     PARROT_ASSERT(idx >= 0);
     PARROT_ASSERT(n_items >= 0);
@@ -1790,6 +1815,7 @@
 list_push(PARROT_INTERP, ARGMOD(List *list), ARGIN_NULLOK(void *item), int type)
 {
     const INTVAL idx = list->start + list->length++;
+    ASSERT_ARGS(list_push);
 
     list_append(interp, list, item, type, idx);
 }
@@ -1809,6 +1835,7 @@
 list_unshift(PARROT_INTERP, ARGMOD(List *list), ARGIN(void *item), int type)
 {
     List_chunk *chunk;
+    ASSERT_ARGS(list_unshift);
 
     if (list->start == 0) {
         chunk = add_chunk(interp, list, enum_add_at_start, 0);
@@ -1838,6 +1865,7 @@
     UINTVAL idx;
     void *ret;
     List_chunk *chunk = list->last;
+    ASSERT_ARGS(list_pop);
 
     if (list->length == 0)
         return NULL;
@@ -1876,6 +1904,7 @@
     void *ret;
     UINTVAL idx;
     List_chunk *chunk = list->first;
+    ASSERT_ARGS(list_shift);
 
     if (list->length == 0)
         return NULL;
@@ -1912,6 +1941,7 @@
 list_assign(PARROT_INTERP, ARGMOD(List *list), INTVAL idx, ARGIN_NULLOK(void *item), int type)
 {
     const INTVAL length = list->length;
+    ASSERT_ARGS(list_assign);
 
     if (idx < -length)
         idx = -idx - length - 1;
@@ -1943,6 +1973,7 @@
 list_get(PARROT_INTERP, ARGMOD(List *list), INTVAL idx, int type)
 {
     const INTVAL length = list->length;
+    ASSERT_ARGS(list_get);
 
     if (idx >= length || -idx > length) {
         return NULL;
@@ -1975,6 +2006,7 @@
     const INTVAL length = list->length;
     const int type = list->item_type;
     INTVAL i, j;
+    ASSERT_ARGS(list_splice);
 
     if (value_list && type != value_list->item_type)
         Parrot_ex_throw_from_c_args(interp, NULL, 1,

Modified: trunk/src/packfile.c
==============================================================================
--- trunk/src/packfile.c	(original)
+++ trunk/src/packfile.c	Thu Jan  1 15:54:09 2009
@@ -423,6 +423,7 @@
 void
 PackFile_destroy(PARROT_INTERP, ARGMOD_NULLOK(PackFile *pf))
 {
+    ASSERT_ARGS(PackFile_destroy);
     if (!pf) {
         Parrot_io_eprintf(NULL, "PackFile_destroy: pf == NULL!\n");
         return;
@@ -463,6 +464,7 @@
 make_code_pointers(ARGMOD(PackFile_Segment *seg))
 {
     PackFile * const pf = seg->pf;
+    ASSERT_ARGS(make_code_pointers);
 
     switch (seg->type) {
         case PF_BYTEC_SEG:
@@ -512,6 +514,7 @@
     int todo    = 0;
     int pragmas = PObj_get_FLAGS(sub_pmc) &  SUB_FLAG_PF_MASK
                                           & ~SUB_FLAG_IS_OUTER;
+    ASSERT_ARGS(sub_pragma);
 
     if (!pragmas && !Sub_comp_INIT_TEST(sub_pmc))
         return 0;
@@ -560,6 +563,7 @@
 {
     const INTVAL old = interp->run_core;
     PMC *retval;
+    ASSERT_ARGS(run_sub);
 
     /*
      * turn off JIT and prederef - both would act on the whole
@@ -595,6 +599,7 @@
 do_1_sub_pragma(PARROT_INTERP, ARGMOD(PMC *sub_pmc), pbc_action_enum_t action)
 {
     Parrot_sub const *sub = PMC_sub(sub_pmc);
+    ASSERT_ARGS(do_1_sub_pragma);
 
     switch (action) {
         case PBC_IMMEDIATE:
@@ -689,6 +694,7 @@
 {
     opcode_t i;
     PackFile_Constant ** const constants = find_constants(interp, ct);
+    ASSERT_ARGS(mark_1_seg);
 
     for (i = 0; i < ct->const_count; i++) {
         if (constants[i]->type == PFC_PMC) {
@@ -714,6 +720,7 @@
 find_const_iter(PARROT_INTERP, ARGIN(PackFile_Segment *seg),
                                ARGIN_NULLOK(void *user_data))
 {
+    ASSERT_ARGS(find_const_iter);
     if (seg->type == PF_DIR_SEG)
         PackFile_map_segments(interp, (const PackFile_Directory *)seg,
                 find_const_iter, user_data);
@@ -740,6 +747,7 @@
     PackFile_Directory *dir;
 
     PackFile * const self = interp->initial_pf;
+    ASSERT_ARGS(mark_const_subs);
 
     if (!self)
         return;
@@ -772,6 +780,7 @@
     opcode_t i;
     PackFile_FixupTable * const ft = self->fixups;
     PackFile_ConstTable * const ct = self->const_table;
+    ASSERT_ARGS(do_sub_pragmas);
 
 #if TRACE_PACKFILE
     Parrot_io_eprintf(NULL, "PackFile: do_sub_pragmas (action=%d)\n", action);
@@ -843,6 +852,7 @@
     const opcode_t         *cursor;
     int                     header_read_length;
     opcode_t                padding;
+    ASSERT_ARGS(PackFile_unpack);
 
     self->src  = packed;
     self->size = packed_size;
@@ -998,6 +1008,7 @@
                        ARGIN_NULLOK(void *user_data))
 {
     size_t i;
+    ASSERT_ARGS(PackFile_map_segments);
 
     for (i = 0; i < dir->num_segments; i++) {
         const INTVAL ret = callback(interp, dir->segments[i], user_data);
@@ -1025,6 +1036,7 @@
 PackFile_add_segment(SHIM_INTERP, ARGMOD(PackFile_Directory *dir),
         ARGIN(PackFile_Segment *seg))
 {
+    ASSERT_ARGS(PackFile_add_segment);
     mem_realloc_n_typed(dir->segments, dir->num_segments+1, PackFile_Segment *);
     dir->segments[dir->num_segments] = seg;
     dir->num_segments++;
@@ -1053,6 +1065,7 @@
 PackFile_find_segment(PARROT_INTERP, ARGIN_NULLOK(PackFile_Directory *dir),
     ARGIN(const char *name), int sub_dir)
 {
+    ASSERT_ARGS(PackFile_find_segment);
     if (dir) {
         size_t i;
 
@@ -1097,6 +1110,7 @@
                                 ARGIN(const char *name))
 {
     size_t i;
+    ASSERT_ARGS(PackFile_remove_segment_by_name);
 
     for (i = 0; i < dir->num_segments; i++) {
         PackFile_Segment * const seg = dir->segments[i];
@@ -1136,6 +1150,7 @@
 static void
 PackFile_set_header(ARGOUT(PackFile_Header *header))
 {
+    ASSERT_ARGS(PackFile_set_header);
     memcpy(header->magic, "\376PBC\r\n\032\n", 8);
     header->wordsize    = sizeof (opcode_t);
     header->byteorder   = PARROT_BIGENDIAN;
@@ -1207,6 +1222,7 @@
 PackFile_new(PARROT_INTERP, INTVAL is_mapped)
 {
     PackFile * const pf = mem_allocate_zeroed_typed(PackFile);
+    ASSERT_ARGS(PackFile_new);
     pf->header          = mem_allocate_zeroed_typed(PackFile_Header);
     pf->is_mmap_ped     = is_mapped;
 
@@ -1250,6 +1266,7 @@
 PackFile_new_dummy(PARROT_INTERP, ARGIN(const char *name))
 {
     PackFile * const pf = PackFile_new(interp, 0);
+    ASSERT_ARGS(PackFile_new_dummy);
     /* XXX PackFile_new needs to die on NULL, or else we have to check here */
 
     interp->initial_pf = pf;
@@ -1274,6 +1291,7 @@
 PackFile_funcs_register(SHIM_INTERP, ARGOUT(PackFile *pf), UINTVAL type,
                         const PackFile_funcs funcs)
 {
+    ASSERT_ARGS(PackFile_funcs_register);
     /* TODO dynamic registering */
     pf->PackFuncs[type] = funcs;
     return 1;
@@ -1296,6 +1314,7 @@
 default_unpack(ARGMOD(PackFile_Segment *self), ARGIN(const opcode_t *cursor))
 {
     DECL_CONST_CAST_OF(opcode_t);
+    ASSERT_ARGS(default_unpack);
 
     self->op_count = PF_fetch_opcode(self->pf, &cursor);
     self->itype    = PF_fetch_opcode(self->pf, &cursor);
@@ -1355,6 +1374,7 @@
 void
 default_dump_header(PARROT_INTERP, ARGIN(const PackFile_Segment *self))
 {
+    ASSERT_ARGS(default_dump_header);
     Parrot_io_printf(interp, "%s => [ # offs 0x%x(%d)",
             self->name, (int)self->file_offset, (int)self->file_offset);
     Parrot_io_printf(interp, " = op_count %d, itype %d, id %d, size %d, ...",
@@ -1377,6 +1397,7 @@
 default_dump(PARROT_INTERP, ARGIN(const PackFile_Segment *self))
 {
     size_t i = self->data ? 0: self->file_offset + 4;
+    ASSERT_ARGS(default_dump);
 
     default_dump_header(interp, self);
 
@@ -1463,6 +1484,7 @@
         pf_debug_unpack,
         pf_debug_dump
     };
+    ASSERT_ARGS(pf_register_standard_funcs);
     PackFile_funcs_register(interp, pf, PF_DIR_SEG,     dirf);
     PackFile_funcs_register(interp, pf, PF_UNKNOWN_SEG, defaultf);
     PackFile_funcs_register(interp, pf, PF_FIXUP_SEG,   fixupf);
@@ -1494,6 +1516,7 @@
     PackFile * const                  pf  = dir->base.pf;
     const PackFile_Segment_new_func_t f   = pf->PackFuncs[type].new_seg;
     PackFile_Segment * const          seg = (f)(interp, pf, name, add);
+    ASSERT_ARGS(PackFile_Segment_new_seg);
 
     segment_init(seg, pf, name);
     seg->type = type;
@@ -1525,6 +1548,7 @@
 
     const size_t len = strlen(name) + strlen(file_name) + 2;
     char * const buf = (char *)mem_sys_allocate(len);
+    ASSERT_ARGS(create_seg);
 
     snprintf(buf, len, "%s_%s", name, file_name);
     seg = PackFile_Segment_new_seg(interp, dir, t, buf, add);
@@ -1555,6 +1579,7 @@
     PackFile_ByteCode * const cur_cs =
         (PackFile_ByteCode *)create_seg(interp, &pf->directory,
             PF_BYTEC_SEG, BYTE_CODE_SEGMENT_NAME, file_name, add);
+    ASSERT_ARGS(PF_create_default_segs);
 
     cur_cs->fixups       =
         (PackFile_FixupTable *)create_seg(interp, &pf->directory,
@@ -1591,6 +1616,7 @@
 {
     const PackFile_Segment_destroy_func_t f =
         self->pf->PackFuncs[self->type].destroy;
+    ASSERT_ARGS(PackFile_Segment_destroy);
 
     if (f)
         (f)(interp, self);
@@ -1618,6 +1644,7 @@
     const size_t align                    = 16 / sizeof (opcode_t);
     PackFile_Segment_packed_size_func_t f =
         self->pf->PackFuncs[self->type].packed_size;
+    ASSERT_ARGS(PackFile_Segment_packed_size);
 
     if (f)
         size += (f)(interp, self);
@@ -1650,6 +1677,7 @@
     const size_t align             = 16 / sizeof (opcode_t);
     PackFile_Segment_pack_func_t f =
         self->pf->PackFuncs[self->type].pack;
+    ASSERT_ARGS(PackFile_Segment_pack);
 
     cursor = default_pack(self, cursor);
 
@@ -1683,6 +1711,7 @@
         ARGIN(const opcode_t *cursor))
 {
     PackFile_Segment_unpack_func_t f = self->pf->PackFuncs[self->type].unpack;
+    ASSERT_ARGS(PackFile_Segment_unpack);
 
     cursor = default_unpack(self, cursor);
 
@@ -1714,6 +1743,7 @@
 void
 PackFile_Segment_dump(PARROT_INTERP, ARGIN(PackFile_Segment *self))
 {
+    ASSERT_ARGS(PackFile_Segment_dump);
     self->pf->PackFuncs[self->type].dump(interp, self);
 }
 
@@ -1739,6 +1769,7 @@
 static PackFile_Segment *
 directory_new(SHIM_INTERP, SHIM(PackFile *pf), SHIM(const char *name), SHIM(int add))
 {
+    ASSERT_ARGS(directory_new);
 
     return (PackFile_Segment *)mem_allocate_zeroed_typed(PackFile_Directory);
 }
@@ -1759,6 +1790,7 @@
 {
     const PackFile_Directory * const dir = (const PackFile_Directory *) self;
     size_t i;
+    ASSERT_ARGS(directory_dump);
 
     default_dump_header(interp, self);
 
@@ -1803,6 +1835,7 @@
     PackFile           * const pf  = dir->base.pf;
     const opcode_t            *pos;
     size_t                     i;
+    ASSERT_ARGS(directory_unpack);
 
     dir->num_segments = PF_fetch_opcode(pf, &cursor);
     mem_realloc_n_typed(dir->segments, dir->num_segments, PackFile_Segment *);
@@ -1938,6 +1971,7 @@
 {
     PackFile_Directory * const dir = (PackFile_Directory *)self;
     size_t i;
+    ASSERT_ARGS(directory_destroy);
 
     for (i = 0; i < dir->num_segments; i++)
         PackFile_Segment_destroy(interp, dir->segments[i]);
@@ -1964,6 +1998,7 @@
 {
     const size_t      num_segs = dir->num_segments;
     PackFile_Segment *seg      = dir->segments[0];
+    ASSERT_ARGS(sort_segs);
 
     if (seg->type != PF_BYTEC_SEG) {
         size_t i;
@@ -2012,6 +2047,7 @@
     PackFile_Directory * const dir   = (PackFile_Directory *)self;
     const size_t               align = 16 / sizeof (opcode_t);
     size_t size, i;
+    ASSERT_ARGS(directory_packed_size);
 
     /* need bytecode, fixup, other segs ... */
     sort_segs(dir);
@@ -2065,6 +2101,7 @@
     size_t i;
     size_t align;
     const size_t num_segs = dir->num_segments;
+    ASSERT_ARGS(directory_pack);
 
     *cursor++ = num_segs;
 
@@ -2109,6 +2146,7 @@
 segment_init(ARGOUT(PackFile_Segment *self), ARGIN(PackFile *pf),
         ARGIN(const char *name))
 {
+    ASSERT_ARGS(segment_init);
     self->pf          = pf;
     self->type        = PF_UNKNOWN_SEG;
     self->file_offset = 0;
@@ -2137,6 +2175,7 @@
 PackFile_Segment_new(SHIM_INTERP, SHIM(PackFile *pf), SHIM(const char *name), SHIM(int add))
 {
     PackFile_Segment * const seg = mem_allocate_typed(PackFile_Segment);
+    ASSERT_ARGS(PackFile_Segment_new);
 
     return seg;
 }
@@ -2163,6 +2202,7 @@
 static void
 default_destroy(ARGMOD(PackFile_Segment *self))
 {
+    ASSERT_ARGS(default_destroy);
     if (!self->pf->is_mmap_ped && self->data) {
         mem_sys_free(self->data);
         self->data = NULL;
@@ -2187,6 +2227,7 @@
 static size_t
 default_packed_size(ARGIN(const PackFile_Segment *self))
 {
+    ASSERT_ARGS(default_packed_size);
     /* op_count, itype, id, size */
     /* XXX There should be a constant defining this 4, and why */
     /* This is the 2nd place in the file that has this */
@@ -2208,6 +2249,7 @@
 static opcode_t *
 default_pack(ARGIN(const PackFile_Segment *self), ARGOUT(opcode_t *dest))
 {
+    ASSERT_ARGS(default_pack);
     *dest++ = self->op_count;
     *dest++ = self->itype;
     *dest++ = self->id;
@@ -2237,6 +2279,7 @@
 byte_code_destroy(SHIM_INTERP, ARGMOD(PackFile_Segment *self))
 {
     PackFile_ByteCode * const byte_code = (PackFile_ByteCode *)self;
+    ASSERT_ARGS(byte_code_destroy);
 
 #ifdef HAS_JIT
     Parrot_destroy_jit(byte_code->jit_info);
@@ -2274,6 +2317,7 @@
 byte_code_new(SHIM_INTERP, SHIM(PackFile *pf), SHIM(const char *name), SHIM(int add))
 {
     PackFile_ByteCode * const byte_code = mem_allocate_zeroed_typed(PackFile_ByteCode);
+    ASSERT_ARGS(byte_code_new);
 
     return (PackFile_Segment *) byte_code;
 }
@@ -2299,6 +2343,7 @@
 {
     PackFile_Debug * const debug = (PackFile_Debug *) self;
     int i;
+    ASSERT_ARGS(pf_debug_destroy);
 
     /* Free each mapping. */
     for (i = 0; i < debug->num_mappings; i++)
@@ -2328,6 +2373,7 @@
 pf_debug_new(SHIM_INTERP, SHIM(PackFile *pf), SHIM(const char *name), SHIM(int add))
 {
     PackFile_Debug * const debug = mem_allocate_zeroed_typed(PackFile_Debug);
+    ASSERT_ARGS(pf_debug_new);
 
     debug->mappings              = mem_allocate_typed(PackFile_DebugMapping *);
     debug->mappings[0]           = NULL;
@@ -2352,6 +2398,7 @@
     PackFile_Debug * const debug = (PackFile_Debug *)self;
     int size = 0;
     int i;
+    ASSERT_ARGS(pf_debug_packed_size);
 
     /* Size of mappings count. */
     size += 1;
@@ -2394,6 +2441,7 @@
     PackFile_Debug * const debug = (PackFile_Debug *)self;
     int i;
     const int n = debug->num_mappings;
+    ASSERT_ARGS(pf_debug_pack);
 
     /* Store number of mappings. */
     *cursor++ = n;
@@ -2446,6 +2494,7 @@
        base this on the name of the debug segment. */
     char *code_name = NULL;
     size_t str_len;
+    ASSERT_ARGS(pf_debug_unpack);
 
     /* Number of mappings. */
     debug->num_mappings = PF_fetch_opcode(self->pf, &cursor);
@@ -2515,6 +2564,7 @@
     opcode_t i;
     size_t   j;
     const PackFile_Debug * const debug = (const PackFile_Debug *)self;
+    ASSERT_ARGS(pf_debug_dump);
 
     default_dump_header(interp, self);
 
@@ -2583,6 +2633,7 @@
 Parrot_new_debug_seg(PARROT_INTERP, ARGMOD(PackFile_ByteCode *cs), size_t size)
 {
     PackFile_Debug *debug;
+    ASSERT_ARGS(Parrot_new_debug_seg);
 
     if (cs->debugs) {    /* it exists already, resize it */
         debug = cs->debugs;
@@ -2634,6 +2685,7 @@
     PackFile_DebugMapping *mapping;
     PackFile_ConstTable * const ct = debug->code->const_table;
     int insert_pos = 0;
+    ASSERT_ARGS(Parrot_debug_add_mapping);
 
     /* Allocate space for the extra entry. */
     mem_realloc_n_typed(debug->mappings, debug->num_mappings+1, PackFile_DebugMapping *);
@@ -2711,6 +2763,7 @@
     /* Look through mappings until we find one that maps the passed
        bytecode offset. */
     int i;
+    ASSERT_ARGS(Parrot_debug_pc_to_filename);
     for (i = 0; i < debug->num_mappings; i++) {
         /* If this is the last mapping or the current position is
            between this mapping and the next one, return a filename. */
@@ -2754,6 +2807,7 @@
     const size_t num_segs = dir->num_segments;
     size_t i;
     opcode_t n;
+    ASSERT_ARGS(Parrot_switch_to_cs_by_nr);
 
     /* TODO make an index of code segments for faster look up */
     for (i = n = 0; i < num_segs; i++) {
@@ -2788,6 +2842,7 @@
 Parrot_switch_to_cs(PARROT_INTERP, ARGIN(PackFile_ByteCode *new_cs), int really)
 {
     PackFile_ByteCode * const cur_cs = interp->code;
+    ASSERT_ARGS(Parrot_switch_to_cs);
 
     if (!new_cs)
         Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_NO_PREV_CS,
@@ -2830,6 +2885,7 @@
 clone_constant(PARROT_INTERP, ARGIN(PackFile_Constant *old_const))
 {
     STRING * const _sub = interp->vtables[enum_class_Sub]->whoami;
+    ASSERT_ARGS(clone_constant);
 
     if (old_const->type == PFC_PMC
             && VTABLE_isa(interp, old_const->u.key, _sub)) {
@@ -2877,6 +2933,7 @@
 static PackFile_Constant **
 find_constants(PARROT_INTERP, ARGIN(PackFile_ConstTable *ct))
 {
+    ASSERT_ARGS(find_constants);
     if (!n_interpreters || !interp->thread_data ||
             interp->thread_data->tid == 0) {
         return ct->constants;
@@ -2932,6 +2989,7 @@
 {
     UINTVAL i;
     Hash *hash;
+    ASSERT_ARGS(Parrot_destroy_constants);
     if (!interp->thread_data) {
         return;
     }
@@ -2987,6 +3045,7 @@
 PackFile_FixupTable_clear(PARROT_INTERP, ARGMOD(PackFile_FixupTable *self))
 {
     opcode_t i;
+    ASSERT_ARGS(PackFile_FixupTable_clear);
     if (!self) {
         Parrot_io_eprintf(interp, "PackFile_FixupTable_clear: self == NULL!\n");
         return;
@@ -3024,6 +3083,7 @@
 fixup_destroy(PARROT_INTERP, ARGMOD(PackFile_Segment *self))
 {
     PackFile_FixupTable * const ft = (PackFile_FixupTable *)self;
+    ASSERT_ARGS(fixup_destroy);
     PackFile_FixupTable_clear(interp, ft);
 }
 
@@ -3045,6 +3105,7 @@
     PackFile_FixupTable * const ft = (PackFile_FixupTable *)self;
     size_t size;
     opcode_t i;
+    ASSERT_ARGS(fixup_packed_size);
 
     size = 1;    /* fixup_count */
     for (i = 0; i < ft->fixup_count; i++) {
@@ -3083,6 +3144,7 @@
 {
     PackFile_FixupTable * const ft = (PackFile_FixupTable *)self;
     opcode_t i;
+    ASSERT_ARGS(fixup_pack);
 
     *cursor++ = ft->fixup_count;
     for (i = 0; i < ft->fixup_count; i++) {
@@ -3118,6 +3180,7 @@
 fixup_new(SHIM_INTERP, SHIM(PackFile *pf), SHIM(const char *name), SHIM(int add))
 {
     PackFile_FixupTable * const fixup = mem_allocate_zeroed_typed(PackFile_FixupTable);
+    ASSERT_ARGS(fixup_new);
 
     return (PackFile_Segment *) fixup;
 }
@@ -3142,6 +3205,7 @@
     opcode_t i;
     PackFile *pf;
     PackFile_FixupTable * const self = (PackFile_FixupTable *)seg;
+    ASSERT_ARGS(fixup_unpack);
 
     if (!self) {
         Parrot_io_eprintf(interp, "PackFile_FixupTable_unpack: self == NULL!\n");
@@ -3209,6 +3273,7 @@
 {
     PackFile_FixupTable *self = interp->code->fixups;
     opcode_t i;
+    ASSERT_ARGS(PackFile_FixupTable_new_entry);
 
     if (!self) {
         self = (PackFile_FixupTable *) PackFile_Segment_new_seg(
@@ -3244,6 +3309,7 @@
 find_fixup(ARGMOD(PackFile_FixupTable *ft), INTVAL type, ARGIN(const char *name))
 {
     opcode_t i;
+    ASSERT_ARGS(find_fixup);
     for (i = 0; i < ft->fixup_count; i++) {
         if ((INTVAL)((enum_fixup_t)ft->fixups[i]->type) == type &&
                 STREQ(ft->fixups[i]->name, name)) {
@@ -3269,6 +3335,7 @@
 static INTVAL
 find_fixup_iter(PARROT_INTERP, ARGIN(PackFile_Segment *seg), ARGIN(void *user_data))
 {
+    ASSERT_ARGS(find_fixup_iter);
     if (seg->type == PF_DIR_SEG) {
         if (PackFile_map_segments(interp, (PackFile_Directory *)seg,
                     find_fixup_iter, user_data))
@@ -3308,6 +3375,7 @@
     PackFile_Directory * const dir = interp->code->base.dir;
     PackFile_FixupEntry * const ep = mem_allocate_typed(PackFile_FixupEntry);
     int found;
+    ASSERT_ARGS(PackFile_find_fixup_entry);
 
     ep->type = type;
     ep->name = name;
@@ -3336,6 +3404,7 @@
 PackFile_ConstTable_clear(PARROT_INTERP, ARGMOD(PackFile_ConstTable *self))
 {
     opcode_t i;
+    ASSERT_ARGS(PackFile_ConstTable_clear);
 
     for (i = 0; i < self->const_count; i++) {
         PackFile_Constant_destroy(interp, self->constants[i]);
@@ -3381,6 +3450,7 @@
     opcode_t i;
     PackFile_ConstTable * const self = (PackFile_ConstTable *)seg;
     PackFile * const pf              = seg->pf;
+    ASSERT_ARGS(PackFile_ConstTable_unpack);
 
     PackFile_ConstTable_clear(interp, self);
 
@@ -3442,6 +3512,7 @@
 const_new(SHIM_INTERP, SHIM(PackFile *pf), SHIM(const char *name), SHIM(int add))
 {
     PackFile_ConstTable * const const_table = mem_allocate_zeroed_typed(PackFile_ConstTable);
+    ASSERT_ARGS(const_new);
 
     return (PackFile_Segment *)const_table;
 }
@@ -3460,6 +3531,7 @@
 const_destroy(PARROT_INTERP, ARGMOD(PackFile_Segment *self))
 {
     PackFile_ConstTable * const ct = (PackFile_ConstTable *)self;
+    ASSERT_ARGS(const_destroy);
 
     PackFile_ConstTable_clear(interp, ct);
 }
@@ -3490,6 +3562,7 @@
 {
     PackFile_Constant * const self =
         mem_allocate_zeroed_typed(PackFile_Constant);
+    ASSERT_ARGS(PackFile_Constant_new);
 
     self->type = PFC_NONE;
 
@@ -3512,6 +3585,7 @@
 void
 PackFile_Constant_destroy(SHIM_INTERP, ARGMOD_NULLOK(PackFile_Constant *self))
 {
+    ASSERT_ARGS(PackFile_Constant_destroy);
     mem_sys_free(self);
 }
 
@@ -3534,6 +3608,7 @@
     size_t packed_size;
     PMC *component;
     STRING *image;
+    ASSERT_ARGS(PackFile_Constant_pack_size);
 
     switch (self->type) {
 
@@ -3600,6 +3675,7 @@
 {
     PackFile * const pf = constt->base.pf;
     const opcode_t type = PF_fetch_opcode(pf, &cursor);
+    ASSERT_ARGS(PackFile_Constant_unpack);
 
 /* #define TRACE_PACKFILE 1 */
 #if TRACE_PACKFILE
@@ -3661,6 +3737,7 @@
      * thawing the PMC needs the real packfile in place
      */
     PackFile_ByteCode * const cs_save = interp->code;
+    ASSERT_ARGS(PackFile_Constant_unpack_pmc);
     interp->code = pf->cur_cs;
 
     image = PF_fetch_string(interp, pf, &cursor);
@@ -3720,6 +3797,7 @@
     INTVAL components = (INTVAL)PF_fetch_opcode(pf, &cursor);
     PMC *head = NULL;
     PMC *tail = NULL;
+    ASSERT_ARGS(PackFile_Constant_unpack_key);
 
     while (components-- > 0) {
         opcode_t type = PF_fetch_opcode(pf, &cursor);
@@ -3800,6 +3878,7 @@
 PackFile_append_pbc(PARROT_INTERP, ARGIN_NULLOK(const char *filename))
 {
     PackFile * const pf = Parrot_readbc(interp, filename);
+    ASSERT_ARGS(PackFile_append_pbc);
     if (!pf)
         return NULL;
     PackFile_add_segment(interp, &interp->initial_pf->directory,
@@ -3833,6 +3912,7 @@
     STRING *wo_ext, *ext, *pbc, *path;
     enum_runtime_ft file_type;
     PMC *is_loaded_hash;
+    ASSERT_ARGS(Parrot_load_bytecode);
 
     if (STRING_IS_NULL(file_str))
         Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_LIBRARY_ERROR,
@@ -3897,6 +3977,7 @@
 void
 PackFile_fixup_subs(PARROT_INTERP, pbc_action_enum_t what, ARGIN_NULLOK(PMC *eval))
 {
+    ASSERT_ARGS(PackFile_fixup_subs);
     do_sub_pragmas(interp, interp->code, what, eval);
 }
 

Modified: trunk/src/spf_render.c
==============================================================================
--- trunk/src/spf_render.c	(original)
+++ trunk/src/spf_render.c	Thu Jan  1 15:54:09 2009
@@ -126,6 +126,7 @@
         INTVAL is_int_type, ARGIN_NULLOK(STRING* prefix))
 {
     UINTVAL len = string_length(interp, str);
+    ASSERT_ARGS(handle_flags);
 
     if (is_int_type) {
         if (info->flags & FLAG_PREC && info->prec == 0 &&
@@ -231,6 +232,7 @@
 str_append_w_flags(PARROT_INTERP, ARGOUT(STRING *dest), ARGIN(const SpfInfo *info),
         ARGMOD(STRING *src), ARGIN_NULLOK(STRING *prefix))
 {
+    ASSERT_ARGS(str_append_w_flags);
     src = handle_flags(interp, info, src, 1, prefix);
     dest = string_append(interp, dest, src);
     return dest;
@@ -252,6 +254,7 @@
 gen_sprintf_call(ARGOUT(char *out), ARGMOD(SpfInfo *info), int thingy)
 {
     int i    = 0;
+    ASSERT_ARGS(gen_sprintf_call);
     out[i++] = '%';
 
     if (info->flags) {
@@ -330,6 +333,7 @@
      */
     STRING *substr = NULL;
     char tc[PARROT_SPRINTF_BUFFER_SIZE];
+    ASSERT_ARGS(Parrot_sprintf_format);
 
     for (i = 0; i < pat_len; i++) {
         if (string_ord(interp, pat, i) == '%') {        /* % */



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