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

Modified Files:
        opt_algebra_cse.c opt_join_pd.c opt_thetajoin.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: opt_algebra_cse.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/opt/opt_algebra_cse.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- opt_algebra_cse.c   25 Feb 2008 08:58:43 -0000      1.26
+++ opt_algebra_cse.c   17 Mar 2008 17:41:13 -0000      1.27
@@ -56,6 +56,8 @@
 /* checks if an attribute is NULL */
 #define IS_NULL(a) (a == att_NULL)
 
+#define DEF_WIDTH 10
+
 /* Operator names */
 static char *ID[] = {
       [la_serialize_seq]   = "la_serialize_seq"
@@ -518,7 +520,7 @@
 static PFarray_t *
 create_actatt_map (void)
 {
-    return PFarray (sizeof(actatt_map_t));
+    return PFarray (sizeof(actatt_map_t), DEF_WIDTH);
 }
 
 /*........... Handling of actual attributes .........*/
@@ -2100,7 +2102,7 @@
              * we have to protocol the columns
              * we have just seen, to avoid a column to be
              * used twice */
-            PFarray_t *seen = PFarray (sizeof(PFalg_att_t));
+            PFarray_t *seen = PFarray (sizeof(PFalg_att_t), DEF_WIDTH);
             for (unsigned int i = 0; i < ori->schema.count; i++) {
                 PFalg_att_t col = littbl_column (ori->schema.items[i].name,
                                                  ori, cse, seen);
@@ -2532,7 +2534,7 @@
 
     if (!a)
         *(PFarray_t **) PFarray_at (subexps, n->kind)
-            = a = PFarray (sizeof (PFla_op_t *));
+            = a = PFarray (sizeof (PFla_op_t *), 15);
 
     PFla_op_t *temp = NULL;
 
@@ -2622,12 +2624,12 @@
 PFalgopt_cse (PFla_op_t *n)
 {
     /* initialize maps */
-    cse_map = PFarray (sizeof (ori_cse_map_t));
-    actatt_map = PFarray (sizeof (ori_actatt_map_t));
-    ori_map = PFarray (sizeof (cse_ori_map_t));
+    cse_map = PFarray (sizeof (ori_cse_map_t), 256);
+    actatt_map = PFarray (sizeof (ori_actatt_map_t), 256);
+    ori_map = PFarray (sizeof (cse_ori_map_t), 256);
  
-    /* initialize subexpression array */
-    subexps = PFarray (sizeof (PFarray_t *));
+    /* initialize subexpression array (and clear it) */
+    subexps = PFcarray (sizeof (PFarray_t *), 128);
 
     PFla_op_t *res = NULL;
 

Index: opt_thetajoin.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/opt/opt_thetajoin.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- opt_thetajoin.c     16 Feb 2008 19:42:40 -0000      1.20
+++ opt_thetajoin.c     17 Mar 2008 17:41:17 -0000      1.21
@@ -2429,7 +2429,7 @@
     /* replace original thetajoin operators by the internal
        variant */
     if (p->kind == la_thetajoin) {
-        PFarray_t *pred = PFarray (sizeof (pred_struct));
+        PFarray_t *pred = PFarray (sizeof (pred_struct), 5);
 
         for (i = 0; i < p->sem.thetajoin.count; i++)
             *(pred_struct *) PFarray_add (pred) =

Index: opt_join_pd.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/opt/opt_join_pd.c,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -d -r1.42 -r1.43
--- opt_join_pd.c       16 Feb 2008 19:42:40 -0000      1.42
+++ opt_join_pd.c       17 Mar 2008 17:41:14 -0000      1.43
@@ -2355,7 +2355,7 @@
 PFla_op_t *
 PFalgopt_join_pd (PFla_op_t *root)
 {
-    PFarray_t *clean_up_list = PFarray (sizeof (PFla_op_t *));
+    PFarray_t *clean_up_list = PFarray (sizeof (PFla_op_t *), 40);
     unsigned int tries = 0, max_tries = 0;
     bool modified = true;
 


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