Update of /cvsroot/monetdb/pathfinder/compiler/include
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv24398/include
Modified Files:
array.h env.h
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: array.h
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/include/array.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- array.h 11 Jan 2008 10:47:04 -0000 1.12
+++ array.h 17 Mar 2008 17:41:23 -0000 1.13
@@ -7,8 +7,8 @@
* does not yield an error but lets the array grow as needed.
*
* Basic interface:
- * - PFarray (s) create new array with elements of s bytes length each,
- * set array ``append index'' to 0
+ * - PFarray (s,sl) create new array with elements of s bytes length each
+ * and initially sl slots, set array ``append index'' to 0
* - PFarray_at (a, i) address of ith element in array a (a grows as needed)
* - PFarray_last (a) ``append index'': where to append to this array (r/w)
*
@@ -71,11 +71,24 @@
unsigned int bound; /**< current index bound (index 0...bound - 1 OK) */
unsigned int appi; /**< current array append index */
size_t esize; /**< array element size */
+ bool clear; /**< initially cleared array */
};
-PFarray_t *PFarray (size_t);
+PFarray_t *PFarray_ (size_t, unsigned int slots, bool clear);
+#define PFarray_default(s) (PFarray_((s), 20, false))
+#define PFcarray_default(s) (PFarray_((s), 20, true))
+#define PFarray(s,sl) (PFarray_((s), sl, false))
+#define PFcarray(s,sl) (PFarray_((s), sl, true))
+/* Wrapper to get information about the caller
+ (can be used to fine-tune the memory allocation of arrays) */
+#ifndef NDEBUG
+void *PFarray_at_ (PFarray_t *, unsigned int,
+ const char *, const char *, const int);
+#define PFarray_at(a,i) (PFarray_at_((a),(i), __FILE__, __func__, __LINE__))
+#else
void *PFarray_at (PFarray_t *, unsigned int);
+#endif
/**
* Append index of array @c a (may be written to).
@@ -135,6 +148,10 @@
*/
void PFarray_del (PFarray_t *);
+#ifndef NDEBUG
+void PFarray_init (void);
+#endif
+
#endif
/* vim:set shiftwidth=4 expandtab: */
Index: env.h
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/include/env.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- env.h 11 Jan 2008 10:47:05 -0000 1.13
+++ env.h 17 Mar 2008 17:41:23 -0000 1.14
@@ -45,7 +45,8 @@
typedef PFarray_t PFenv_t;
/* create a new environment */
-PFenv_t *PFenv (void);
+PFenv_t *PFenv_ (unsigned int initial_slots);
+#define PFenv() (PFenv_ (20))
/* bind key to value in environment
* (return 0 if key was unbound, value otherwise)
-------------------------------------------------------------------------
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