[PATCH] D13188: [MachO] Stop generating *coal* sections.

Vedant Kumar via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 6 16:49:25 PDT 2015


vsk added a comment.

I think Rafael's suggestion is probably a good one, but is unrelated to Akira's problem. Comment inline --


================
Comment at: include/llvm/MC/MCContext.h:204
@@ +203,3 @@
+    /// section.
+    StringMap<std::shared_ptr<MCSectionMachO>> MachOUniquingMap;
+
----------------
ahatanak wrote:
> rafael wrote:
> > This is needed because we pool allocate sections, but not fragments and then have to manually call the section destructors.
> > 
> > Could you try pool allocating the fragments first? There are way more fragments than sections, so this would be a good change anyway.
> I think I need more clarification to understand what you are suggesting.
> 
> Do you mean we don't need to use shared_ptr after we make changes to use BumpPtrAllocator for MCFragments? 
> 
@rafael - The "Fragments" list and the "SubsectionFragmentMap" SmallVector both need to be destroyed. Using a pool allocator for fragments is probably a good idea, but it won't solve Akira's problem since the SmallVector's contents would be leaked.

If there's a concern about the overhead of shared_ptr, we could consider adding a refcount field to MCSection proper. That at least eliminates extra allocations for shared_ptr control blocks.

Let me know what you think :).


http://reviews.llvm.org/D13188





More information about the llvm-commits mailing list