]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Don't obstack-allocate the CU dependency hash table
authorTom Tromey <tromey@adacore.com>
Wed, 5 Jun 2024 14:19:34 +0000 (08:19 -0600)
committerTom Tromey <tromey@adacore.com>
Mon, 24 Jun 2024 15:11:29 +0000 (09:11 -0600)
The CU dependency hash table is obstack-allocated, but there's no need
to do this.

gdb/dwarf2/cu.c
gdb/dwarf2/cu.h

index a64cb1d8380ff2fc55b9f24ecb54fa5a89fc8e43..aae61cccd212ccfddeed8fb8e212ed2f028017f4 100644 (file)
@@ -146,7 +146,7 @@ dwarf2_cu::mark ()
     {
       m_mark = true;
       if (m_dependencies != nullptr)
-       htab_traverse (m_dependencies, dwarf2_mark_helper, per_objfile);
+       htab_traverse (m_dependencies.get (), dwarf2_mark_helper, per_objfile);
     }
 }
 
@@ -158,13 +158,11 @@ dwarf2_cu::add_dependence (struct dwarf2_per_cu_data *ref_per_cu)
   void **slot;
 
   if (m_dependencies == nullptr)
-    m_dependencies
-      = htab_create_alloc_ex (5, htab_hash_pointer, htab_eq_pointer,
-                             NULL, &comp_unit_obstack,
-                             hashtab_obstack_allocate,
-                             dummy_obstack_deallocate);
+    m_dependencies.reset (htab_create_alloc
+                         (5, htab_hash_pointer, htab_eq_pointer,
+                          nullptr, xcalloc, xfree));
 
-  slot = htab_find_slot (m_dependencies, ref_per_cu, INSERT);
+  slot = htab_find_slot (m_dependencies.get (), ref_per_cu, INSERT);
   if (*slot == nullptr)
     *slot = ref_per_cu;
 }
index 94e73eb381323dd94d1bd6c25369138060b8efc9..d23cc9b70e5e773d2ea80a87e919f4c4cdf3471d 100644 (file)
@@ -122,7 +122,7 @@ private:
   /* A set of pointers to dwarf2_per_cu_data objects for compilation
      units referenced by this one.  Only set during full symbol processing;
      partial symbol tables do not have dependencies.  */
-  htab_t m_dependencies = nullptr;
+  htab_up m_dependencies;
 
 public:
   /* The generic symbol table building routines have separate lists for