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

Modified Files:
        ns.c options.c subtyping.c typecheck.brg types.c xquery_fo.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: ns.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/semantics/ns.c,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -d -r1.39 -r1.40
--- ns.c        15 Feb 2008 12:37:41 -0000      1.39
+++ ns.c        17 Mar 2008 17:41:29 -0000      1.40
@@ -292,13 +292,7 @@
 static PFns_map_t *
 copy_ns_env (const PFns_map_t *src)
 {
-    PFns_map_t *dest = PFarray (sizeof (PFns_t));
-
-    for (unsigned int i = 0; i < PFarray_last (src); i++)
-        *((PFns_t *) PFarray_add (dest))
-            = *((PFns_t *) PFarray_at ((PFns_map_t *) src, i));
-
-    return dest;
+    return PFarray_copy ((PFns_map_t *) src);
 }
 
 
@@ -553,7 +547,7 @@
             PFns_t         old_fns       = fns;
             PFns_t         old_target_ns = target_ns;
 
-            stat_known_ns = PFarray (sizeof (PFns_t));
+            stat_known_ns = PFarray (sizeof (PFns_t), 50 /* assume initially 
50 namespaces */);
 
             /* bring the default NS into scope */
             ns_add (PFns_xml);
@@ -1024,7 +1018,7 @@
 void
 PFns_init (void)
 {
-    stat_known_ns = PFarray (sizeof (PFns_t));
+    stat_known_ns = PFarray (sizeof (PFns_t), 50 /* assume initially 50 
namespaces */);
 
     /* bring the default NS into scope */
     ns_add (PFns_xml);

Index: options.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/semantics/options.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- options.c   15 Feb 2008 12:37:41 -0000      1.3
+++ options.c   17 Mar 2008 17:41:29 -0000      1.4
@@ -98,7 +98,7 @@
 {
     assert (root);
 
-    PFoptions = PFenv ();
+    PFoptions = PFenv_ (400);
 
     recurse (root);
 

Index: xquery_fo.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/semantics/xquery_fo.c,v
retrieving revision 1.151
retrieving revision 1.152
diff -u -d -r1.151 -r1.152
--- xquery_fo.c 13 Feb 2008 20:42:06 -0000      1.151
+++ xquery_fo.c 17 Mar 2008 17:41:29 -0000      1.152
@@ -2308,7 +2308,7 @@
     PFqname_t    qn;
     unsigned int n;
 
-    PFfun_env = PFenv ();
+    PFfun_env = PFenv_ (180);
 
     for (n = 0; xquery_fo[n].loc; n++) {
         assert (xquery_fo[n].sig_count <= XQUERY_FO_MAX_SIGS);

Index: typecheck.brg
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/semantics/typecheck.brg,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -d -r1.66 -r1.67
--- typecheck.brg       15 Feb 2008 12:15:58 -0000      1.66
+++ typecheck.brg       17 Mar 2008 17:41:29 -0000      1.67
@@ -1270,7 +1270,7 @@
     /* construct (error) message listing the actual argument types:
      * ": t1; t2; ...; tn" (NB: n >= 1 is guaranteed here)
      */
-    PFarray_t *args_str = PFarray (sizeof (char));
+    PFarray_t *args_str = PFarray (sizeof (char), 128);
     char semi = ':';
 
     do {
@@ -1293,7 +1293,7 @@
         PFfun_t *fn       = *(PFfun_t **) PFarray_at (fns, i);
        
        for (unsigned j = 0; j < fn->sig_count; j++) {
-            args_str = PFarray (sizeof (char));
+            args_str = PFarray (sizeof (char), 512);
 
             PFfun_sig_t *sig = fn->sigs + j;
 

Index: subtyping.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/semantics/subtyping.c,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -d -r1.45 -r1.46
--- subtyping.c 11 Jan 2008 10:47:16 -0000      1.45
+++ subtyping.c 17 Mar 2008 17:41:29 -0000      1.46
@@ -130,7 +130,7 @@
  * @note These sets store pointers to their element types.
  */
 typedef PFarray_t *ty_set_t;
-#define ty_set()          ((ty_set_t) PFarray (sizeof (PFty_t *)))
+#define ty_set()          ((ty_set_t) PFarray_default (sizeof (PFty_t *)))
 #define ty_set_card(s)    (PFarray_last (s))
 #define ty_set_elem(s, n) (*(PFty_t **) PFarray_at ((s), (n)))
 #define ty_set_ins(s, t)  ((*(PFty_t **) PFarray_add (s)) = (t))
@@ -153,7 +153,7 @@
  * @note These sets store pointers to their element pairs.
  */
 typedef PFarray_t *ty_pair_set_t;
-#define ty_pair_set()          ((ty_pair_set_t )PFarray (sizeof (ty_pair_t *)))
+#define ty_pair_set()          ((ty_pair_set_t )PFarray_default (sizeof 
(ty_pair_t *)))
 #define ty_pair_set_card(s)    (PFarray_last (s))
 #define ty_pair_set_elem(s, n) (*(ty_pair_t **) PFarray_at ((s), (n)))
 #define ty_pair_set_ins(s, p)  ((*(ty_pair_t **) PFarray_add (s)) = (p))
@@ -175,7 +175,7 @@
  * @note These sets store pointers to their partial derivatives.
  */
 typedef PFarray_t *pd_ineq_set_t;
-#define pd_ineq_set()          ((pd_ineq_set_t) PFarray (sizeof (pd_ineq_t *)))
+#define pd_ineq_set()          ((pd_ineq_set_t) PFarray_default (sizeof 
(pd_ineq_t *)))
 #define pd_ineq_set_card(s)    (PFarray_last (s))
 #define pd_ineq_set_elem(s, n) (*(pd_ineq_t **) PFarray_at ((s), (n)))
 #define pd_ineq_set_ins(s, p)  ((*(pd_ineq_t **) PFarray_add (s)) = (p))
@@ -246,7 +246,7 @@
 
     assert (a);
 
-    s = PFarray (sizeof (void *));
+    s = PFarray_default (sizeof (void *));
 
     if (PFarray_last (a)) 
         for (n = 0; n < PFarray_last (a); n++) {

Index: types.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/semantics/types.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- types.c     11 Jan 2008 10:47:16 -0000      1.24
+++ types.c     17 Mar 2008 17:41:29 -0000      1.25
@@ -772,7 +772,7 @@
     PFarray_t *ts;
 
     /* the (empty) set of named types seen so far */
-    ts = PFarray (sizeof (PFty_t));
+    ts = PFarray_default (sizeof (PFty_t));
     assert (ts);
 
     return *(defn (t, ts));
@@ -914,7 +914,7 @@
 static char *
 ty_str (PFty_t t, int prec)
 {
-    PFarray_t *s = PFarray (sizeof (char));
+    PFarray_t *s = PFarray (sizeof (char), 128);
 
     assert (s);
 
@@ -1100,7 +1100,7 @@
     unsigned int n;
 
     /* initialize the XML Schema symbol spaces */
-    PFtype_defns      = PFenv ();
+    PFtype_defns      = PFenv_ (200);
     PFelem_decls      = PFenv ();
     PFattr_decls      = PFenv ();
     PFgroup_defns     = PFenv ();


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