import gdb-19990422 snapshot
[deliverable/binutils-gdb.git] / gdb / bcache.h
index e389c8eb16bf408780b1f5aedebc460a00bee1d7..4b753be42dca5860fda285f79b74d13e2eaa70f6 100644 (file)
@@ -25,11 +25,30 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 #define BCACHE_HASHSIZE        (1 << BCACHE_HASHLENGTH)
 #define BCACHE_MAXLENGTH       128
 
+/* Note that the user data is stored in data[].  Since it can be any type,
+   it needs to have the same alignment  as the most strict alignment of 
+   any type on the host machine.  So do it the same way obstack does. */
+
 struct hashlink {
   struct hashlink *next;
-  char data[1];
+  union {
+    char data[1];
+    double dummy;
+  } d;
 };
 
+/* BCACHE_DATA is used to get the address of the cached data. */
+
+#define BCACHE_DATA(p) ((p)->d.data)
+
+/* BCACHE_DATA_ALIGNMENT is used to get the offset of the start of
+   cached data within the hashlink struct.  This value, plus the
+   size of the cached data, is the amount of space to allocate for
+   a hashlink struct to hold the next pointer and the data. */
+
+#define BCACHE_DATA_ALIGNMENT \
+       (((char *) BCACHE_DATA((struct hashlink*) 0) - (char *) 0))
+
 struct bcache {
   struct obstack cache;
   struct hashlink **indextable[BCACHE_MAXLENGTH];
@@ -43,4 +62,7 @@ struct bcache {
 extern void *
 bcache PARAMS ((void *bytes, int count, struct bcache *bcachep));
 
+extern void
+print_bcache_statistics PARAMS ((struct bcache *, char *));
+
 #endif /* BCACHE_H */
This page took 0.024796 seconds and 4 git commands to generate.