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

Modified Files:
        parser.y scanner.l 
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: parser.y
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/parser/parser.y,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -d -r1.65 -r1.66
--- parser.y    27 Feb 2008 08:29:52 -0000      1.65
+++ parser.y    17 Mar 2008 17:41:27 -0000      1.66
@@ -2236,7 +2236,7 @@
                                  * initialize new dynamic array and insert
                                  * one (UTF-8) character
                                  */
-                                $$ = PFarray (sizeof (char));
+                                $$ = PFarray (sizeof (char), 512);
                                 while (*($1)) {
                                     *((char *) PFarray_add ($$)) = *($1);
                                     ($1)++;
@@ -2290,7 +2290,7 @@
                                  * initialize new dynamic array and insert
                                  * one (UTF-8) character
                                  */
-                                $$ = PFarray (sizeof (char));
+                                $$ = PFarray (sizeof (char), 512);
                                 while (*($1)) {
                                     *((char *) PFarray_add ($$)) = *($1);
                                     ($1)++;
@@ -2334,7 +2334,7 @@
 /* collect single characters in a dynamic array */
 Chars_                    : /* empty */
                             { /* initialize new dynamic array */
-                              $$ = PFarray (sizeof (char)); }
+                              $$ = PFarray (sizeof (char), 512); }
                           | Chars_ PFChar
                             {   /* append one (UTF-8) charater to array */
                                 while (*($2)) {
@@ -2892,7 +2892,7 @@
     PFscanner_init (input);
 
     /* initialize work list of modules to load */
-    modules = PFarray (sizeof (module_t));
+    modules = PFarray_default (sizeof (module_t));
     
     /* we don't explicitly ask for modules */
     module_only = false;

Index: scanner.l
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/parser/scanner.l,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -d -r1.56 -r1.57
--- scanner.l   11 Jan 2008 10:47:15 -0000      1.56
+++ scanner.l   17 Mar 2008 17:41:28 -0000      1.57
@@ -271,7 +271,7 @@
 {
     /* initialize lexical stack */
     lexical_sp = 0; 
-    lexical_stack = PFarray (sizeof (int));
+    lexical_stack = PFarray_default (sizeof (int));
 
     /*
      * In case yyin/pfin is not set, initialize it to /dev/null (Unix)
@@ -1168,7 +1168,7 @@
 {
     unsigned int   start = 0;
     unsigned int   end = 0;
-    PFarray_t     *ret = PFarray (sizeof (char));
+    PFarray_t     *ret = PFarray (sizeof (char), 512);
     char          *endptr;
     char          *entity;
     unsigned int   i = 0;


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