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

Modified Files:
        core.c coreopt.brg fs.brg simplify.brg 
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: core.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/core/core.c,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -d -r1.60 -r1.61
--- core.c      25 Feb 2008 15:37:04 -0000      1.60
+++ core.c      17 Mar 2008 17:41:21 -0000      1.61
@@ -1391,7 +1391,8 @@
 
     assert (fn);
 
-    args = PFarray (sizeof (PFcnode_t *));
+    /* we assume functions to have less than 15 parameters */
+    args = PFarray (sizeof (PFcnode_t *), 15);
 
     va_start (arglist, fn);
     while ((a = va_arg (arglist, PFcnode_t *)))

Index: simplify.brg
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/core/simplify.brg,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -d -r1.37 -r1.38
--- simplify.brg        15 Feb 2008 12:15:57 -0000      1.37
+++ simplify.brg        17 Mar 2008 17:41:22 -0000      1.38
@@ -732,7 +732,7 @@
 
     /* set up variable replacement environment */
     for (unsigned short i = 0; i < HASH_BUCKETS; i++)
-        var_env[i] = PFarray (sizeof (bind_t));
+        var_env[i] = PFarray (sizeof (bind_t), 128);
 
     /* label the Core tree bottom up */
     PFsimplify_label (r);

Index: coreopt.brg
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/core/coreopt.brg,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -d -r1.60 -r1.61
--- coreopt.brg 22 Feb 2008 12:46:27 -0000      1.60
+++ coreopt.brg 17 Mar 2008 17:41:21 -0000      1.61
@@ -1566,12 +1566,12 @@
 
     /* set up variable replacement environment */
     for (unsigned short i = 0; i < HASH_BUCKETS; i++)
-        var_env[i] = PFarray (sizeof (bind_t));
+        var_env[i] = PFarray (sizeof (bind_t), 128);
 
     /* set up a variable environment to record unused variables */
-    unused_var_env = PFarray (sizeof (bind_t)),
+    unused_var_env = PFarray (sizeof (bind_t), 128),
     /* set up a variable environment to record variable references */
-    used_var_env = PFarray (sizeof (bind_t)),
+    used_var_env = PFarray (sizeof (bind_t), HASH_BUCKETS * 128),
 
     /* label the Core tree bottom up */
     PFcoreopt_label (r);

Index: fs.brg
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/core/fs.brg,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -d -r1.66 -r1.67
--- fs.brg      25 Feb 2008 15:37:04 -0000      1.66
+++ fs.brg      17 Mar 2008 17:41:22 -0000      1.67
@@ -3924,7 +3924,8 @@
 static PFty_t *
 parameter_types (PFpnode_t *paramlist)
 {
-    PFarray_t *par_ty = PFarray (sizeof (PFty_t));
+    /* we assume functions to have less than 15 parameters */
+    PFarray_t *par_ty = PFarray (sizeof (PFty_t), 15);
     PFpnode_t *n = paramlist;
 
     assert (paramlist);
@@ -4030,13 +4031,13 @@
     core_vars = 0;
 
     /* initially, there is no function on the current function stack */
-    funs = PFarray (sizeof (PFfun_t *));
+    funs = PFarray (sizeof (PFfun_t *), 20);
 
     /* initially, there is no argument list on the current arguments stack */
-    args = PFarray (sizeof (PFcnode_t *));
+    args = PFarray (sizeof (PFcnode_t *), 20);
 
     /* initially, there nothing on the current argument number stack */
-    arg_num = PFarray (sizeof (short));
+    arg_num = PFarray (sizeof (short), 20);
 
     /* initially, the context item is undefined */
     fs_dot = NULL;


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