Front page | perl.cvs.parrot |
Postings from December 2008
[svn:parrot] r34727 - in trunk: compilers/imcc src src/gc
From:
infinoid
Date:
December 31, 2008 16:20
Subject:
[svn:parrot] r34727 - in trunk: compilers/imcc src src/gc
Message ID:
20090101002047.9D22BCB9FA@x12.develooper.com
Author: infinoid
Date: Wed Dec 31 16:20:46 2008
New Revision: 34727
Modified:
trunk/compilers/imcc/pbc.c
trunk/compilers/imcc/pcc.c
trunk/compilers/imcc/reg_alloc.c
trunk/src/cpu_dep.c
trunk/src/gc/dod.c
trunk/src/gc/gc_gms.c
trunk/src/inter_cb.c
trunk/src/interpreter.c
trunk/src/library.c
Log:
[core] Add argument asserts to another 176 functions.
Modified: trunk/compilers/imcc/pbc.c
==============================================================================
--- trunk/compilers/imcc/pbc.c (original)
+++ trunk/compilers/imcc/pbc.c Wed Dec 31 16:20:46 2008
@@ -286,6 +286,7 @@
imcc_globals_destroy(PARROT_INTERP, SHIM(int ex), SHIM(void *param))
{
code_segment_t *cs = IMCC_INFO(interp)->globals->cs;
+ ASSERT_ARGS(imcc_globals_destroy);
while (cs) {
subs_t *s = cs->subs;
@@ -325,6 +326,7 @@
/* Allocate a new constant */
PackFile_Constant *new_constant = PackFile_Constant_new(interp);
+ ASSERT_ARGS(add_const_table);
/* Update the constant count and reallocate */
if (interp->code->const_table->constants)
@@ -356,6 +358,7 @@
add_const_table_pmc(PARROT_INTERP, ARGIN(PMC *pmc))
{
int newitem = add_const_table(interp);
+ ASSERT_ARGS(add_const_table_pmc);
interp->code->const_table->constants[newitem]->type = PFC_PMC;
interp->code->const_table->constants[newitem]->u.key = pmc;
@@ -378,6 +381,7 @@
add_const_table_key(PARROT_INTERP, ARGIN(PMC *key))
{
int newitem = add_const_table(interp);
+ ASSERT_ARGS(add_const_table_key);
interp->code->const_table->constants[newitem]->type = PFC_KEY;
interp->code->const_table->constants[newitem]->u.key = key;
@@ -400,6 +404,7 @@
e_pbc_open(PARROT_INTERP, SHIM(void *param))
{
code_segment_t *cs = mem_allocate_zeroed_typed(code_segment_t);
+ ASSERT_ARGS(e_pbc_open);
if (!IMCC_INFO(interp)->globals)
IMCC_INFO(interp)->globals = mem_allocate_zeroed_typed(imcc_globals);
@@ -467,6 +472,7 @@
{
const subs_t *s;
size_t size = 0;
+ ASSERT_ARGS(old_blocks);
for (s = IMCC_INFO(interp)->globals->cs->subs; s; s = s->prev) {
size += s->n_basic_blocks;
@@ -493,6 +499,7 @@
{
const size_t old = old_blocks(interp);
const size_t size = unit->n_basic_blocks + old;
+ ASSERT_ARGS(make_jit_info);
if (!IMCC_INFO(interp)->globals->cs->jit_info) {
const size_t len =
@@ -539,6 +546,7 @@
make_new_sub(PARROT_INTERP, ARGIN(IMC_Unit *unit))
{
subs_t * const s = mem_allocate_zeroed_typed(subs_t);
+ ASSERT_ARGS(make_new_sub);
s->prev = IMCC_INFO(interp)->globals->cs->subs;
s->unit = unit;
@@ -571,6 +579,7 @@
get_old_size(PARROT_INTERP, ARGOUT(int *ins_line))
{
size_t size = 0;
+ ASSERT_ARGS(get_old_size);
*ins_line = 0;
@@ -599,6 +608,7 @@
static void
store_sub_size(PARROT_INTERP, size_t size, size_t ins_line)
{
+ ASSERT_ARGS(store_sub_size);
IMCC_INFO(interp)->globals->cs->subs->size = size;
IMCC_INFO(interp)->globals->cs->subs->ins_line = ins_line;
}
@@ -619,6 +629,7 @@
{
SymReg * const fixup = _mk_address(interp,
&IMCC_INFO(interp)->globals->cs->subs->fixup, r->name, U_add_all);
+ ASSERT_ARGS(store_fixup);
if (r->set == 'p')
fixup->set = 'p';
@@ -650,6 +661,7 @@
{
SymReg * const c =
_mk_const(&IMCC_INFO(interp)->globals->cs->key_consts, str, 0);
+ ASSERT_ARGS(store_key_const);
c->color = idx;
}
@@ -669,6 +681,7 @@
{
Instruction *ins = unit->instructions;
size_t code_size;
+ ASSERT_ARGS(get_codesize);
/* run through instructions:
* - sanity check
@@ -729,6 +742,7 @@
ARGIN(const subs_t *sym), ARGOUT(int *pc))
{
subs_t *s;
+ ASSERT_ARGS(find_global_label);
*pc = 0;
@@ -754,6 +768,7 @@
ARGIN(const subs_t *sym), ARGOUT(int *pc))
{
subs_t *s;
+ ASSERT_ARGS(find_sub_by_subid);
UNUSED(sym);
*pc = 0;
@@ -785,6 +800,7 @@
{
subs_t *s;
int jumppc = 0;
+ ASSERT_ARGS(fixup_globals);
for (s = IMCC_INFO(interp)->globals->cs->first; s; s = s->next) {
const SymHash * const hsh = &s->fixup;
@@ -894,6 +910,7 @@
IMCC_string_from_reg(PARROT_INTERP, ARGIN(const SymReg *r))
{
const char *buf = r->name;
+ ASSERT_ARGS(IMCC_string_from_reg);
if (r->type & VT_ENCODED) {
/*
@@ -936,6 +953,7 @@
IMCC_string_from__STRINGC(PARROT_INTERP, ARGIN(const char *buf))
{
const int ascii = (*buf == '\'' || *buf == '"');
+ ASSERT_ARGS(IMCC_string_from__STRINGC);
if (!ascii) {
/*
* the lexer parses: foo:"string"
@@ -987,6 +1005,7 @@
{
const int k = add_const_table(interp);
STRING * const s = IMCC_string_from_reg(interp, r);
+ ASSERT_ARGS(add_const_str);
interp->code->const_table->constants[k]->type = PFC_STRING;
interp->code->const_table->constants[k]->u.string = s;
@@ -1011,6 +1030,7 @@
{
const int k = add_const_table(interp);
STRING * const s = string_from_cstring(interp, buf, 0);
+ ASSERT_ARGS(add_const_num);
interp->code->const_table->constants[k]->type = PFC_NUMBER;
interp->code->const_table->constants[k]->u.number = string_to_num(interp, s);
@@ -1039,6 +1059,7 @@
pcc_sub_t * const pcc_sub = r->pcc_sub;
const INTVAL n = pcc_sub->nmulti;
INTVAL i;
+ ASSERT_ARGS(mk_multi_sig);
/* a :multi sub with no arguments */
if (!pcc_sub->multi[0])
@@ -1104,6 +1125,7 @@
const INTVAL lex_info_id = Parrot_get_ctx_HLL_type(interp,
enum_class_LexInfo);
unsigned int i;
+ ASSERT_ARGS(create_lexinfo);
for (i = 0; i < hsh->size; i++) {
SymReg *r;
@@ -1171,6 +1193,7 @@
PMC *current;
STRING *cur_name;
size_t len;
+ ASSERT_ARGS(find_outer);
if (!unit->outer)
return NULL;
@@ -1246,6 +1269,7 @@
int i;
int ns_const = -1;
+ ASSERT_ARGS(add_const_pmc_sub);
IMCC_INFO(interp)->globals->cs->subs->pmc_const = k;
@@ -1456,6 +1480,7 @@
const opcode_t *rc;
PackFile_Constant *pfc;
int k;
+ ASSERT_ARGS(add_const_key);
if (r)
return r->color;
@@ -1502,6 +1527,7 @@
static const char *
slice_deb(int bits)
{
+ ASSERT_ARGS(slice_deb);
if ((bits & VT_SLICE_BITS) == (VT_START_SLICE|VT_END_SLICE))
return "start+end";
@@ -1555,6 +1581,7 @@
*s = 0;
reg = key_reg->set == 'K' ? key_reg->nextkey : key_reg;
+ ASSERT_ARGS(build_key);
for (key_length = 0; reg ; reg = reg->nextkey, key_length++) {
SymReg *r = reg;
@@ -1666,6 +1693,7 @@
IMCC_int_from_reg(PARROT_INTERP, ARGIN(const SymReg *r))
{
INTVAL i;
+ ASSERT_ARGS(IMCC_int_from_reg);
errno = 0;
@@ -1712,6 +1740,7 @@
PMC *_class = interp->vtables[r->pmc_type]->pmc_class;
STRING *s;
PMC *p;
+ ASSERT_ARGS(make_pmc_const);
if (*r->name == '"')
s = string_unescape_cstring(interp, r->name + 1, '"', NULL);
@@ -1742,6 +1771,7 @@
static void
add_1_const(PARROT_INTERP, ARGMOD(SymReg *r))
{
+ ASSERT_ARGS(add_1_const);
if (r->color >= 0)
return;
@@ -1800,6 +1830,7 @@
{
const SymHash *hsh = &IMCC_INFO(interp)->ghash;
unsigned int i;
+ ASSERT_ARGS(constant_folding);
/* go through all consts of current sub */
for (i = 0; i < hsh->size; i++) {
@@ -1856,6 +1887,7 @@
int
e_pbc_new_sub(PARROT_INTERP, SHIM(void *param), ARGIN(IMC_Unit *unit))
{
+ ASSERT_ARGS(e_pbc_new_sub);
if (!unit->instructions)
return 0;
@@ -1880,6 +1912,7 @@
{
Instruction *ins;
int pragma;
+ ASSERT_ARGS(e_pbc_end_sub);
if (!unit->instructions)
return 0;
@@ -1940,6 +1973,7 @@
|| ins->opnum == PARROT_OP_get_params_pc);
INTVAL i, n;
+ ASSERT_ARGS(verify_signature);
PARROT_ASSERT(PObj_is_PMC_TEST(sig_arr));
PARROT_ASSERT(sig_arr->vtable->base_type == enum_class_FixedIntegerArray);
@@ -2013,6 +2047,7 @@
op_info_t *op_info;
int ok = 0;
int op, i;
+ ASSERT_ARGS(e_pbc_emit);
#if IMC_TRACE_HIGH
Parrot_io_eprintf(NULL, "e_pbc_emit\n");
@@ -2241,6 +2276,7 @@
int
e_pbc_close(PARROT_INTERP, SHIM(void *param))
{
+ ASSERT_ARGS(e_pbc_close);
fixup_globals(interp);
return 0;
Modified: trunk/compilers/imcc/pcc.c
==============================================================================
--- trunk/compilers/imcc/pcc.c (original)
+++ trunk/compilers/imcc/pcc.c Wed Dec 31 16:20:46 2008
@@ -160,6 +160,7 @@
{
/* INS can return NULL, but insert_ins() cannot take one */
Instruction * const tmp = INS(interp, unit, name, NULL, regs, n, 0, 0);
+ ASSERT_ARGS(insINS);
if (tmp)
insert_ins(unit, ins, tmp);
return tmp;
@@ -181,6 +182,7 @@
get_pasm_reg(PARROT_INTERP, ARGIN(const char *name))
{
SymReg * const r = _get_sym(&IMCC_INFO(interp)->cur_unit->hash, name);
+ ASSERT_ARGS(get_pasm_reg);
if (r)
return r;
@@ -204,6 +206,7 @@
get_const(PARROT_INTERP, ARGIN(const char *name), int type)
{
SymReg * const r = _get_sym(&IMCC_INFO(interp)->ghash, name);
+ ASSERT_ARGS(get_const);
if (r && r->set == type)
return r;
@@ -262,6 +265,7 @@
char *buf = n < PCC_GET_ARGS_LIMIT ?
bufcache :
mem_allocate_n_typed(bufsize, char);
+ ASSERT_ARGS(pcc_get_args);
memcpy(buf, pref, lenpref);
bufpos += lenpref;
@@ -340,6 +344,7 @@
struct pcc_sub_t * const pcc_sub = sub->pcc_sub;
const int n = pcc_sub->nargs;
int i;
+ ASSERT_ARGS(unshift_self);
mem_realloc_n_typed(pcc_sub->args, n + 1, SymReg *);
mem_realloc_n_typed(pcc_sub->arg_flags, n + 1, int);
@@ -372,6 +377,7 @@
int nargs;
SymReg *sub = ins->symregs[0];
SymReg *regs[2];
+ ASSERT_ARGS(expand_pcc_sub);
/* if this sub is a method, unshift 'self' as first param */
if ((unit->type & IMC_HAS_SELF) || (sub->pcc_sub->pragma & P_METHOD)) {
@@ -449,6 +455,7 @@
const int is_yield = ins->type & ITPCCYIELD;
SymReg * const sub = ins->symregs[0];
const int n = sub->pcc_sub->nret;
+ ASSERT_ARGS(expand_pcc_sub_ret);
/* TODO implement return conventions */
ins = pcc_get_args(interp, unit, ins, "set_returns", n,
@@ -495,6 +502,7 @@
SymReg *src = NULL;
SymReg *dest = NULL;
SymReg *regs[3];
+ ASSERT_ARGS(pcc_reg_mov);
if (d == 255) {
int t;
@@ -566,6 +574,7 @@
unsigned char *move_list;
move_info_t move_info;
unsigned int i;
+ ASSERT_ARGS(move_regs);
if (!n)
return ins;
@@ -622,6 +631,7 @@
SymReg *regs[2];
Instruction *get_params, *tmp_ins, *unused_ins;
char *buf;
+ ASSERT_ARGS(recursive_tail_call);
if (!(unit->instructions->type & ITLABEL))
return 0;
@@ -682,6 +692,7 @@
ARGMOD(SymReg *sub), ARGIN_NULLOK(SymReg *meth))
{
SymReg *regs[3];
+ ASSERT_ARGS(insert_tail_call);
if (meth) {
regs[0] = sub->pcc_sub->object;
@@ -720,6 +731,7 @@
Instruction *get_name;
SymReg * const sub = ins->symregs[0];
+ ASSERT_ARGS(expand_pcc_sub_call);
if (ins->type & ITRESULT) {
const int n = sub->pcc_sub->nret;
Modified: trunk/compilers/imcc/reg_alloc.c
==============================================================================
--- trunk/compilers/imcc/reg_alloc.c (original)
+++ trunk/compilers/imcc/reg_alloc.c Wed Dec 31 16:20:46 2008
@@ -215,6 +215,7 @@
{
unsigned int bit = i * N + j;
*bit_ofs = bit % sizeof (*graph);
+ ASSERT_ARGS(ig_get_word);
return &graph[bit / sizeof (*graph)];
}
@@ -234,6 +235,7 @@
{
int bit_ofs;
unsigned int *word = ig_get_word(i, j, N, graph, &bit_ofs);
+ ASSERT_ARGS(ig_set);
*word |= (1 << bit_ofs);
}
@@ -252,6 +254,7 @@
{
int bit_ofs;
unsigned int* word = ig_get_word(i, j, N, graph, &bit_ofs);
+ ASSERT_ARGS(ig_test);
return *word & (1 << bit_ofs);
}
@@ -274,6 +277,7 @@
*/
const int need_bits = N * N;
const int num_words = (need_bits + sizeof (int) - 1) / sizeof (int);
+ ASSERT_ARGS(ig_allocate);
return (unsigned int *)mem_sys_allocate_zeroed(num_words * sizeof (int));
}
@@ -292,6 +296,7 @@
imc_reg_alloc(PARROT_INTERP, ARGIN_NULLOK(IMC_Unit *unit))
{
const char *function;
+ ASSERT_ARGS(imc_reg_alloc);
if (!unit)
return;
@@ -396,6 +401,7 @@
void
free_reglist(ARGMOD(IMC_Unit *unit))
{
+ ASSERT_ARGS(free_reglist);
#if IMC_TRACE
fprintf(stderr, "reg_alloc.c: free_reglist\n");
#endif
@@ -429,6 +435,7 @@
void
graph_coloring_reg_alloc(PARROT_INTERP, ARGMOD(IMC_Unit *unit))
{
+ ASSERT_ARGS(graph_coloring_reg_alloc);
build_interference_graph(interp, unit);
try_allocate(interp, unit);
@@ -452,6 +459,7 @@
/* register usage summary */
SymHash * const hsh = &unit->hash;
unsigned int i;
+ ASSERT_ARGS(make_stat);
for (i = 0; i < hsh->size; i++) {
SymReg *r;
@@ -503,6 +511,7 @@
imc_stat_init(ARGMOD(IMC_Unit *unit))
{
int j;
+ ASSERT_ARGS(imc_stat_init);
make_stat(unit, unit->n_vars_used, NULL);
@@ -533,6 +542,7 @@
unit->instructions->symreg_count
? unit->instructions->symregs[0]->name
: "(not a function)";
+ ASSERT_ARGS(print_stat);
make_stat(unit, sets, unit->n_regs_used);
IMCC_info(interp, 1,
@@ -576,6 +586,7 @@
{
const SymReg * const ra = *(SymReg**)a;
const SymReg * const rb = *(SymReg**)b;
+ ASSERT_ARGS(reg_sort_f);
if (ra->first_ins->index < rb->first_ins->index)
return -1;
@@ -599,6 +610,7 @@
static void
sort_reglist(ARGMOD(IMC_Unit *unit))
{
+ ASSERT_ARGS(sort_reglist);
qsort(unit->reglist, unit->n_symbols, sizeof (SymReg *), reg_sort_f);
}
@@ -626,6 +638,7 @@
{
SymHash const *hsh = &unit->hash;
unsigned int i, count, unused, n_symbols;
+ ASSERT_ARGS(build_reglist);
IMCC_info(interp, 2, "build_reglist\n");
@@ -688,6 +701,7 @@
{
unsigned int i, count, unused;
static const char types[] = "INSP";
+ ASSERT_ARGS(rebuild_reglist);
for (i = count = unused = 0; i < unit->n_symbols; i++) {
SymReg * const r = unit->reglist[i];
@@ -741,6 +755,7 @@
unsigned int *interference_graph;
const int n_symbols = unit->n_symbols;
+ ASSERT_ARGS(build_interference_graph);
if (!n_symbols)
return;
@@ -788,6 +803,7 @@
Instruction *ins = unit->instructions;
Instruction *lastbranch = NULL;
unsigned int i;
+ ASSERT_ARGS(compute_du_chain);
/* Compute last branch in this procedure, update instruction index */
for (i = 0; ins; ins = ins->next) {
@@ -824,6 +840,7 @@
compute_one_du_chain(ARGMOD(SymReg *r), ARGIN(IMC_Unit *unit))
{
Instruction * ins;
+ ASSERT_ARGS(compute_one_du_chain);
/* We cannot rely on computing the value of r->first when parsing,
* since the situation can be changed at any time by the register
@@ -875,6 +892,7 @@
ARGIN(const SymReg *r0), ARGIN(const SymReg *r1))
{
unsigned int i;
+ ASSERT_ARGS(interferes);
/* Registers don't interfere with themselves */
if (r0 == r1)
@@ -963,6 +981,7 @@
ig_find_color(ARGIN(const IMC_Unit *unit), ARGIN(const char *avail))
{
unsigned int c;
+ ASSERT_ARGS(ig_find_color);
for (c = 0; c < unit->n_symbols; c++)
if (avail[c])
@@ -996,6 +1015,7 @@
/* unit->n_symbols should be an upper limit of needed colors */
unsigned int n = unit->n_symbols;
+ ASSERT_ARGS(try_allocate);
if (unit->max_color >= (int)n)
n = unit->max_color + 1;
@@ -1062,6 +1082,7 @@
{
const int n_symbols = unit->n_symbols;
int y;
+ ASSERT_ARGS(map_colors);
for (y = 0; y < n_symbols; y++) {
if (ig_test(x, y, n_symbols, graph)) {
@@ -1097,6 +1118,7 @@
const SymHash * const hsh = &unit->hash;
unsigned int i, first;
+ ASSERT_ARGS(first_avail);
/* find allocated registers */
for (i = 0; i < hsh->size; i++) {
@@ -1137,6 +1159,7 @@
Set *sets[4] = { NULL, NULL, NULL, NULL };
SymReg *r;
unsigned int i;
+ ASSERT_ARGS(allocate_uniq);
for (i = 0; i < hsh->size; i++) {
for (r = hsh->data[i]; r; r = r->next) {
@@ -1201,6 +1224,7 @@
SymReg *r;
unsigned int i, j;
int reg_set, first_reg;
+ ASSERT_ARGS(vanilla_reg_alloc);
/* Clear the pre-assigned colors. */
for (i = 0; i < hsh->size; i++) {
@@ -1248,6 +1272,7 @@
static void
allocate_lexicals(PARROT_INTERP, ARGMOD(IMC_Unit *unit))
{
+ ASSERT_ARGS(allocate_lexicals);
IMCC_debug(interp, DEBUG_IMC, "allocate lexicals\n");
allocate_uniq(interp, unit, U_LEXICAL);
}
@@ -1265,6 +1290,7 @@
static void
allocate_non_volatile(PARROT_INTERP, ARGMOD(IMC_Unit *unit))
{
+ ASSERT_ARGS(allocate_non_volatile);
IMCC_debug(interp, DEBUG_IMC, "allocate non_volatile\n");
allocate_uniq(interp, unit, U_NON_VOLATILE);
}
Modified: trunk/src/cpu_dep.c
==============================================================================
--- trunk/src/cpu_dep.c (original)
+++ trunk/src/cpu_dep.c Wed Dec 31 16:20:46 2008
@@ -63,15 +63,17 @@
void
trace_system_areas(PARROT_INTERP)
{
+ ASSERT_ARGS(trace_system_areas);
+ {
#if defined(__sparc)
- /* Flush the register windows. For sparc systems, we use hand-coded
- assembly language to create a small function that flushes the
- register windows. Store the code in a union with a double to
- ensure proper memory alignment. */
- static union {
- unsigned int insns[4];
- double align_hack[2];
- } u = { {
+ /* Flush the register windows. For sparc systems, we use hand-coded
+ assembly language to create a small function that flushes the
+ register windows. Store the code in a union with a double to
+ ensure proper memory alignment. */
+ static union {
+ unsigned int insns[4];
+ double align_hack[2];
+ } u = { {
# ifdef __sparcv9
0x81580000, /* flushw */
# else
@@ -79,53 +81,54 @@
# endif
0x81c3e008, /* retl */
0x01000000 /* nop */
- } };
+ } };
- /* Turn the array of machine code values above into a function pointer.
- Call the new function pointer to flush the register windows. */
- static void (*fn_ptr)(void) = (void (*)(void))&u.align_hack[0];
- fn_ptr();
+ /* Turn the array of machine code values above into a function pointer.
+ Call the new function pointer to flush the register windows. */
+ static void (*fn_ptr)(void) = (void (*)(void))&u.align_hack[0];
+ fn_ptr();
#elif defined(__ia64__)
- /* On IA64 systems, we use the function getcontext() to get the current
- processor context. This function is located in <ucontext.h>, included
- above. */
- struct ucontext ucp;
- void *current_regstore_top;
-
- getcontext(&ucp);
-
- /* flush_reg_store() is defined in config/gen/platforms/ia64/asm.s.
- it calls the flushrs opcode to perform the register flush, and
- returns the address of the register backing stack. */
- current_regstore_top = flush_reg_store();
-
- /* Trace the memory block for the register backing stack, which
- is separate from the normal system stack. The register backing
- stack starts at memory address 0x80000FFF80000000 and ends at
- current_regstore_top. */
- trace_mem_block(interp, 0x80000fff80000000,
- (size_t)current_regstore_top);
+ /* On IA64 systems, we use the function getcontext() to get the current
+ processor context. This function is located in <ucontext.h>, included
+ above. */
+ struct ucontext ucp;
+ void *current_regstore_top;
+
+ getcontext(&ucp);
+
+ /* flush_reg_store() is defined in config/gen/platforms/ia64/asm.s.
+ it calls the flushrs opcode to perform the register flush, and
+ returns the address of the register backing stack. */
+ current_regstore_top = flush_reg_store();
+
+ /* Trace the memory block for the register backing stack, which
+ is separate from the normal system stack. The register backing
+ stack starts at memory address 0x80000FFF80000000 and ends at
+ current_regstore_top. */
+ trace_mem_block(interp, 0x80000fff80000000,
+ (size_t)current_regstore_top);
#else
# ifdef PARROT_HAS_HEADER_SETJMP
- /* A jump buffer that is used to store the current processor context.
- local variables like this are created on the stack. */
- Parrot_jump_buff env;
-
- /* Zero the Parrot_jump_buff, otherwise you will trace stale objects.
- Plus, optimizing compilers won't be so quick to optimize the data
- away if we're passing pointers around. */
- memset(&env, 0, sizeof (env));
-
- /* this should put registers in env, which then get marked in
- * trace_system_stack below
- */
- setjmp(env);
+ /* A jump buffer that is used to store the current processor context.
+ local variables like this are created on the stack. */
+ Parrot_jump_buff env;
+
+ /* Zero the Parrot_jump_buff, otherwise you will trace stale objects.
+ Plus, optimizing compilers won't be so quick to optimize the data
+ away if we're passing pointers around. */
+ memset(&env, 0, sizeof (env));
+
+ /* this should put registers in env, which then get marked in
+ * trace_system_stack below
+ */
+ setjmp(env);
# endif
#endif
+ }
/* With the processor context accounted for above, we can trace the
system stack here. */
@@ -153,6 +156,7 @@
the "bottom" of the stack. We must trace the entire area between the
top and bottom. */
const size_t lo_var_ptr = (size_t)interp->lo_var_ptr;
+ ASSERT_ARGS(trace_system_stack);
trace_mem_block(interp, (size_t)lo_var_ptr,
(size_t)&lo_var_ptr);
Modified: trunk/src/gc/dod.c
==============================================================================
--- trunk/src/gc/dod.c (original)
+++ trunk/src/gc/dod.c Wed Dec 31 16:20:46 2008
@@ -99,6 +99,7 @@
{
int hi_prio;
Arenas *arena_base;
+ ASSERT_ARGS(mark_special);
/*
* If the object is shared, we have to use the arena and dod
@@ -189,7 +190,7 @@
void
pobject_lives(PARROT_INTERP, ARGMOD(PObj *obj))
{
- PARROT_ASSERT(obj);
+ ASSERT_ARGS(pobject_lives);
#if PARROT_GC_GMS
do {
if (!PObj_live_TEST(obj) && \
@@ -264,6 +265,7 @@
Arenas * const arena_base = interp->arena_base;
Parrot_Context *ctx;
PObj *obj;
+ ASSERT_ARGS(Parrot_dod_trace_root);
/* note: adding locals here did cause increased DOD runs */
mark_context_start();
@@ -372,6 +374,7 @@
static int
trace_active_PMCs(PARROT_INTERP, int trace_stack)
{
+ ASSERT_ARGS(trace_active_PMCs);
if (!Parrot_dod_trace_root(interp, trace_stack))
return 0;
@@ -398,6 +401,7 @@
PMC *current = arena_base->dod_mark_start;
const UINTVAL mask = PObj_data_is_PMC_array_FLAG | PObj_custom_mark_FLAG;
+ ASSERT_ARGS(Parrot_dod_trace_children);
/*
* First phase of mark is finished. Now if we are the owner
@@ -483,6 +487,7 @@
{
/* malloced array of PMCs */
PMC ** const data = PMC_data_typed(p, PMC **);
+ ASSERT_ARGS(Parrot_dod_trace_pmc_data);
if (data) {
INTVAL i;
@@ -510,6 +515,7 @@
{
const UINTVAL object_size = pool->object_size;
Small_Object_Arena *cur_arena;
+ ASSERT_ARGS(clear_cow);
/* clear refcount for COWable objects. */
for (cur_arena = pool->last_Arena;
@@ -555,6 +561,7 @@
{
const UINTVAL object_size = pool->object_size;
Small_Object_Arena *cur_arena;
+ ASSERT_ARGS(used_cow);
for (cur_arena = pool->last_Arena;
NULL != cur_arena; cur_arena = cur_arena->prev) {
@@ -602,6 +609,7 @@
Small_Object_Arena *cur_arena;
dod_object_fn_type dod_object = pool->dod_object;
+ ASSERT_ARGS(Parrot_dod_sweep);
#if GC_VERBOSE
if (Interp_trace_TEST(interp, 1)) {
@@ -689,6 +697,7 @@
{
PMC * const pmc = (PMC *)p;
Arenas * const arena_base = interp->arena_base;
+ ASSERT_ARGS(Parrot_dod_free_pmc);
/* TODO collect objects with finalizers */
if (PObj_needs_early_DOD_TEST(p))
@@ -726,6 +735,7 @@
/* if the PMC has a PMC_EXT structure, return it to the pool/arena */
Arenas * const arena_base = interp->arena_base;
Small_Object_Pool * const ext_pool = arena_base->pmc_ext_pool;
+ ASSERT_ARGS(Parrot_free_pmc_ext);
if (PObj_is_PMC_shared_TEST(p) && PMC_sync(p)) {
MUTEX_DESTROY(PMC_sync(p)->pmc_lock);
@@ -756,6 +766,7 @@
Parrot_dod_free_sysmem(SHIM_INTERP, SHIM(Small_Object_Pool *pool),
ARGMOD(PObj *b))
{
+ ASSERT_ARGS(Parrot_dod_free_sysmem);
/* has sysmem allocated, e.g. string_pin */
if (PObj_sysmem_TEST(b) && PObj_bufstart(b))
mem_sys_free(PObj_bufstart(b));
@@ -780,7 +791,7 @@
Parrot_dod_free_buffer_malloc(SHIM_INTERP, SHIM(Small_Object_Pool *pool),
ARGMOD(PObj *b))
{
-
+ ASSERT_ARGS(Parrot_dod_free_buffer_malloc);
/* free allocated space at (int *)bufstart - 1, but not if it used COW or is
* external */
PObj_buflen(b) = 0;
@@ -814,6 +825,7 @@
Parrot_dod_free_buffer(SHIM_INTERP, ARGMOD(Small_Object_Pool *pool), ARGMOD(PObj *b))
{
Memory_Pool * const mem_pool = (Memory_Pool *)pool->mem_pool;
+ ASSERT_ARGS(Parrot_dod_free_buffer);
/* XXX Jarkko reported that on irix pool->mem_pool was NULL, which really
* shouldn't happen */
@@ -846,6 +858,7 @@
{
int i;
const int bound = sizeof (size_t) * 8;
+ ASSERT_ARGS(find_common_mask);
/* Shifting a value by its size (in bits) or larger is undefined behaviour.
So need an explicit check to return 0 if there is no prefix, rather than
@@ -895,6 +908,7 @@
find_common_mask(interp,
buffer_min < pmc_min ? buffer_min : pmc_min,
buffer_max > pmc_max ? buffer_max : pmc_max);
+ ASSERT_ARGS(trace_mem_block);
if (!lo_var_ptr || !hi_var_ptr)
return;
@@ -955,6 +969,7 @@
{
Small_Object_Arena *arena;
const UINTVAL object_size = pool->object_size;
+ ASSERT_ARGS(clear_live_bits);
for (arena = pool->last_Arena; arena; arena = arena->prev) {
Buffer *b = (Buffer *)arena->start_objects;
@@ -984,6 +999,7 @@
Parrot_dod_clear_live_bits(PARROT_INTERP)
{
Small_Object_Pool * const pool = interp->arena_base->pmc_pool;
+ ASSERT_ARGS(Parrot_dod_clear_live_bits);
clear_live_bits(pool);
}
@@ -1000,6 +1016,7 @@
void
Parrot_dod_profile_start(PARROT_INTERP)
{
+ ASSERT_ARGS(Parrot_dod_profile_start);
if (Interp_flags_TEST(interp, PARROT_PROFILE_FLAG))
interp->profile->dod_time = Parrot_floatval_time();
}
@@ -1018,6 +1035,7 @@
void
Parrot_dod_profile_end(PARROT_INTERP, int what)
{
+ ASSERT_ARGS(Parrot_dod_profile_end);
if (Interp_flags_TEST(interp, PARROT_PROFILE_FLAG)) {
RunProfile * const profile = interp->profile;
const FLOATVAL now = Parrot_floatval_time();
@@ -1053,6 +1071,7 @@
Parrot_dod_ms_run_init(PARROT_INTERP)
{
Arenas * const arena_base = interp->arena_base;
+ ASSERT_ARGS(Parrot_dod_ms_run_init);
arena_base->dod_trace_ptr = NULL;
arena_base->dod_mark_start = NULL;
@@ -1077,6 +1096,7 @@
ARGMOD(void *arg))
{
int * const total_free = (int *) arg;
+ ASSERT_ARGS(sweep_cb);
#ifdef GC_IS_MALLOC
if (flag & POOL_BUFFER)
@@ -1115,6 +1135,7 @@
/* XXX these should go into the interpreter */
int total_free = 0;
+ ASSERT_ARGS(Parrot_dod_ms_run);
if (arena_base->DOD_block_level)
return;
@@ -1214,6 +1235,7 @@
void
Parrot_do_dod_run(PARROT_INTERP, UINTVAL flags)
{
+ ASSERT_ARGS(Parrot_do_dod_run);
interp->arena_base->do_gc_mark(interp, flags);
parrot_gc_context(interp);
}
Modified: trunk/src/gc/gc_gms.c
==============================================================================
--- trunk/src/gc/gc_gms.c (original)
+++ trunk/src/gc/gc_gms.c Wed Dec 31 16:20:46 2008
@@ -475,6 +475,7 @@
parrot_gc_gms_deinit(PARROT_INTERP)
{
Arenas * const arena_base = interp->arena_base;
+ ASSERT_ARGS(parrot_gc_gms_deinit);
/*
* TODO free generations
@@ -498,6 +499,7 @@
static void
gc_gms_pool_init(PARROT_INTERP, ARGMOD(Small_Object_Pool *pool))
{
+ ASSERT_ARGS(gc_gms_pool_init);
pool->add_free_object = gc_gms_add_free_object;
pool->get_free_object = gc_gms_get_free_object;
pool->alloc_objects = gc_gms_alloc_objects;
@@ -526,6 +528,7 @@
Parrot_gc_gms_init(PARROT_INTERP)
{
Arenas * const arena_base = interp->arena_base;
+ ASSERT_ARGS(Parrot_gc_gms_init);
arena_base->gc_private = mem_sys_allocate_zeroed(sizeof (Gc_gms_private));
@@ -558,6 +561,7 @@
gc_gms_add_free_object(PARROT_INTERP, SHIM(Small_Object_Pool *pool),
SHIM(PObj *to_add))
{
+ ASSERT_ARGS(gc_gms_add_free_object);
Parrot_ex_throw_from_c_args(interp, NULL, 1, "gms abuse");
}
@@ -612,6 +616,7 @@
Gc_gms_hdr *p = new_arena->start_objects;
Gc_gms_hdr * const marker = &pool->marker;
+ ASSERT_ARGS(gc_gms_chain_objects);
PARROT_ASSERT(pool->free_list == marker);
@@ -667,6 +672,7 @@
const size_t real_size = pool->object_size;
Small_Object_Arena * const new_arena = mem_internal_allocate(sizeof (Small_Object_Arena));
const size_t size = real_size * pool->objects_per_alloc;
+ ASSERT_ARGS(gc_gms_alloc_objects);
new_arena->start_objects = mem_internal_allocate(size);
/* insert arena in list */
@@ -696,6 +702,7 @@
static void
gc_gms_more_objects(PARROT_INTERP, ARGMOD(Small_Object_Pool *pool))
{
+ ASSERT_ARGS(gc_gms_more_objects);
if (pool->skip)
pool->skip = 0;
else if (pool->last_Arena) {
@@ -729,6 +736,7 @@
{
PObj *ptr;
Gc_gms_hdr *hdr;
+ ASSERT_ARGS(gc_gms_get_free_object);
hdr = pool->free_list;
if (hdr == &pool->marker)
@@ -780,6 +788,7 @@
gc_gms_create_gen(PARROT_INTERP, ARGMOD(Small_Object_Pool *pool), size_t gen_no)
{
Gc_gms_gen * const gen = mem_sys_allocate(sizeof (*gen));
+ ASSERT_ARGS(gc_gms_create_gen);
gen->gen_no = gen_no;
gen->pool = pool;
@@ -808,6 +817,7 @@
gc_gms_init_gen(PARROT_INTERP, ARGMOD(Small_Object_Pool *pool))
{
Gc_gms_private *gmsp;
+ ASSERT_ARGS(gc_gms_init_gen);
/*
* Generations are numbered beginning at zero
* 0 ... oldest
@@ -840,6 +850,7 @@
{
Gc_gms_gen *gen;
const Small_Object_Pool * const pool = h->gen->pool;
+ ASSERT_ARGS(gc_gms_find_gen);
PARROT_ASSERT(pool);
@@ -876,6 +887,7 @@
Gc_gms_gen *gen;
Gc_gms_hdr *prev, *next;
Small_Object_Pool * const pool = h->gen->pool;
+ ASSERT_ARGS(gc_gms_promote);
/* unsnap from current generation */
prev = h->prev;
@@ -921,6 +933,7 @@
gc_gms_store_hdr_list(PARROT_INTERP, ARGMOD(Gc_gms_hdr_list *l), ARGIN(Gc_gms_hdr *h))
{
Gc_gms_hdr_store * const s = l->last;
+ ASSERT_ARGS(gc_gms_store_hdr_list);
/* if it's not created or if it's full allocate new store */
if (!s || s->ptr == &s->store[GC_GMS_STORE_SIZE]) {
@@ -954,6 +967,7 @@
gc_gms_clear_hdr_list(PARROT_INTERP, ARGMOD(Gc_gms_hdr_list *l))
{
Gc_gms_hdr_store *s, *next;
+ ASSERT_ARGS(gc_gms_clear_hdr_list);
for (s = l->first; s; s = next) {
next = s->next;
@@ -977,6 +991,7 @@
{
Gc_gms_gen * const gen = h->gen;
Gc_gms_hdr_list * const igp = &gen->igp;
+ ASSERT_ARGS(gc_gms_store_igp);
gc_gms_store_hdr_list(interp, igp, h);
}
@@ -995,6 +1010,7 @@
gc_gms_clear_igp(PARROT_INTERP, ARGIN(Gc_gms_gen *gen))
{
Gc_gms_hdr_list * const igp = &gen->igp;
+ ASSERT_ARGS(gc_gms_clear_igp);
gc_gms_clear_hdr_list(interp, igp);
}
@@ -1018,6 +1034,7 @@
{
Gc_gms_hdr * const nh = PObj_to_GMSH(_new);
Gc_gms_hdr * const ah = PObj_to_GMSH(agg);
+ ASSERT_ARGS(parrot_gc_gms_wb);
/* if this may be an aggregate store it in IGP list, thus making
* it a possible root for this generation
@@ -1050,6 +1067,7 @@
ARGIN(void *old_key), ARGIN(void *_new), ARGIN(void *new_key))
{
Gc_gms_hdr *nh, *ah;
+ ASSERT_ARGS(parrot_gc_gms_wb_key);
/* handle hash values */
parrot_gc_gms_wb(interp, agg, old, _new);
@@ -1091,6 +1109,7 @@
*/
Gc_gms_gen * const gen = pool->last_gen;
Gc_gms_gen * const prev = gen->prev;
+ ASSERT_ARGS(gc_gms_merge_gen);
for (h = pool->black; h != pool->free_list; h = h->next) {
h->gen = prev;
@@ -1120,6 +1139,7 @@
{
Gc_gms_gen *gen, *prev;
UINTVAL next_gen;
+ ASSERT_ARGS(gc_gms_use_gen);
/* set hdr pointers in last generation */
gen = pool->last_gen;
@@ -1154,6 +1174,7 @@
set_gen_cb(PARROT_INTERP, ARGIN(Small_Object_Pool *pool), int flag, ARGIN(void *arg))
{
Gc_gms_plan * const plan = (Gc_gms_plan *)arg;
+ ASSERT_ARGS(set_gen_cb);
if (plan->merge_gen)
gc_gms_merge_gen(interp, pool, flag, plan);
@@ -1177,6 +1198,7 @@
{
Gc_gms_plan plan;
Gc_gms_private *gmsp;
+ ASSERT_ARGS(gc_gms_set_gen);
/*
* there are these basic plans
* 1) Use the black as the next old generation
@@ -1292,6 +1314,7 @@
gc_gms_setto_gray(PARROT_INTERP, ARGIN(Gc_gms_hdr *h), int priority)
{
Small_Object_Pool * const pool = h->gen->pool;
+ ASSERT_ARGS(gc_gms_setto_gray);
/*
* TODO high_priority like in src/dod.c
*/
@@ -1354,6 +1377,7 @@
gc_gms_setto_black(PARROT_INTERP, ARGMOD(Gc_gms_hdr *h), int priority)
{
Small_Object_Pool * const pool = h->gen->pool;
+ ASSERT_ARGS(gc_gms_setto_black);
/*
* TODO high_priority like src/dod.c
@@ -1415,6 +1439,7 @@
{
Gc_gms_hdr *h;
int priority;
+ ASSERT_ARGS(parrot_gc_gms_pobject_lives);
PObj_live_SET(obj);
priority = PObj_needs_early_DOD_TEST(obj);
@@ -1441,6 +1466,7 @@
static int
init_mark_cb(PARROT_INTERP, ARGMOD(Small_Object_Pool *pool), int flag, ARGIN(void *arg))
{
+ ASSERT_ARGS(init_mark_cb);
pool->gray = pool->black = pool->black_fin = pool->white;
# if GC_GMS_DEBUG
gms_debug_verify(interp, pool, "init_mark");
@@ -1462,6 +1488,7 @@
gc_gms_init_mark(PARROT_INTERP)
{
Arenas * const arena_base = interp->arena_base;
+ ASSERT_ARGS(gc_gms_init_mark);
arena_base->dod_trace_ptr = NULL;
arena_base->dod_mark_start = NULL;
@@ -1487,6 +1514,7 @@
Gc_gms_hdr_store *s;
Gc_gms_gen * const gen = pool->last_gen;
Gc_gms_hdr_list * const igp = &gen->igp;
+ ASSERT_ARGS(trace_igp_cb);
for (s = igp->first; s; s = s->next) {
const Gc_gms_hdr **p;
@@ -1512,6 +1540,7 @@
gc_gms_trace_root(PARROT_INTERP, int trace_stack)
{
const int ret = Parrot_dod_trace_root(interp, trace_stack);
+ ASSERT_ARGS(gc_gms_trace_root);
if (ret == 0)
return 0;
@@ -1536,6 +1565,7 @@
const int lazy_dod = arena_base->lazy_dod;
const UINTVAL mask = PObj_data_is_PMC_array_FLAG | PObj_custom_mark_FLAG;
Gc_gms_hdr *h;
+ ASSERT_ARGS(trace_children_cb);
for (h = pool->gray; h != pool->white;) {
PMC * const current = (PMC*)GMSH_to_PObj(h);
@@ -1596,6 +1626,7 @@
static int
gc_gms_trace_children(PARROT_INTERP)
{
+ ASSERT_ARGS(gc_gms_trace_children);
return !Parrot_forall_header_pools(interp, POOL_PMC, 0,
trace_children_cb);
}
@@ -1617,6 +1648,7 @@
{
Gc_gms_hdr *h;
Arenas * const arena_base = interp->arena_base;
+ ASSERT_ARGS(sweep_cb_pmc);
/* TODO object stats */
@@ -1653,6 +1685,7 @@
sweep_cb_buf(PARROT_INTERP, ARGMOD(Small_Object_Pool *pool), int flag, SHIM(void *arg))
{
Gc_gms_hdr *h;
+ ASSERT_ARGS(sweep_cb_buf);
/* TODO object stats */
@@ -1719,6 +1752,7 @@
static void
gc_gms_sweep(PARROT_INTERP)
{
+ ASSERT_ARGS(gc_gms_sweep);
Parrot_forall_header_pools(interp, POOL_PMC, 0, sweep_cb_pmc);
Parrot_forall_header_pools(interp, POOL_BUFFER, 0, sweep_cb_buf);
}
@@ -1737,6 +1771,7 @@
end_cycle_cb(PARROT_INTERP, ARGMOD(Small_Object_Pool *pool), int flag, SHIM(void *arg))
{
Gc_gms_hdr *h;
+ ASSERT_ARGS(end_cycle_cb);
/*
* clear live flags
* TODO just swap black and white
@@ -1762,6 +1797,7 @@
static void
gc_gms_end_cycle(PARROT_INTERP)
{
+ ASSERT_ARGS(gc_gms_end_cycle);
Parrot_forall_header_pools(interp, POOL_ALL, 0, end_cycle_cb);
}
@@ -1790,6 +1826,7 @@
{
Arenas * const arena_base = interp->arena_base;
Gc_gms_private *g_gms;
+ ASSERT_ARGS(parrot_gc_gms_run);
if (arena_base->DOD_block_level) {
return;
@@ -1845,6 +1882,7 @@
size_t i;
const size_t n = pool->total_objects;
+ ASSERT_ARGS(gms_debug_verify);
bf = gf = wf = ff = 0;
Modified: trunk/src/inter_cb.c
==============================================================================
--- trunk/src/inter_cb.c (original)
+++ trunk/src/inter_cb.c Wed Dec 31 16:20:46 2008
@@ -81,6 +81,7 @@
*/
PMC * const interp_pmc = VTABLE_get_pmc_keyed_int(interp, interp->iglobals,
(INTVAL) IGLOBALS_INTERPRETER);
+ ASSERT_ARGS(Parrot_make_cb);
/* be sure __LINE__ is consistent */
sc = CONST_STRING(interp, "_interpreter");
@@ -159,6 +160,7 @@
{
PARROT_INTERP = NULL;
size_t i;
+ ASSERT_ARGS(verify_CD);
/*
* 1.) user_data is from external code so:
@@ -225,6 +227,7 @@
int synchronous = 0; /* cb is hitting this sub somewhen
* inmidst, or not */
STRING *sc;
+ ASSERT_ARGS(callback_CD);
/*
* 3) check interpreter ...
*/
@@ -290,6 +293,7 @@
PMC *p_param;
void *param = NULL; /* avoid -Ox warning */
STRING *sc;
+ ASSERT_ARGS(Parrot_run_callback);
sc = CONST_STRING(interp, "_sub");
sub = VTABLE_getprop(interp, user_data, sc);
@@ -376,6 +380,7 @@
void
Parrot_callback_C(ARGIN(char *external_data), ARGMOD(PMC *user_data))
{
+ ASSERT_ARGS(Parrot_callback_C);
verify_CD(external_data, user_data);
}
@@ -383,6 +388,7 @@
void
Parrot_callback_D(ARGMOD(PMC *user_data), ARGIN(char *external_data))
{
+ ASSERT_ARGS(Parrot_callback_D);
verify_CD(external_data, user_data);
}
Modified: trunk/src/interpreter.c
==============================================================================
--- trunk/src/interpreter.c (original)
+++ trunk/src/interpreter.c Wed Dec 31 16:20:46 2008
@@ -182,6 +182,7 @@
const int m = opinfo->op_count;
int n = opinfo->op_count;
int i;
+ ASSERT_ARGS(prederef_args);
ADD_OP_VAR_PART(interp, interp->code, pc, n);
for (i = 1; i < n; i++) {
@@ -370,6 +371,7 @@
{
const Prederef * const pi = &interp->code->prederef;
size_t i;
+ ASSERT_ARGS(turn_ev_check);
if (!pi->branches)
return;
@@ -404,6 +406,7 @@
get_core_op_lib_init(PARROT_INTERP, int which)
{
oplib_init_f init_func;
+ ASSERT_ARGS(get_core_op_lib_init);
switch (which) {
case PARROT_SWITCH_CORE:
case PARROT_SWITCH_JIT_CORE:
@@ -453,6 +456,7 @@
static oplib_init_f
get_dynamic_op_lib_init(SHIM_INTERP, ARGIN(const PMC *lib))
{
+ ASSERT_ARGS(get_dynamic_op_lib_init);
return (oplib_init_f)D2FPTR(PMC_struct_val(lib));
}
@@ -473,6 +477,7 @@
const oplib_init_f init_func = get_core_op_lib_init(interp, which);
int (*get_op)(const char * name, int full);
+ ASSERT_ARGS(load_prederef);
get_op = interp->op_lib->op_code;
interp->op_lib = init_func(1);
@@ -500,6 +505,7 @@
static void
init_prederef(PARROT_INTERP, int which)
{
+ ASSERT_ARGS(init_prederef);
load_prederef(interp, which);
if (!interp->code->prederef.code) {
void *pred_func;
@@ -567,6 +573,7 @@
static void
stop_prederef(PARROT_INTERP)
{
+ ASSERT_ARGS(stop_prederef);
interp->op_func_table = PARROT_CORE_OPLIB_INIT(1)->op_func_table;
if (interp->evc_func_table) {
@@ -597,6 +604,7 @@
void
exec_init_prederef(PARROT_INTERP, void *prederef_arena)
{
+ ASSERT_ARGS(exec_init_prederef);
load_prederef(interp, PARROT_CGP_CORE);
if (!interp->code->prederef.code) {
@@ -630,6 +638,7 @@
UINTVAL code_size; /* in opcodes */
opcode_t *code_end;
Parrot_jit_info_t *jit_info;
+ ASSERT_ARGS(init_jit);
if (interp->code->jit_info)
return ((Parrot_jit_info_t *)interp->code->jit_info)->arena.start;
@@ -715,6 +724,7 @@
/* AIX calling convention requires that function-call-by-ptr be made
through the following struct: */
struct ptrgl_t { jit_f functPtr; void *toc; void *env; } ptrgl_t;
+ ASSERT_ARGS(runops_jit);
ptrgl_t.functPtr = (jit_f) D2FPTR(init_jit(interp, pc));
ptrgl_t.env = NULL;
@@ -755,6 +765,7 @@
opcode_t *code_start;
UINTVAL code_size; /* in opcodes */
opcode_t *code_end;
+ ASSERT_ARGS(runops_exec);
code_start = interp->code->base.data;
code_size = interp->code->base.size;
@@ -808,6 +819,7 @@
#ifdef HAVE_COMPUTED_GOTO
opcode_t * const code_start = (opcode_t *)interp->code->base.data;
opcode_t *pc_prederef;
+ ASSERT_ARGS(runops_cgp);
init_prederef(interp, PARROT_CGP_CORE);
@@ -841,6 +853,7 @@
{
opcode_t * const code_start = (opcode_t *)interp->code->base.data;
opcode_t *pc_prederef;
+ ASSERT_ARGS(runops_switch);
init_prederef(interp, PARROT_SWITCH_CORE);
pc_prederef = (opcode_t*)interp->code->prederef.code + (pc - code_start);
@@ -1161,6 +1174,7 @@
oplib_init_f new_init_func;
PMC *lib_variant;
+ ASSERT_ARGS(dynop_register_xx);
if (cg_lib->flags & OP_FUNC_IS_ALLOCATED) {
ops_addr = (op_func_t *)mem_sys_realloc(cg_lib->op_func_table,
@@ -1262,6 +1276,7 @@
dynop_register_switch(size_t n_old, size_t n_new)
{
op_lib_t * const lib = PARROT_CORE_SWITCH_OPLIB_INIT(1);
+ ASSERT_ARGS(dynop_register_switch);
lib->op_count = n_old + n_new;
}
@@ -1280,6 +1295,7 @@
notify_func_table(PARROT_INTERP, ARGIN(op_func_t* table), int on)
{
const oplib_init_f init_func = get_core_op_lib_init(interp, interp->run_core);
+ ASSERT_ARGS(notify_func_table);
init_func((long) table);
switch (interp->run_core) {
Modified: trunk/src/library.c
==============================================================================
--- trunk/src/library.c (original)
+++ trunk/src/library.c Wed Dec 31 16:20:46 2008
@@ -151,6 +151,7 @@
PMC * const iglobals = interp->iglobals;
/* create the lib_paths array */
PMC * const lib_paths = pmc_new(interp, enum_class_FixedPMCArray);
+ ASSERT_ARGS(parrot_init_library_paths);
VTABLE_set_integer_native(interp, lib_paths, PARROT_LIB_PATH_SIZE);
VTABLE_set_pmc_keyed_int(interp, iglobals,
@@ -242,6 +243,7 @@
PMC * const iglobals = interp->iglobals;
PMC * const lib_paths = VTABLE_get_pmc_keyed_int(interp, iglobals,
IGLOBALS_LIB_PATHS);
+ ASSERT_ARGS(get_search_paths);
return VTABLE_get_pmc_keyed_int(interp, lib_paths, which);
}
@@ -262,6 +264,7 @@
is_abs_path(ARGIN(const STRING *file))
{
const char * const file_name = file->strstart;
+ ASSERT_ARGS(is_abs_path);
if (file->strlen <= 1)
return 0;
PARROT_ASSERT(file->encoding == Parrot_fixed_8_encoding_ptr ||
@@ -300,6 +303,7 @@
cnv_to_win32_filesep(ARGMOD(STRING *path))
{
char* cnv;
+ ASSERT_ARGS(cnv_to_win32_filesep);
PARROT_ASSERT(path->encoding == Parrot_fixed_8_encoding_ptr ||
path->encoding == Parrot_utf8_encoding_ptr);
@@ -336,6 +340,7 @@
*/
STRING * const nul = string_chr(interp, '\0');
+ ASSERT_ARGS(path_finalize);
path = string_append(interp, path, nul);
path->bufused--;
@@ -366,6 +371,7 @@
path_guarantee_trailing_separator(PARROT_INTERP, ARGMOD(STRING *path))
{
STRING * const path_separator_string = string_chr(interp, path_separator);
+ ASSERT_ARGS(path_guarantee_trailing_separator);
/* make sure the path has a trailing slash before appending the file */
if (string_index(interp, path , path->strlen - 1)
@@ -392,6 +398,7 @@
static STRING*
path_append(PARROT_INTERP, ARGMOD(STRING *l_path), ARGMOD(STRING *r_path))
{
+ ASSERT_ARGS(path_append);
l_path = path_guarantee_trailing_separator(interp, l_path);
l_path = string_append(interp, l_path, r_path);
@@ -416,6 +423,7 @@
path_concat(PARROT_INTERP, ARGMOD(STRING *l_path), ARGMOD(STRING *r_path))
{
STRING* join;
+ ASSERT_ARGS(path_concat);
join = string_copy(interp, l_path);
join = path_guarantee_trailing_separator(interp, join);
@@ -453,6 +461,7 @@
try_load_path(PARROT_INTERP, ARGMOD(STRING* path))
{
STRING *final;
+ ASSERT_ARGS(try_load_path);
final = string_copy(interp, path);
@@ -485,6 +494,7 @@
STRING *with_ext, *result;
int guess;
+ ASSERT_ARGS(try_bytecode_extensions);
/*
First try the path without guessing the extension to ensure compatibility
@@ -540,6 +550,7 @@
IGLOBALS_LIB_PATHS);
PMC * paths = VTABLE_get_pmc_keyed_int(interp, lib_paths, which);
STRING * const path_str = string_from_cstring(interp, path, 0);
+ ASSERT_ARGS(Parrot_add_library_path);
VTABLE_push_string(interp, paths, path_str);
}
@@ -576,6 +587,7 @@
STRING *full_name;
PMC *paths;
INTVAL i, n;
+ ASSERT_ARGS(Parrot_locate_runtime_file_str);
/* if this is an absolute path return it as is */
if (is_abs_path(file))
@@ -628,6 +640,7 @@
{
STRING * const file = string_from_cstring(interp, file_name, 0);
STRING * const result = Parrot_locate_runtime_file_str(interp, file, type);
+ ASSERT_ARGS(Parrot_locate_runtime_file);
/*
* XXX valgrind shows e.g.
* invalid read of size 8 inside a string of length 69
@@ -661,6 +674,7 @@
{
int free_it;
char * const env = Parrot_getenv("PARROT_RUNTIME", &free_it);
+ ASSERT_ARGS(Parrot_get_runtime_prefix);
if (env)
return free_it ? env : str_dup(env);
@@ -696,6 +710,7 @@
int free_it;
char * const env = Parrot_getenv("PARROT_RUNTIME", &free_it);
STRING *result;
+ ASSERT_ARGS(Parrot_get_runtime_path);
if (env)
{
@@ -741,6 +756,7 @@
const INTVAL len = string_length(interp, in);
STRING *stem;
INTVAL pos_sl, pos_dot;
+ ASSERT_ARGS(parrot_split_path_ext);
pos_sl = CHARSET_RINDEX(interp, in, slash1, len);
if (pos_sl == -1)
-
[svn:parrot] r34727 - in trunk: compilers/imcc src src/gc
by infinoid