Update of /cvsroot/monetdb/pathfinder/compiler/mil
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv24398/mil
Modified Files:
mil.c milgen.brg milprint.c milprint_summer.c
Log Message:
-- Extended the PFarray_t type to store a ``clear'' bit
that ensures that memory is erased during allocation.
-- Split up PFarray (size_t itemsize) into four variants
o PFarray_default (size_t itemsize),
o PFcarray_default (size_t itemsize),
o PFarray (size_t itemsize, unsigned int slots), and
o PFcarray (size_t itemsize, unsigned int slots)
where the '_default' variants are currently seeded with 20 slots,
the 'c' variants provide a cleared chunk of memory, and the slots
argument indicates how much memory is initially allocated (#slots).
-- Added memory debugging support for arrays:
If the environment variable ``PF_DEBUG_MEMORY'' is set the memory
reallocation for arrays reports the function that requires more
memory (and thus more slots for the storage).
REMARK: Currently the inital array sizes (#slots) are good guesses
about the upper limit of required slots. Anybody adding new
PFarray calls may start with a very low value. This way the
the debug printing may report (reallocation) problems in
comparison to a very high initial value whose consequences
might not be directly visible.
Index: milprint.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/mil/milprint.c,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -d -r1.64 -r1.65
--- milprint.c 15 Feb 2008 16:53:30 -0000 1.64
+++ milprint.c 17 Mar 2008 17:41:25 -0000 1.65
@@ -1551,7 +1551,7 @@
PFarray_t *
PFmil_serialize (PFmil_t * m)
{
- out = PFarray (sizeof (char));
+ out = PFarray (sizeof (char), 64000);
/* `statements' is the top rule of our grammar */
print_statements (m);
Index: mil.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/mil/mil.c,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -d -r1.54 -r1.55
--- mil.c 24 Feb 2008 17:22:26 -0000 1.54
+++ mil.c 17 Mar 2008 17:41:24 -0000 1.55
@@ -2383,7 +2383,7 @@
PFmil_comment (const char *fmt, ...)
{
PFmil_t *ret = leaf (m_comment);
- PFarray_t *a = PFarray(sizeof (char));
+ PFarray_t *a = PFarray(sizeof (char), 60);
va_list args;
va_start (args, fmt);
Index: milgen.brg
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/mil/milgen.brg,v
retrieving revision 1.119
retrieving revision 1.120
diff -u -d -r1.119 -r1.120
--- milgen.brg 4 Mar 2008 21:51:52 -0000 1.119
+++ milgen.brg 17 Mar 2008 17:41:25 -0000 1.120
@@ -528,7 +528,7 @@
static PFarray_t *
new_env (void)
{
- return PFarray (sizeof (env_t));
+ return PFarray (sizeof (env_t), 10);
}
/** @brief Add an item to environment for #env_t entries. */
@@ -803,7 +803,7 @@
PFalg_schema_t left, PFalg_schema_t right,
mvar_t *res)
{ /* fold( */
- PFarray_t *helper_vars = PFarray (sizeof (mvar_t *));
+ PFarray_t *helper_vars = PFarray (sizeof (mvar_t *), 10);
PFalg_att_t latt,
ratt;
PFalg_simple_type_t lty = 0,
@@ -6444,8 +6444,8 @@
twig_state->parent = 0;
twig_state->size = 0;
twig_state->level = 0;
- twig_state->elem_vars = PFarray (sizeof (mvar_t *));
- twig_state->attr_vars = PFarray (sizeof (mvar_t *));
+ twig_state->elem_vars = PFarray (sizeof (mvar_t *), 10);
+ twig_state->attr_vars = PFarray (sizeof (mvar_t *), 10);
twig_state->loop = NULL;
twig_state->elem_content = false;
@@ -8562,7 +8562,7 @@
PFmil_t *oldmilprog, *bodymilprog;
PFarray_t *res_env;
mvar_t *old_count, *new_count;
- PFarray_t *border_vars = PFarray (sizeof (mvar_t *));
+ PFarray_t *border_vars = PFarray (sizeof (mvar_t *), 10);
/* Generate code for the seeds and bind them to the new variables.
In addition generate code for all expressions that are
@@ -8686,7 +8686,7 @@
old_fun_params = fun_params;
/* We will collect the parameters here */
- fun_params = PFarray (sizeof (PFpa_op_t **));
+ fun_params = PFarray (sizeof (PFpa_op_t **), 10);
/* Top-down processing puts all parameters into this array */
reduce (kids[1], nts[1]);
@@ -8915,7 +8915,7 @@
new (type (mty_oid), type (mty_oid))));
/* initialize list of variables we use */
- mvars = PFarray (sizeof (mvar_t));
+ mvars = PFarray (sizeof (mvar_t), 100);
/* dummy initializations */
twig_state = NULL;
Index: milprint_summer.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/mil/milprint_summer.c,v
retrieving revision 1.413
retrieving revision 1.414
diff -u -d -r1.413 -r1.414
--- milprint_summer.c 4 Mar 2008 21:47:25 -0000 1.413
+++ milprint_summer.c 17 Mar 2008 17:41:26 -0000 1.414
@@ -10185,7 +10185,7 @@
var_info *vi;
vi = (var_info *) PFmalloc (sizeof (var_info));
- PFarray_t *reflist = PFarray (sizeof (var_info *));
+ PFarray_t *reflist = PFarray (sizeof (var_info *), 100);
vi->parent = parent;
vi->id = id;
@@ -10625,7 +10625,7 @@
} /* end else (!res) */
/* find referenced variables from outer scopes in first comparison side */
- fst_reflist = PFarray (sizeof (var_info *));
+ fst_reflist = PFarray (sizeof (var_info *), 20);
fst_reflist = collect_vars(fst_inner, active_vlist, fst_reflist);
/* search for-loop variable in first argument */
found_in_fst = 0;
@@ -10652,7 +10652,7 @@
}
/* find referenced variables from outer scopes in second comparison side */
- snd_reflist = PFarray (sizeof (var_info *));
+ snd_reflist = PFarray (sizeof (var_info *), 20);
snd_reflist = collect_vars(snd_inner, active_vlist, snd_reflist);
/* search for-loop variable in second argument */
found_in_snd = 0;
@@ -10759,7 +10759,7 @@
{
/* evaluate right side in the inner-most common scope
(cur_level stays the same) */
- PFarray_t *new_active_vlist = PFarray (sizeof (var_info *));
+ PFarray_t *new_active_vlist = PFarray (sizeof (var_info *), 20);
*(var_info **) PFarray_add (new_active_vlist)
= create_var_info(vi->parent, vi->id, cur_level);
if (vipos)
@@ -10779,11 +10779,11 @@
recognize_join (snd_inner,
new_active_vlist,
- PFarray (sizeof (var_info *)),
+ PFarray (sizeof (var_info *), 20),
cur_level);
} else {
/* evaluate right side in scope 0 (cur_level is set back to 1) */
- PFarray_t *new_active_vlist = PFarray (sizeof (var_info *));
+ PFarray_t *new_active_vlist = PFarray (sizeof (var_info *), 20);
*(var_info **) PFarray_add (new_active_vlist)
= create_var_info(vi->parent, vi->id, 1);
if (vipos)
@@ -10802,7 +10802,7 @@
recognize_join (snd_inner,
new_active_vlist,
- PFarray (sizeof (var_info *)),
+ PFarray (sizeof (var_info *), 20),
1);
}
@@ -11438,7 +11438,7 @@
milprintf(f, "proc_vid.insert(\"%s\", %dLL);\n",
c->sem.fun->sig, f->module_base+first);
f->num_fun--;
}
- counter = get_var_usage (f, R(c), PFarray (sizeof (int)), counter);
+ counter = get_var_usage (f, R(c), PFarray (sizeof (int), 20), counter);
}
/* apply mapping correctly for user defined function calls */
else if (c->kind == c_apply &&
@@ -11458,7 +11458,7 @@
again check UDFs to map all global variables correctly */
*(int *) PFarray_add (way) = c->sem.fun->fid;
/* create a new stack with active UDFs to avoid endless recursion */
- PFarray_t *active_funs = PFarray (sizeof (PFvar_t *));
+ PFarray_t *active_funs = PFarray (sizeof (PFvar_t *), 50);
*(PFfun_t **) PFarray_add (active_funs) = c->sem.fun;
counter = walk_through_UDF (f, c->sem.fun->core,
@@ -11759,8 +11759,8 @@
f->module_base = module_base; /* only generate mil module; no query */
f->url = url; /* url of this query / module definition */
- way = PFarray (sizeof (int));
- counter = PFarray (sizeof (int));
+ way = PFarray (sizeof (int), 20);
+ counter = PFarray (sizeof (int), 20);
*(int *) PFarray_add (counter) = 0;
*(int *) PFarray_add (counter) = 0;
*(int *) PFarray_add (counter) = 0;
@@ -11773,8 +11773,8 @@
simplifyCoreTree (c);
recognize_join (c,
- PFarray (sizeof (var_info *)),
- PFarray (sizeof (var_info *)),
+ PFarray (sizeof (var_info *), 20),
+ PFarray (sizeof (var_info *), 20),
0);
if (module_base == 0 && num_fun == -1) {
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Monetdb-pf-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins