| 1 | Index: src/embed.c |
|---|
| 2 | =================================================================== |
|---|
| 3 | --- src/embed.c (.../trunk) (revision 34776) |
|---|
| 4 | +++ src/embed.c (.../branches/assert_args) (revision 34785) |
|---|
| 5 | @@ -836,6 +836,7 @@ |
|---|
| 6 | { |
|---|
| 7 | opcode_t i; |
|---|
| 8 | PMC *sub_pmc; |
|---|
| 9 | + ASSERT_ARGS(set_current_sub); |
|---|
| 10 | |
|---|
| 11 | PackFile_ByteCode * const cur_cs = interp->code; |
|---|
| 12 | PackFile_FixupTable * const ft = cur_cs->fixups; |
|---|
| 13 | Index: src/pbc_merge.c |
|---|
| 14 | =================================================================== |
|---|
| 15 | --- src/pbc_merge.c (.../trunk) (revision 34776) |
|---|
| 16 | +++ src/pbc_merge.c (.../branches/assert_args) (revision 34785) |
|---|
| 17 | @@ -233,6 +233,7 @@ |
|---|
| 18 | INTVAL program_size, wanted; |
|---|
| 19 | char *program_code; |
|---|
| 20 | PackFile *pf; |
|---|
| 21 | + ASSERT_ARGS(pbc_merge_loadpbc); |
|---|
| 22 | FILE * io = NULL; |
|---|
| 23 | INTVAL is_mapped = 0; |
|---|
| 24 | size_t chunk_size; |
|---|
| 25 | @@ -321,9 +322,10 @@ |
|---|
| 26 | pbc_merge_bytecode(PARROT_INTERP, ARGMOD(pbc_merge_input **inputs), |
|---|
| 27 | int num_inputs, ARGMOD(PackFile *pf)) |
|---|
| 28 | { |
|---|
| 29 | + int i; |
|---|
| 30 | + ASSERT_ARGS(pbc_merge_bytecode); |
|---|
| 31 | opcode_t *bc = mem_allocate_typed(opcode_t); |
|---|
| 32 | opcode_t cursor = 0; |
|---|
| 33 | - int i; |
|---|
| 34 | |
|---|
| 35 | /* Add a bytecode segment. */ |
|---|
| 36 | PackFile_ByteCode * const bc_seg = |
|---|
| 37 | @@ -385,9 +387,10 @@ |
|---|
| 38 | pbc_merge_constants(PARROT_INTERP, ARGMOD(pbc_merge_input **inputs), |
|---|
| 39 | int num_inputs, ARGMOD(PackFile *pf), ARGMOD(PackFile_ByteCode *bc)) |
|---|
| 40 | { |
|---|
| 41 | + int i, j; |
|---|
| 42 | + ASSERT_ARGS(pbc_merge_constants); |
|---|
| 43 | PackFile_Constant **constants = mem_allocate_typed(PackFile_Constant *); |
|---|
| 44 | opcode_t cursor = 0; |
|---|
| 45 | - int i, j; |
|---|
| 46 | |
|---|
| 47 | /* Add a constant table segment. */ |
|---|
| 48 | PackFile_ConstTable * const const_seg = (PackFile_ConstTable*)PackFile_Segment_new_seg( |
|---|
| 49 | @@ -480,10 +483,11 @@ |
|---|
| 50 | pbc_merge_fixups(PARROT_INTERP, ARGIN(pbc_merge_input **inputs), |
|---|
| 51 | int num_inputs, ARGMOD(PackFile *pf), ARGMOD(PackFile_ByteCode *bc)) |
|---|
| 52 | { |
|---|
| 53 | + int i, j; |
|---|
| 54 | + ASSERT_ARGS(pbc_merge_fixups); |
|---|
| 55 | PackFile_FixupTable *fixup_seg; |
|---|
| 56 | PackFile_FixupEntry **fixups = mem_allocate_typed(PackFile_FixupEntry *); |
|---|
| 57 | opcode_t cursor = 0; |
|---|
| 58 | - int i, j; |
|---|
| 59 | |
|---|
| 60 | /* Add a fixup table segment. */ |
|---|
| 61 | fixup_seg = (PackFile_FixupTable*)PackFile_Segment_new_seg( |
|---|
| 62 | @@ -575,13 +579,14 @@ |
|---|
| 63 | pbc_merge_debugs(PARROT_INTERP, ARGMOD(pbc_merge_input **inputs), |
|---|
| 64 | int num_inputs, ARGMOD(PackFile *pf), ARGMOD(PackFile_ByteCode *bc)) |
|---|
| 65 | { |
|---|
| 66 | + int i, j; |
|---|
| 67 | + ASSERT_ARGS(pbc_merge_debugs); |
|---|
| 68 | PackFile_Debug *debug_seg; |
|---|
| 69 | opcode_t *lines = mem_allocate_typed(opcode_t); |
|---|
| 70 | PackFile_DebugMapping **mappings = |
|---|
| 71 | mem_allocate_typed(PackFile_DebugMapping *); |
|---|
| 72 | opcode_t num_mappings = 0; |
|---|
| 73 | opcode_t num_lines = 0; |
|---|
| 74 | - int i, j; |
|---|
| 75 | |
|---|
| 76 | /* We need to merge both the mappings and the list of line numbers. |
|---|
| 77 | The line numbers can just be concatenated. The mappings must have |
|---|
| 78 | @@ -648,6 +653,7 @@ |
|---|
| 79 | int i; |
|---|
| 80 | PackFile_Segment *pic_index; |
|---|
| 81 | size_t size; |
|---|
| 82 | + ASSERT_ARGS(pbc_merge_pic_index); |
|---|
| 83 | opcode_t cursor = 0; |
|---|
| 84 | opcode_t start = 0; |
|---|
| 85 | opcode_t last = 0; |
|---|
| 86 | @@ -697,11 +703,12 @@ |
|---|
| 87 | pbc_merge_ctpointers(PARROT_INTERP, ARGMOD(pbc_merge_input **inputs), |
|---|
| 88 | int num_inputs, ARGMOD(PackFile_ByteCode *bc)) |
|---|
| 89 | { |
|---|
| 90 | + int cur_arg; |
|---|
| 91 | opcode_t *op_ptr; |
|---|
| 92 | + ASSERT_ARGS(pbc_merge_ctpointers); |
|---|
| 93 | opcode_t *ops = bc->base.data; |
|---|
| 94 | opcode_t cur_op = 0; |
|---|
| 95 | int cur_input = 0; |
|---|
| 96 | - int cur_arg; |
|---|
| 97 | |
|---|
| 98 | /* Loop over the ops in the merged bytecode. */ |
|---|
| 99 | while (cur_op < (opcode_t)bc->base.size) { |
|---|
| 100 | @@ -781,6 +788,7 @@ |
|---|
| 101 | { |
|---|
| 102 | PackFile_ByteCode *bc; |
|---|
| 103 | PackFile_ConstTable *ct; |
|---|
| 104 | + ASSERT_ARGS(pbc_merge_begin); |
|---|
| 105 | |
|---|
| 106 | /* Create a new empty packfile. */ |
|---|
| 107 | PackFile * const merged = PackFile_new(interp, 0); |
|---|
| 108 | @@ -819,6 +827,7 @@ |
|---|
| 109 | static void |
|---|
| 110 | pbc_merge_write(PARROT_INTERP, ARGMOD(PackFile *pf), ARGIN(const char *filename)) |
|---|
| 111 | { |
|---|
| 112 | + ASSERT_ARGS(pbc_merge_write); |
|---|
| 113 | FILE *fp; |
|---|
| 114 | |
|---|
| 115 | /* Get size of packfile we'll write. */ |
|---|
| 116 | Index: src/charset.c |
|---|
| 117 | =================================================================== |
|---|
| 118 | --- src/charset.c (.../trunk) (revision 34776) |
|---|
| 119 | +++ src/charset.c (.../branches/assert_args) (revision 34785) |
|---|
| 120 | @@ -96,6 +96,7 @@ |
|---|
| 121 | CHARSET * |
|---|
| 122 | Parrot_new_charset(SHIM_INTERP) |
|---|
| 123 | { |
|---|
| 124 | + ASSERT_ARGS(Parrot_new_charset); |
|---|
| 125 | return mem_allocate_typed(CHARSET); |
|---|
| 126 | } |
|---|
| 127 | |
|---|
| 128 | @@ -114,8 +115,9 @@ |
|---|
| 129 | void |
|---|
| 130 | Parrot_charsets_encodings_deinit(SHIM_INTERP) |
|---|
| 131 | { |
|---|
| 132 | + int i; |
|---|
| 133 | + ASSERT_ARGS(Parrot_charsets_encodings_deinit); |
|---|
| 134 | const int n = all_charsets->n_charsets; |
|---|
| 135 | - int i; |
|---|
| 136 | |
|---|
| 137 | for (i = 0; i < n; ++i) { |
|---|
| 138 | if (all_charsets->set[i].n_converters) |
|---|
| 139 | @@ -146,6 +148,7 @@ |
|---|
| 140 | Parrot_find_charset(SHIM_INTERP, ARGIN(const char *charsetname)) |
|---|
| 141 | { |
|---|
| 142 | int i; |
|---|
| 143 | + ASSERT_ARGS(Parrot_find_charset); |
|---|
| 144 | const int n = all_charsets->n_charsets; |
|---|
| 145 | |
|---|
| 146 | for (i = 0; i < n; ++i) { |
|---|
| 147 | @@ -172,6 +175,7 @@ |
|---|
| 148 | CHARSET * |
|---|
| 149 | Parrot_load_charset(PARROT_INTERP, ARGIN(const char *charsetname)) |
|---|
| 150 | { |
|---|
| 151 | + ASSERT_ARGS(Parrot_load_charset); |
|---|
| 152 | UNUSED(charsetname); |
|---|
| 153 | |
|---|
| 154 | Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_UNIMPLEMENTED, |
|---|
| 155 | @@ -193,8 +197,9 @@ |
|---|
| 156 | INTVAL |
|---|
| 157 | Parrot_charset_number(PARROT_INTERP, ARGIN(const STRING *charsetname)) |
|---|
| 158 | { |
|---|
| 159 | + int i; |
|---|
| 160 | + ASSERT_ARGS(Parrot_charset_number); |
|---|
| 161 | const int n = all_charsets->n_charsets; |
|---|
| 162 | - int i; |
|---|
| 163 | |
|---|
| 164 | for (i = 0; i < n; ++i) { |
|---|
| 165 | if (!string_equal(interp, all_charsets->set[i].name, charsetname)) |
|---|
| 166 | @@ -219,6 +224,7 @@ |
|---|
| 167 | Parrot_charset_number_of_str(SHIM_INTERP, ARGIN(const STRING *src)) |
|---|
| 168 | { |
|---|
| 169 | int i; |
|---|
| 170 | + ASSERT_ARGS(Parrot_charset_number_of_str); |
|---|
| 171 | const int n = all_charsets->n_charsets; |
|---|
| 172 | |
|---|
| 173 | for (i = 0; i < n; ++i) { |
|---|
| 174 | @@ -245,6 +251,7 @@ |
|---|
| 175 | STRING* |
|---|
| 176 | Parrot_charset_name(SHIM_INTERP, INTVAL number_of_charset) |
|---|
| 177 | { |
|---|
| 178 | + ASSERT_ARGS(Parrot_charset_name); |
|---|
| 179 | if (number_of_charset < 0 || number_of_charset >= all_charsets->n_charsets) |
|---|
| 180 | return NULL; |
|---|
| 181 | return all_charsets->set[number_of_charset].name; |
|---|
| 182 | @@ -266,6 +273,7 @@ |
|---|
| 183 | const CHARSET * |
|---|
| 184 | Parrot_get_charset(SHIM_INTERP, INTVAL number_of_charset) |
|---|
| 185 | { |
|---|
| 186 | + ASSERT_ARGS(Parrot_get_charset); |
|---|
| 187 | if (number_of_charset < 0 || number_of_charset >= all_charsets->n_charsets) |
|---|
| 188 | return NULL; |
|---|
| 189 | return all_charsets->set[number_of_charset].charset; |
|---|
| 190 | @@ -288,6 +296,7 @@ |
|---|
| 191 | const char * |
|---|
| 192 | Parrot_charset_c_name(SHIM_INTERP, INTVAL number_of_charset) |
|---|
| 193 | { |
|---|
| 194 | + ASSERT_ARGS(Parrot_charset_c_name); |
|---|
| 195 | if (number_of_charset < 0 || number_of_charset >= all_charsets->n_charsets) |
|---|
| 196 | return NULL; |
|---|
| 197 | return all_charsets->set[number_of_charset].charset->name; |
|---|
| 198 | @@ -309,8 +318,9 @@ |
|---|
| 199 | register_charset(PARROT_INTERP, ARGIN(const char *charsetname), |
|---|
| 200 | ARGIN(CHARSET *charset)) |
|---|
| 201 | { |
|---|
| 202 | + int i; |
|---|
| 203 | + ASSERT_ARGS(register_charset); |
|---|
| 204 | const int n = all_charsets->n_charsets; |
|---|
| 205 | - int i; |
|---|
| 206 | |
|---|
| 207 | for (i = 0; i < n; ++i) { |
|---|
| 208 | if (STREQ(all_charsets->set[i].charset->name, charsetname)) |
|---|
| 209 | @@ -352,6 +362,7 @@ |
|---|
| 210 | static void |
|---|
| 211 | register_static_converters(PARROT_INTERP) |
|---|
| 212 | { |
|---|
| 213 | + ASSERT_ARGS(register_static_converters); |
|---|
| 214 | Parrot_register_charset_converter(interp, |
|---|
| 215 | Parrot_iso_8859_1_charset_ptr, Parrot_ascii_charset_ptr, |
|---|
| 216 | charset_cvt_iso_8859_1_to_ascii); |
|---|
| 217 | @@ -391,6 +402,7 @@ |
|---|
| 218 | Parrot_register_charset(PARROT_INTERP, ARGIN(const char *charsetname), |
|---|
| 219 | ARGIN(CHARSET *charset)) |
|---|
| 220 | { |
|---|
| 221 | + ASSERT_ARGS(Parrot_register_charset); |
|---|
| 222 | if (!all_charsets) { |
|---|
| 223 | all_charsets = mem_allocate_typed(All_charsets); |
|---|
| 224 | all_charsets->n_charsets = 0; |
|---|
| 225 | @@ -433,6 +445,7 @@ |
|---|
| 226 | void |
|---|
| 227 | Parrot_charsets_encodings_init(PARROT_INTERP) |
|---|
| 228 | { |
|---|
| 229 | + ASSERT_ARGS(Parrot_charsets_encodings_init); |
|---|
| 230 | /* the order is crucial here: |
|---|
| 231 | * 1) encodings, default = fixed_8 |
|---|
| 232 | * 2) charsets default = ascii |
|---|
| 233 | @@ -472,6 +485,7 @@ |
|---|
| 234 | Parrot_make_default_charset(SHIM_INTERP, SHIM(const char *charsetname), |
|---|
| 235 | ARGIN(CHARSET *charset)) |
|---|
| 236 | { |
|---|
| 237 | + ASSERT_ARGS(Parrot_make_default_charset); |
|---|
| 238 | Parrot_default_charset_ptr = charset; |
|---|
| 239 | return 1; |
|---|
| 240 | } |
|---|
| 241 | @@ -492,6 +506,7 @@ |
|---|
| 242 | const CHARSET * |
|---|
| 243 | Parrot_default_charset(SHIM_INTERP) |
|---|
| 244 | { |
|---|
| 245 | + ASSERT_ARGS(Parrot_default_charset); |
|---|
| 246 | return Parrot_default_charset_ptr; |
|---|
| 247 | } |
|---|
| 248 | |
|---|
| 249 | @@ -513,6 +528,7 @@ |
|---|
| 250 | ARGIN(const CHARSET *lhs), ARGIN(const CHARSET *rhs)) |
|---|
| 251 | { |
|---|
| 252 | int i; |
|---|
| 253 | + ASSERT_ARGS(Parrot_find_charset_converter); |
|---|
| 254 | const int n = all_charsets->n_charsets; |
|---|
| 255 | |
|---|
| 256 | for (i = 0; i < n; ++i) { |
|---|
| 257 | @@ -546,8 +562,9 @@ |
|---|
| 258 | ARGIN(const CHARSET *lhs), ARGIN(CHARSET *rhs), |
|---|
| 259 | ARGIN(charset_converter_t func)) |
|---|
| 260 | { |
|---|
| 261 | + int i; |
|---|
| 262 | + ASSERT_ARGS(Parrot_register_charset_converter); |
|---|
| 263 | const int n = all_charsets->n_charsets; |
|---|
| 264 | - int i; |
|---|
| 265 | |
|---|
| 266 | for (i = 0; i < n; ++i) { |
|---|
| 267 | if (lhs == all_charsets->set[i].charset) { |
|---|
| 268 | Index: src/exec.c |
|---|
| 269 | =================================================================== |
|---|
| 270 | --- src/exec.c (.../trunk) (revision 34776) |
|---|
| 271 | +++ src/exec.c (.../branches/assert_args) (revision 34785) |
|---|
| 272 | @@ -49,6 +49,10 @@ |
|---|
| 273 | __attribute__nonnull__(1) |
|---|
| 274 | __attribute__nonnull__(2); |
|---|
| 275 | |
|---|
| 276 | +#define ASSERT_ARGS_add_data_member assert(obj); |
|---|
| 277 | +#define ASSERT_ARGS_exec_init assert(obj); |
|---|
| 278 | +#define ASSERT_ARGS_symbol_list_find assert(obj); \ |
|---|
| 279 | + assert(symbol); |
|---|
| 280 | /* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */ |
|---|
| 281 | /* HEADERIZER END: static */ |
|---|
| 282 | |
|---|
| 283 | @@ -362,6 +366,7 @@ |
|---|
| 284 | symbol_list_find(ARGIN(const Parrot_exec_objfile_t *obj), ARGIN(const char *symbol)) |
|---|
| 285 | { |
|---|
| 286 | int i; |
|---|
| 287 | + ASSERT_ARGS(symbol_list_find); |
|---|
| 288 | |
|---|
| 289 | for (i = 0; i < obj->symbol_count; i++) |
|---|
| 290 | if (STREQ(symbol, obj->symbol_table[i].symbol)) |
|---|
| 291 | Index: src/inter_run.c |
|---|
| 292 | =================================================================== |
|---|
| 293 | --- src/inter_run.c (.../trunk) (revision 34776) |
|---|
| 294 | +++ src/inter_run.c (.../branches/assert_args) (revision 34785) |
|---|
| 295 | @@ -64,6 +64,7 @@ |
|---|
| 296 | void |
|---|
| 297 | runops(PARROT_INTERP, size_t offs) |
|---|
| 298 | { |
|---|
| 299 | + ASSERT_ARGS(runops); |
|---|
| 300 | volatile size_t offset = offs; |
|---|
| 301 | const int old_runloop_id = interp->current_runloop_id; |
|---|
| 302 | const int our_runloop_level = ++interp->current_runloop_level; |
|---|
| 303 | @@ -138,6 +139,7 @@ |
|---|
| 304 | { |
|---|
| 305 | opcode_t offset, *dest; |
|---|
| 306 | Parrot_Context *ctx; |
|---|
| 307 | + ASSERT_ARGS(Parrot_runops_fromc); |
|---|
| 308 | |
|---|
| 309 | /* we need one return continuation with a NULL offset */ |
|---|
| 310 | PMC * const ret_c = new_ret_continuation_pmc(interp, NULL); |
|---|
| 311 | @@ -195,6 +197,7 @@ |
|---|
| 312 | |
|---|
| 313 | char new_sig[10]; |
|---|
| 314 | const char *sig_p; |
|---|
| 315 | + ASSERT_ARGS(runops_args); |
|---|
| 316 | Parrot_Context * const old_ctx = CONTEXT(interp); |
|---|
| 317 | |
|---|
| 318 | interp->current_cont = new_ret_continuation_pmc(interp, NULL); |
|---|
| 319 | @@ -269,6 +272,7 @@ |
|---|
| 320 | Parrot_Context *ctx; |
|---|
| 321 | opcode_t offset, *dest; |
|---|
| 322 | |
|---|
| 323 | + ASSERT_ARGS(Parrot_run_meth_fromc); |
|---|
| 324 | interp->current_cont = new_ret_continuation_pmc(interp, NULL); |
|---|
| 325 | interp->current_object = obj; |
|---|
| 326 | dest = VTABLE_invoke(interp, sub, (void *)1); |
|---|
| 327 | @@ -304,6 +308,7 @@ |
|---|
| 328 | va_list args; |
|---|
| 329 | Parrot_Context *ctx; |
|---|
| 330 | PMC *retval; |
|---|
| 331 | + ASSERT_ARGS(Parrot_runops_fromc_args); |
|---|
| 332 | |
|---|
| 333 | va_start(args, sig); |
|---|
| 334 | ctx = runops_args(interp, sub, PMCNULL, NULL, sig, args); |
|---|
| 335 | @@ -335,6 +340,7 @@ |
|---|
| 336 | va_list args; |
|---|
| 337 | Parrot_Context *ctx; |
|---|
| 338 | void *retval; |
|---|
| 339 | + ASSERT_ARGS(Parrot_runops_fromc_args_event); |
|---|
| 340 | /* |
|---|
| 341 | * running code from event handlers isn't fully reentrant due to |
|---|
| 342 | * these interpreter variables - mainly related to calls |
|---|
| 343 | @@ -379,6 +385,7 @@ |
|---|
| 344 | va_list args; |
|---|
| 345 | Parrot_Context *ctx; |
|---|
| 346 | INTVAL retval; |
|---|
| 347 | + ASSERT_ARGS(Parrot_runops_fromc_args_reti); |
|---|
| 348 | |
|---|
| 349 | va_start(args, sig); |
|---|
| 350 | ctx = runops_args(interp, sub, PMCNULL, NULL, sig, args); |
|---|
| 351 | @@ -409,6 +416,7 @@ |
|---|
| 352 | va_list args; |
|---|
| 353 | Parrot_Context *ctx; |
|---|
| 354 | FLOATVAL retval; |
|---|
| 355 | + ASSERT_ARGS(Parrot_runops_fromc_args_retf); |
|---|
| 356 | |
|---|
| 357 | va_start(args, sig); |
|---|
| 358 | ctx = runops_args(interp, sub, PMCNULL, NULL, sig, args); |
|---|
| 359 | @@ -440,6 +448,7 @@ |
|---|
| 360 | va_list args; |
|---|
| 361 | Parrot_Context *ctx; |
|---|
| 362 | void* retval; |
|---|
| 363 | + ASSERT_ARGS(Parrot_run_meth_fromc_args); |
|---|
| 364 | |
|---|
| 365 | va_start(args, sig); |
|---|
| 366 | ctx = runops_args(interp, sub, obj, meth, sig, args); |
|---|
| 367 | @@ -470,6 +479,7 @@ |
|---|
| 368 | va_list args; |
|---|
| 369 | Parrot_Context *ctx; |
|---|
| 370 | INTVAL retval; |
|---|
| 371 | + ASSERT_ARGS(Parrot_run_meth_fromc_args_reti); |
|---|
| 372 | |
|---|
| 373 | va_start(args, sig); |
|---|
| 374 | ctx = runops_args(interp, sub, obj, meth, sig, args); |
|---|
| 375 | @@ -500,6 +510,7 @@ |
|---|
| 376 | va_list args; |
|---|
| 377 | Parrot_Context *ctx; |
|---|
| 378 | FLOATVAL retval; |
|---|
| 379 | + ASSERT_ARGS(Parrot_run_meth_fromc_args_retf); |
|---|
| 380 | |
|---|
| 381 | va_start(args, sig); |
|---|
| 382 | ctx = runops_args(interp, sub, obj, meth, sig, args); |
|---|
| 383 | @@ -529,6 +540,7 @@ |
|---|
| 384 | ARGIN(const char *sig), va_list args) |
|---|
| 385 | { |
|---|
| 386 | void* retval; |
|---|
| 387 | + ASSERT_ARGS(Parrot_runops_fromc_arglist); |
|---|
| 388 | Parrot_Context * const ctx = runops_args(interp, sub, PMCNULL, NULL, sig, args); |
|---|
| 389 | |
|---|
| 390 | retval = set_retval(interp, *sig, ctx); |
|---|
| 391 | @@ -555,6 +567,7 @@ |
|---|
| 392 | ARGIN(const char *sig), va_list args) |
|---|
| 393 | { |
|---|
| 394 | INTVAL retval; |
|---|
| 395 | + ASSERT_ARGS(Parrot_runops_fromc_arglist_reti); |
|---|
| 396 | Parrot_Context * const ctx = runops_args(interp, sub, PMCNULL, NULL, sig, args); |
|---|
| 397 | |
|---|
| 398 | retval = set_retval_i(interp, *sig, ctx); |
|---|
| 399 | @@ -581,6 +594,7 @@ |
|---|
| 400 | ARGIN(const char *sig), va_list args) |
|---|
| 401 | { |
|---|
| 402 | FLOATVAL retval; |
|---|
| 403 | + ASSERT_ARGS(Parrot_runops_fromc_arglist_retf); |
|---|
| 404 | Parrot_Context * const ctx = runops_args(interp, sub, PMCNULL, NULL, sig, args); |
|---|
| 405 | |
|---|
| 406 | retval = set_retval_f(interp, *sig, ctx); |
|---|
| 407 | @@ -609,6 +623,7 @@ |
|---|
| 408 | { |
|---|
| 409 | Parrot_Context *ctx; |
|---|
| 410 | void* retval; |
|---|
| 411 | + ASSERT_ARGS(Parrot_run_meth_fromc_arglist); |
|---|
| 412 | |
|---|
| 413 | ctx = runops_args(interp, sub, obj, meth, sig, args); |
|---|
| 414 | retval = set_retval(interp, *sig, ctx); |
|---|
| 415 | @@ -637,6 +652,7 @@ |
|---|
| 416 | ARGIN(STRING *meth), ARGIN(const char *sig), va_list args) |
|---|
| 417 | { |
|---|
| 418 | INTVAL retval; |
|---|
| 419 | + ASSERT_ARGS(Parrot_run_meth_fromc_arglist_reti); |
|---|
| 420 | Parrot_Context * const ctx = runops_args(interp, sub, obj, meth, sig, args); |
|---|
| 421 | |
|---|
| 422 | retval = set_retval_i(interp, *sig, ctx); |
|---|
| 423 | @@ -664,6 +680,7 @@ |
|---|
| 424 | ARGIN(STRING *meth), ARGIN(const char *sig), va_list args) |
|---|
| 425 | { |
|---|
| 426 | FLOATVAL retval; |
|---|
| 427 | + ASSERT_ARGS(Parrot_run_meth_fromc_arglist_retf); |
|---|
| 428 | Parrot_Context * const ctx = runops_args(interp, sub, obj, meth, sig, args); |
|---|
| 429 | |
|---|
| 430 | retval = set_retval_f(interp, *sig, ctx); |
|---|
| 431 | @@ -693,6 +710,7 @@ |
|---|
| 432 | new_runloop_jump_point(PARROT_INTERP) |
|---|
| 433 | { |
|---|
| 434 | Parrot_runloop *jump_point; |
|---|
| 435 | + ASSERT_ARGS(new_runloop_jump_point); |
|---|
| 436 | |
|---|
| 437 | if (interp->runloop_jmp_free_list) { |
|---|
| 438 | jump_point = interp->runloop_jmp_free_list; |
|---|
| 439 | @@ -719,6 +737,7 @@ |
|---|
| 440 | void |
|---|
| 441 | free_runloop_jump_point(PARROT_INTERP) |
|---|
| 442 | { |
|---|
| 443 | + ASSERT_ARGS(free_runloop_jump_point); |
|---|
| 444 | Parrot_runloop * const jump_point = interp->current_runloop; |
|---|
| 445 | interp->current_runloop = jump_point->prev; |
|---|
| 446 | jump_point->prev = interp->runloop_jmp_free_list; |
|---|
| 447 | @@ -739,6 +758,7 @@ |
|---|
| 448 | void |
|---|
| 449 | destroy_runloop_jump_points(PARROT_INTERP) |
|---|
| 450 | { |
|---|
| 451 | + ASSERT_ARGS(destroy_runloop_jump_points); |
|---|
| 452 | really_destroy_runloop_jump_points(interp->current_runloop); |
|---|
| 453 | really_destroy_runloop_jump_points(interp->runloop_jmp_free_list); |
|---|
| 454 | } |
|---|
| 455 | @@ -758,6 +778,7 @@ |
|---|
| 456 | void |
|---|
| 457 | really_destroy_runloop_jump_points(ARGIN_NULLOK(Parrot_runloop *jump_point)) |
|---|
| 458 | { |
|---|
| 459 | + ASSERT_ARGS(really_destroy_runloop_jump_points); |
|---|
| 460 | while (jump_point) { |
|---|
| 461 | Parrot_runloop * const prev = jump_point->prev; |
|---|
| 462 | mem_sys_free(jump_point); |
|---|
| 463 | Index: include/parrot/atomic/gcc_x86.h |
|---|
| 464 | =================================================================== |
|---|
| 465 | --- include/parrot/atomic/gcc_x86.h (.../trunk) (revision 34776) |
|---|
| 466 | +++ include/parrot/atomic/gcc_x86.h (.../branches/assert_args) (revision 34785) |
|---|
| 467 | @@ -33,6 +33,10 @@ |
|---|
| 468 | long parrot_i386_xadd(ARGIN(volatile long *l), long amount) |
|---|
| 469 | __attribute__nonnull__(1); |
|---|
| 470 | |
|---|
| 471 | +#define ASSERT_ARGS_parrot_i386_cmpxchg assert(ptr); \ |
|---|
| 472 | + assert(expect); \ |
|---|
| 473 | + assert(update); |
|---|
| 474 | +#define ASSERT_ARGS_parrot_i386_xadd assert(l); |
|---|
| 475 | /* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */ |
|---|
| 476 | /* HEADERIZER END: src/atomic/gcc_x86.c */ |
|---|
| 477 | |
|---|
| 478 | Index: include/parrot/exec.h |
|---|
| 479 | =================================================================== |
|---|
| 480 | --- include/parrot/exec.h (.../trunk) (revision 34776) |
|---|
| 481 | +++ include/parrot/exec.h (.../branches/assert_args) (revision 34785) |
|---|
| 482 | @@ -149,6 +149,21 @@ |
|---|
| 483 | __attribute__nonnull__(2) |
|---|
| 484 | FUNC_MODIFIES(*obj); |
|---|
| 485 | |
|---|
| 486 | +#define ASSERT_ARGS_Parrot_exec_add_text_rellocation assert(obj); \ |
|---|
| 487 | + assert(nptr); \ |
|---|
| 488 | + assert(symbol); |
|---|
| 489 | +#define ASSERT_ARGS_Parrot_exec_add_text_rellocation_func assert(obj); \ |
|---|
| 490 | + assert(nptr); \ |
|---|
| 491 | + assert(func_name); |
|---|
| 492 | +#define ASSERT_ARGS_Parrot_exec_add_text_rellocation_reg assert(obj); \ |
|---|
| 493 | + assert(nptr); \ |
|---|
| 494 | + assert(var); |
|---|
| 495 | +#define ASSERT_ARGS_Parrot_exec assert(interp); \ |
|---|
| 496 | + assert(pc); \ |
|---|
| 497 | + assert(code_start); \ |
|---|
| 498 | + assert(code_end); |
|---|
| 499 | +#define ASSERT_ARGS_Parrot_exec_add_symbol assert(obj); \ |
|---|
| 500 | + assert(symbol); |
|---|
| 501 | /* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */ |
|---|
| 502 | /* HEADERIZER END: src/exec.c */ |
|---|
| 503 | |
|---|
| 504 | Index: compilers/imcc/sets.c |
|---|
| 505 | =================================================================== |
|---|
| 506 | --- compilers/imcc/sets.c (.../trunk) (revision 34776) |
|---|
| 507 | +++ compilers/imcc/sets.c (.../branches/assert_args) (revision 34785) |
|---|
| 508 | @@ -51,6 +51,7 @@ |
|---|
| 509 | Set* |
|---|
| 510 | set_make(unsigned int length) |
|---|
| 511 | { |
|---|
| 512 | + ASSERT_ARGS(set_make); |
|---|
| 513 | Set * const s = mem_allocate_zeroed_typed(Set); |
|---|
| 514 | s->length = length; |
|---|
| 515 | s->bmp = mem_allocate_n_zeroed_typed(NUM_BYTES(length), |
|---|
| 516 | @@ -75,6 +76,7 @@ |
|---|
| 517 | Set* |
|---|
| 518 | set_make_full(unsigned int length) |
|---|
| 519 | { |
|---|
| 520 | + ASSERT_ARGS(set_make_full); |
|---|
| 521 | Set * const s = set_make(length); |
|---|
| 522 | const size_t bytes = NUM_BYTES(length); |
|---|
| 523 | |
|---|
| 524 | @@ -98,6 +100,7 @@ |
|---|
| 525 | void |
|---|
| 526 | set_free(ARGMOD(Set *s)) |
|---|
| 527 | { |
|---|
| 528 | + ASSERT_ARGS(set_free); |
|---|
| 529 | if (s->bmp) |
|---|
| 530 | mem_sys_free(s->bmp); |
|---|
| 531 | |
|---|
| 532 | @@ -118,6 +121,7 @@ |
|---|
| 533 | void |
|---|
| 534 | set_clear(ARGMOD(Set *s)) |
|---|
| 535 | { |
|---|
| 536 | + ASSERT_ARGS(set_clear); |
|---|
| 537 | memset(s->bmp, 0, NUM_BYTES(s->length)); |
|---|
| 538 | } |
|---|
| 539 | |
|---|
| 540 | @@ -137,6 +141,7 @@ |
|---|
| 541 | Set* |
|---|
| 542 | set_copy(ARGIN(const Set *s)) |
|---|
| 543 | { |
|---|
| 544 | + ASSERT_ARGS(set_copy); |
|---|
| 545 | Set * const d = set_make(s->length); |
|---|
| 546 | |
|---|
| 547 | memcpy(d->bmp, s->bmp, NUM_BYTES(d->length)); |
|---|
| 548 | @@ -161,6 +166,7 @@ |
|---|
| 549 | set_equal(ARGIN(const Set *s1), ARGIN(const Set *s2)) |
|---|
| 550 | { |
|---|
| 551 | int mask; |
|---|
| 552 | + ASSERT_ARGS(set_equal); |
|---|
| 553 | const size_t bytes = s1->length / 8; |
|---|
| 554 | |
|---|
| 555 | if (s1->length != s2->length) |
|---|
| 556 | @@ -195,6 +201,7 @@ |
|---|
| 557 | void |
|---|
| 558 | set_add(ARGMOD(Set *s), unsigned int element) |
|---|
| 559 | { |
|---|
| 560 | + ASSERT_ARGS(set_add); |
|---|
| 561 | const int elem_byte_in_set = BYTE_IN_SET(element); |
|---|
| 562 | const int bytes_in_set = BYTE_IN_SET(s->length); |
|---|
| 563 | |
|---|
| 564 | @@ -295,6 +302,7 @@ |
|---|
| 565 | set_union(ARGIN(const Set *s1), ARGIN(const Set *s2)) |
|---|
| 566 | { |
|---|
| 567 | unsigned int i; |
|---|
| 568 | + ASSERT_ARGS(set_union); |
|---|
| 569 | Set * const s = set_make(s1->length); |
|---|
| 570 | |
|---|
| 571 | if (s1->length != s2->length) |
|---|
| 572 | @@ -326,8 +334,9 @@ |
|---|
| 573 | Set * |
|---|
| 574 | set_intersec(ARGIN(const Set *s1), ARGIN(const Set *s2)) |
|---|
| 575 | { |
|---|
| 576 | + unsigned int i; |
|---|
| 577 | + ASSERT_ARGS(set_intersec); |
|---|
| 578 | Set * const s = set_make(s1->length); |
|---|
| 579 | - unsigned int i; |
|---|
| 580 | |
|---|
| 581 | if (s1->length != s2->length) |
|---|
| 582 | fatal(1, "set_intersec", "Sets don't have the same length\n"); |
|---|
| 583 | @@ -355,6 +364,7 @@ |
|---|
| 584 | set_intersec_inplace(ARGMOD(Set *s1), ARGIN(const Set *s2)) |
|---|
| 585 | { |
|---|
| 586 | unsigned int i; |
|---|
| 587 | + ASSERT_ARGS(set_intersec_inplace); |
|---|
| 588 | |
|---|
| 589 | if (s1->length != s2->length) |
|---|
| 590 | fatal(1, "set_intersec_inplace", "Sets don't have the same length\n"); |
|---|