* configure.tgt (mips64r5900*-sky-elf*): Replaces txvu-elf.
[deliverable/binutils-gdb.git] / gdb / bcache.h
index e389c8eb16bf408780b1f5aedebc460a00bee1d7..48b71e28cf0af9f1d752b8815be363a3337f2c7e 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,11 @@ struct bcache {
 extern void *
 bcache PARAMS ((void *bytes, int count, struct bcache *bcachep));
 
+#if MAINTENANCE_CMDS
+
+extern void
+print_bcache_statistics PARAMS ((struct bcache *, char *));
+
+#endif /* MAINTENANCE_CMDS */
+
 #endif /* BCACHE_H */
This page took 0.023019 seconds and 4 git commands to generate.