statistics.
(print_objfile_statistics): Likewise.
* symfile.c (reread_symbols): Initialize filename_cache.
(allocate_symtab): Cache the file name.
(allocate_psymtab): Likewise.
* solib-sunos.c (allocate_rt_common_objfile): Initialize
filename_cache.
* objfiles.h (struct objfile) <filename_cache>: New field.
* objfiles.c (allocate_objfile): Initialize filename_cache.
(free_objfile): Free filename_cache.
+2009-11-05 Tom Tromey <tromey@redhat.com>
+
+ * symmisc.c (print_symbol_bcache_statistics): Print filename cache
+ statistics.
+ (print_objfile_statistics): Likewise.
+ * symfile.c (reread_symbols): Initialize filename_cache.
+ (allocate_symtab): Cache the file name.
+ (allocate_psymtab): Likewise.
+ * solib-sunos.c (allocate_rt_common_objfile): Initialize
+ filename_cache.
+ * objfiles.h (struct objfile) <filename_cache>: New field.
+ * objfiles.c (allocate_objfile): Initialize filename_cache.
+ (free_objfile): Free filename_cache.
+
2009-11-05 Tom Tromey <tromey@redhat.com>
* symfile.c (add_psymbol_to_bcache): Make 'psymbol' static again.
objfile = (struct objfile *) xzalloc (sizeof (struct objfile));
objfile->psymbol_cache = bcache_xmalloc ();
objfile->macro_cache = bcache_xmalloc ();
+ objfile->filename_cache = bcache_xmalloc ();
/* We could use obstack_specify_allocation here instead, but
gdb_obstack.h specifies the alloc/dealloc functions. */
obstack_init (&objfile->objfile_obstack);
/* Free the obstacks for non-reusable objfiles */
bcache_xfree (objfile->psymbol_cache);
bcache_xfree (objfile->macro_cache);
+ bcache_xfree (objfile->filename_cache);
if (objfile->demangled_names_hash)
htab_delete (objfile->demangled_names_hash);
obstack_free (&objfile->objfile_obstack, 0);
struct bcache *psymbol_cache; /* Byte cache for partial syms */
struct bcache *macro_cache; /* Byte cache for macros */
+ struct bcache *filename_cache; /* Byte cache for file names. */
/* Hash table for mapping symbol names to demangled names. Each
entry in the hash table is actually two consecutive strings,
memset (objfile, 0, sizeof (struct objfile));
objfile->psymbol_cache = bcache_xmalloc ();
objfile->macro_cache = bcache_xmalloc ();
+ objfile->filename_cache = bcache_xmalloc ();
obstack_init (&objfile->objfile_obstack);
objfile->name = xstrdup ("rt_common");
objfile->psymbol_cache = bcache_xmalloc ();
bcache_xfree (objfile->macro_cache);
objfile->macro_cache = bcache_xmalloc ();
+ bcache_xfree (objfile->filename_cache);
+ objfile->filename_cache = bcache_xmalloc ();
if (objfile->demangled_names_hash != NULL)
{
htab_delete (objfile->demangled_names_hash);
objfile->psymbol_cache = bcache_xmalloc ();
objfile->macro_cache = bcache_xmalloc ();
+ objfile->filename_cache = bcache_xmalloc ();
/* obstack_init also initializes the obstack so it is
empty. We could use obstack_specify_allocation but
gdb_obstack.h specifies the alloc/dealloc
symtab = (struct symtab *)
obstack_alloc (&objfile->objfile_obstack, sizeof (struct symtab));
memset (symtab, 0, sizeof (*symtab));
- symtab->filename = obsavestring (filename, strlen (filename),
- &objfile->objfile_obstack);
+ symtab->filename = (char *) bcache (filename, strlen (filename) + 1,
+ objfile->filename_cache);
symtab->fullname = NULL;
symtab->language = deduce_language_from_filename (filename);
symtab->debugformat = "unknown";
sizeof (struct partial_symtab));
memset (psymtab, 0, sizeof (struct partial_symtab));
- psymtab->filename = obsavestring (filename, strlen (filename),
- &objfile->objfile_obstack);
+ psymtab->filename = (char *) bcache (filename, strlen (filename) + 1,
+ objfile->filename_cache);
psymtab->symtab = NULL;
/* Prepend it to the psymtab list for the objfile it belongs to.
printf_filtered (_("Byte cache statistics for '%s':\n"), objfile->name);
print_bcache_statistics (objfile->psymbol_cache, "partial symbol cache");
print_bcache_statistics (objfile->macro_cache, "preprocessor macro cache");
+ print_bcache_statistics (objfile->filename_cache, "file name cache");
}
immediate_quit--;
}
bcache_memory_used (objfile->psymbol_cache));
printf_filtered (_(" Total memory used for macro cache: %d\n"),
bcache_memory_used (objfile->macro_cache));
+ printf_filtered (_(" Total memory used for file name cache: %d\n"),
+ bcache_memory_used (objfile->filename_cache));
}
immediate_quit--;
}