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

Modified Files:
        lalg2sql.brg sql.c sql_opt.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: sql.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/sql/sql.c,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -d -r1.56 -r1.57
--- sql.c       14 Mar 2008 12:57:26 -0000      1.56
+++ sql.c       17 Mar 2008 17:41:30 -0000      1.57
@@ -383,7 +383,7 @@
     /* create a new comment tree node */
     PFsql_t *ret = leaf (sql_comment);
  
-    PFarray_t *a = PFarray (sizeof (char));
+    PFarray_t *a = PFarray (sizeof (char), 60);
  
     /* create the formatted string */
     va_list args;

Index: lalg2sql.brg
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/sql/lalg2sql.brg,v
retrieving revision 1.124
retrieving revision 1.125
diff -u -d -r1.124 -r1.125
--- lalg2sql.brg        14 Mar 2008 12:57:24 -0000      1.124
+++ lalg2sql.brg        17 Mar 2008 17:41:29 -0000      1.125
@@ -527,7 +527,7 @@
 /**
  * Returns a new column environment.
  */
-#define col_env_new() (PFarray (sizeof (sql_column_env_t)))
+#define col_env_new() (PFarray (sizeof (sql_column_env_t), 20))
 
 /**
  * Adds a (attribute/type -> expression)
@@ -776,7 +776,7 @@
 /**
  * Returns a new fromlist.
  */
-#define from_list_new() (PFarray (sizeof (sql_from_list_t)))
+#define from_list_new() (PFarray (sizeof (sql_from_list_t), 10))
 
 /**
  * Add a (table, alias) pair to the fromlist.
@@ -834,7 +834,7 @@
 /**
  * Returns a new wherelist.
  */
-#define where_list_new() (PFarray (sizeof (PFsql_t *)))
+#define where_list_new() (PFarray (sizeof (PFsql_t *), 10))
 
 /**
  * Add a predicate to the wherelist.
@@ -1568,7 +1568,7 @@
 static PFsql_t *
 collect_fragments (PFla_op_t * p)
 {
-    PFarray_t *frags = PFarray (sizeof (PFsql_t *));
+    PFarray_t *frags = PFarray (sizeof (PFsql_t *), 5);
 
     collect_frag_worker (p, frags);
 
@@ -3780,7 +3780,7 @@
                 PFord_ordering_t sortby = p->sem.sort.sortby;
                 unsigned int     i, j, k;
                 PFalg_att_t      ord;
-                PFarray_t       *srtbylist = PFarray (sizeof (PFsql_t *));
+                PFarray_t       *srtbylist = PFarray (sizeof (PFsql_t *), 10);
                 bool             asc, cols_added;
                 rank_map_t      *rank_map;
 
@@ -3818,7 +3818,7 @@
 
                 /* initialize rankmap */
                 if (!RANK_MAP(p))
-                    RANK_MAP(p) = PFarray (sizeof (rank_map_t *));
+                    RANK_MAP(p) = PFarray (sizeof (rank_map_t *), 2);
 
                 /* add new entry to the rank map */
                 rank_map = PFmalloc (sizeof (rank_map_t));
@@ -4471,7 +4471,7 @@
                     *iter_size = NULL, *content = NULL,
                     *frag, *sel, *selectlist;
 
-            PFarray_t *frags = PFarray (sizeof (PFsql_t *));
+            PFarray_t *frags = PFarray (sizeof (PFsql_t *), 5);
             /* collect the duplicate free list of fragment references */
             collect_frag_worker (L(p), frags);
             assert (PFarray_last (frags));
@@ -4699,7 +4699,9 @@
                 unsigned int i;                                               \
                 if (RANK_MAP(src)) {                                          \
                     if (!RANK_MAP(dest))                                      \
-                        RANK_MAP(dest) = PFarray (sizeof (rank_map_t *));     \
+                        RANK_MAP(dest) = PFarray (                            \
+                                             sizeof (rank_map_t *),           \
+                                             PFarray_last (RANK_MAP(src)));   \
                     for (i = 0; i < PFarray_last (RANK_MAP(src)); i++)        \
                         *(rank_map_t **) PFarray_add (RANK_MAP(dest))         \
                             = *(rank_map_t **) PFarray_at (RANK_MAP(src), i); \
@@ -5089,7 +5091,7 @@
 static void
 infer_ser_info (PFla_op_t * p)
 {
-    PFarray_t *twigs = PFarray (sizeof (PFla_op_t*)),
+    PFarray_t *twigs = PFarray (sizeof (PFla_op_t*), 2),
               *ranks;
     bool twig_only = false;
 
@@ -5102,7 +5104,7 @@
         return;
 
     /* prepare a list for the rank operators */
-    ranks = PFarray (sizeof(PFla_op_t*));
+    ranks = PFarray (sizeof(PFla_op_t*), 2);
 
     /* infer the serialization info */
     ser_info_worker (R(p), twigs, ranks);

Index: sql_opt.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/sql/sql_opt.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- sql_opt.c   15 Feb 2008 12:37:41 -0000      1.3
+++ sql_opt.c   17 Mar 2008 17:41:31 -0000      1.4
@@ -225,9 +225,9 @@
     unsigned int i, j;
     PFsql_aident_t new_alias, old_alias;
     PFsql_t *where;
-    PFarray_t *aliases   = PFarray (sizeof (PFsql_t *)),
-              *names     = PFarray (sizeof (PFsql_t *)),
-              *tmp_names = PFarray (sizeof (PFsql_t *));
+    PFarray_t *aliases   = PFarray (sizeof (PFsql_t *), 10),
+              *names     = PFarray (sizeof (PFsql_t *), 10),
+              *tmp_names = PFarray (sizeof (PFsql_t *), 10);
     
     assert (n->kind == sql_select);
 


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