Update of /cvsroot/monetdb/pathfinder/compiler/algebra
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv24398/algebra

Modified Files:
        algebra_cse.c core2alg.brg intro_rec_border.c load_stats.c 
        logical.c ordering.c planner.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: core2alg.brg
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/core2alg.brg,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -d -r1.65 -r1.66
--- core2alg.brg        25 Feb 2008 15:37:04 -0000      1.65
+++ core2alg.brg        17 Mar 2008 17:41:09 -0000      1.66
@@ -953,7 +953,7 @@
                           att_pos, lit_nat (1));
 
             /* create new environment */
-            ENV = PFarray (sizeof (PFla_env_t));
+            ENV = PFarray (sizeof (PFla_env_t), 50);
 
             /* insert $v and "its document" into NEW environment */
             *((PFla_env_t *) PFarray_add (ENV))
@@ -1185,7 +1185,7 @@
             old_env = ENV;
 
             /* update the environment for translation of e2 */
-            ENV = PFarray (sizeof (PFla_env_t));
+            ENV = PFarray (sizeof (PFla_env_t), 50);
 
             for (i = 0; i < PFarray_last (old_env); i++) {
                 e = *((PFla_env_t *) PFarray_at (old_env, i));
@@ -1220,7 +1220,7 @@
                             proj (att_iter, att_iter));
 
             /* update the environment for translation of e3 */
-            ENV = PFarray (sizeof (PFla_env_t));
+            ENV = PFarray (sizeof (PFla_env_t), 50);
 
             for (i = 0; i < PFarray_last (old_env); i++) {
                 e = *((PFla_env_t *) PFarray_at (old_env, i));
@@ -1628,7 +1628,7 @@
 
             /* map variable environment */
             old_env = ENV;
-            ENV = PFarray (sizeof (PFla_env_t));
+            ENV = PFarray (sizeof (PFla_env_t), 50);
 
             for (i = 0; i < PFarray_last (old_env); i++) {
                 e = *((PFla_env_t *) PFarray_at (old_env, i));
@@ -1662,7 +1662,7 @@
                                      att_notsub),
                             proj (att_iter, att_iter));
 
-            ENV = PFarray (sizeof (PFla_env_t));
+            ENV = PFarray (sizeof (PFla_env_t), 50);
 
             for (i = 0; i < PFarray_last (old_env); i++) {
                 e = *((PFla_env_t *) PFarray_at (old_env, i));
@@ -2085,7 +2085,7 @@
                and create new ones. */
             old_env = ENV;
 
-            ENV = PFarray (sizeof (PFla_env_t));
+            ENV = PFarray (sizeof (PFla_env_t), 50);
 
             for (unsigned int i = 0; i < PFarray_last (old_env); i++)
                 *((PFla_env_t *) PFarray_add (ENV))
@@ -2094,7 +2094,7 @@
             old_fun_args = FUN_ARGS;
 
             /* We will collect the argument values here */
-            FUN_ARGS = PFarray (sizeof (struct PFla_pair_t));
+            FUN_ARGS = PFarray (sizeof (struct PFla_pair_t), 10);
 
             /* (2) Enter bindings for function parameters.
              *     We do this by reducing our child nodes in a
@@ -2208,7 +2208,7 @@
                 else if (FUN_ACTIVE_AT(i).count < ctx->recursion_depth) {
                     unsigned int j, k;
                     PFarray_t *old_core2alg_map = CORE2ALG_MAP;
-                    CORE2ALG_MAP = PFarray (sizeof (core2alg_map_t));
+                    CORE2ALG_MAP = PFarray (sizeof (core2alg_map_t), 50);
 
                     /* replace the variables that are not visible
                        anymore due to the recursive call */
@@ -2321,7 +2321,7 @@
                and create new ones. */
             old_env = ENV;
 
-            ENV = PFarray (sizeof (PFla_env_t));
+            ENV = PFarray (sizeof (PFla_env_t), 50);
 
             for (unsigned int i = 0; i < PFarray_last (old_env); i++)
                 *((PFla_env_t *) PFarray_add (ENV))
@@ -2330,7 +2330,7 @@
             old_fun_args = FUN_ARGS;
 
             /* We will collect the argument values here */
-            FUN_ARGS = PFarray (sizeof (struct PFla_pair_t));
+            FUN_ARGS = PFarray (sizeof (struct PFla_pair_t), 10);
 
             /* (2) Enter bindings for function parameters.
              *     We do this by reducing our child nodes in a
@@ -2584,7 +2584,7 @@
                 old_env = ENV;
 
                 /* create new environment */
-                ENV = PFarray (sizeof (PFla_env_t));
+                ENV = PFarray (sizeof (PFla_env_t), 50);
 
                 /* update all variable bindings in old environment and put
                  * them into new environment */
@@ -3227,11 +3227,11 @@
     PFcore2alg_label (r);
 
     /* get empty environment */
-    ctx.env  = PFarray (sizeof (PFla_env_t));
+    ctx.env  = PFarray (sizeof (PFla_env_t), 50);
     /* loop is initially a table with just one tuple */
     ctx.loop = lit_tbl (attlist (att_iter), tuple (lit_nat (1)));
     /* Create a stack for the map relation information */
-    ctx.mapping = PFarray (sizeof (map_rel_info_t));
+    ctx.mapping = PFarray (sizeof (map_rel_info_t), 50);
     /* set ordering mode */
     ctx.ordering = query->ordering;
     /* initialize the sequence count with a dummy value */
@@ -3253,7 +3253,7 @@
     }
     
     /* Initialize stack recording the active user-defined functions */
-    ctx.fun_active = PFarray (sizeof (fun_active_t));
+    ctx.fun_active = PFarray (sizeof (fun_active_t), 50);
 
     /* initially do not memorize algebra translations */
     ctx.core2alg_map = NULL;

Index: ordering.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/ordering.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- ordering.c  15 Feb 2008 16:53:25 -0000      1.10
+++ ordering.c  17 Mar 2008 17:41:11 -0000      1.11
@@ -48,7 +48,7 @@
 PFord_ordering_t
 PFordering (void)
 {
-    return PFarray (sizeof (PFalg_order_item_t));
+    return PFarray (sizeof (PFalg_order_item_t), 10);
 }
 
 PFord_ordering_t
@@ -68,7 +68,7 @@
 PFord_set_t
 PFord_set (void)
 {
-    return PFarray (sizeof (PFord_ordering_t));
+    return PFarray (sizeof (PFord_ordering_t), 20);
 }
 
 PFord_ordering_t
@@ -157,7 +157,7 @@
 char *
 PFord_str (const PFord_ordering_t o)
 {
-    PFarray_t *a = PFarray (sizeof (char));
+    PFarray_t *a = PFarray (sizeof (char), 100);
 
     PFarray_printf (a, "<");
 

Index: planner.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/planner.c,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -d -r1.54 -r1.55
--- planner.c   27 Feb 2008 13:08:10 -0000      1.54
+++ planner.c   17 Mar 2008 17:41:11 -0000      1.55
@@ -144,7 +144,7 @@
 static PFplanlist_t *
 new_planlist (void)
 {
-    return PFarray (sizeof (plan_t *));
+    return PFarray (sizeof (plan_t *), 50);
 }
 
 /**
@@ -2320,7 +2320,7 @@
 static bool
 clean_up_body_plans (PFla_op_t *n)
 {
-    PFarray_t *bases = PFarray (sizeof (PFla_op_t *));
+    PFarray_t *bases = PFarray (sizeof (PFla_op_t *), 3);
     PFla_op_t *cur;
     bool code;
 

Index: load_stats.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/load_stats.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- load_stats.c        11 Jan 2008 10:46:56 -0000      1.12
+++ load_stats.c        17 Mar 2008 17:41:09 -0000      1.13
@@ -166,7 +166,7 @@
         /* insert new guide node in the child list */
         if (!current_guide_node->child_list)
             current_guide_node->child_list = 
-                PFarray (sizeof (PFguide_tree_t**));
+                PFarray (sizeof (PFguide_tree_t**), 10);
         
         *(PFguide_tree_t**)
             PFarray_add (current_guide_node->child_list) =

Index: algebra_cse.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/algebra_cse.c,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -d -r1.70 -r1.71
--- algebra_cse.c       25 Feb 2008 08:58:42 -0000      1.70
+++ algebra_cse.c       17 Mar 2008 17:41:08 -0000      1.71
@@ -547,7 +547,7 @@
 
     if (!a)
         *(PFarray_t **) PFarray_at (subexps, n->kind)
-            = a = PFarray (sizeof (PFla_op_t *));
+            = a = PFarray (sizeof (PFla_op_t *), 50);
 
     /* see if we already saw that subexpression */
     for (unsigned int i = 0; i < PFarray_last (a); i++)
@@ -578,7 +578,7 @@
 {
     PFla_op_t *res;
 
-    subexps = PFarray (sizeof (PFarray_t *));
+    subexps = PFcarray (sizeof (PFarray_t *), 125);
 
     res = la_cse (n);
     PFla_dag_reset (res);

Index: logical.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/logical.c,v
retrieving revision 1.85
retrieving revision 1.86
diff -u -d -r1.85 -r1.86
--- logical.c   1 Mar 2008 11:47:00 -0000       1.85
+++ logical.c   17 Mar 2008 17:41:10 -0000      1.86
@@ -472,7 +472,7 @@
     ret->sem.ref_tbl.name = PFstrdup(name);
 
     /* deep copy the "original column names" of the referenced table*/
-    ret->sem.ref_tbl.tatts = PFarray(sizeof (char*));
+    ret->sem.ref_tbl.tatts = PFarray(sizeof (char*), PFarray_last (tatts));
     for (unsigned int i = 0; i < PFarray_last (tatts); i++)
     {
             char* value = *(char**) PFarray_at (tatts, i);
@@ -3365,7 +3365,7 @@
 PFla_set_t *
 PFla_empty_set (void)
 {
-    return PFarray (sizeof (PFla_op_t *));
+    return PFarray (sizeof (PFla_op_t *), 0);
 }
 
 /**
@@ -3374,7 +3374,7 @@
 PFla_set_t *
 PFla_set (const PFla_op_t *n)
 {
-    PFarray_t *ret = PFarray (sizeof (PFla_op_t *));
+    PFarray_t *ret = PFarray (sizeof (PFla_op_t *), 1);
 
     /* add node */
     *((PFla_op_t **) PFarray_add (ret)) = (PFla_op_t *) n;
@@ -3392,7 +3392,9 @@
     unsigned int i, j;
     PFla_op_t *n1;
     PFla_op_t *n2;
-    PFarray_t *ret = PFarray (sizeof (PFla_op_t *));
+    PFarray_t *ret = PFarray (sizeof (PFla_op_t *),
+                              PFarray_last (frag1) +
+                              PFarray_last (frag2));
 
     for (i = 0; i < PFarray_last (frag1); i++) {
         n1 = *((PFla_op_t **) PFarray_at (frag1, i));

Index: intro_rec_border.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/intro_rec_border.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- intro_rec_border.c  15 Feb 2008 16:53:25 -0000      1.9
+++ intro_rec_border.c  17 Mar 2008 17:41:09 -0000      1.10
@@ -196,7 +196,7 @@
     {
         case pa_rec_fix:
         {
-            PFarray_t *bases = PFarray (sizeof (PFpa_op_t *));
+            PFarray_t *bases = PFarray (sizeof (PFpa_op_t *), 3);
             PFpa_op_t *cur;
 
             /* collect base operators */


-------------------------------------------------------------------------
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

Reply via email to