This is an archive of the discontinued LLVM Phabricator instance.

[BOLT] Change base class of ExecutableFileMemoryManager
ClosedPublic

Authored by maksfb on Sep 15 2022, 4:56 PM.

Details

Summary

When we derive EFMM from SectionMemoryManager, it brings into EFMM extra
functionality, such as the registry of exception handling sections,
page permission management, etc. Such functionality is of no use to
llvm-bolt and can even be detrimental (see
https://github.com/llvm/llvm-project/issues/56726).

Change the base class of ExecutableFileMemoryManager to MemoryManager,
avoid registering EH sections, and skip memory finalization.

Fixes #56726

Diff Detail

Event Timeline

maksfb created this revision.Sep 15 2022, 4:56 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 15 2022, 4:56 PM
Herald added a subscriber: treapster. · View Herald Transcript
maksfb requested review of this revision.Sep 15 2022, 4:56 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 15 2022, 4:56 PM
maksfb planned changes to this revision.Sep 15 2022, 5:58 PM
maksfb updated this revision to Diff 460842.Sep 16 2022, 12:09 PM

Don't free memory allocated by EFMM.

yota9 added inline comments.Sep 16 2022, 12:30 PM
bolt/include/bolt/Rewrite/ExecutableFileMemoryManager.h
36

It seems to me that 4 is not suitable number and might be increased significantly, maybe like 32 or even 64, what do you think?

maksfb added inline comments.Sep 16 2022, 12:41 PM
bolt/include/bolt/Rewrite/ExecutableFileMemoryManager.h
36

In relocation mode, there are not that many sections emitted. I can bump it to 8.

maksfb updated this revision to Diff 460853.Sep 16 2022, 12:43 PM

Change SmallVector size for AllocatedSections.

yota9 accepted this revision.Sep 16 2022, 1:06 PM
yota9 added inline comments.
bolt/include/bolt/Rewrite/ExecutableFileMemoryManager.h
36

You're right it is too much, I was also thinking about debug sections, that might be around ~8 as I understand. But I don't insist here, thanks for bumping anyway :)

This revision is now accepted and ready to land.Sep 16 2022, 1:06 PM
maksfb added inline comments.Sep 16 2022, 1:09 PM
bolt/include/bolt/Rewrite/ExecutableFileMemoryManager.h
36

For now it’s only .debug_line come get from EFMM.

maksfb added inline comments.Sep 16 2022, 1:35 PM
bolt/include/bolt/Rewrite/ExecutableFileMemoryManager.h
36

Sorry, sent that from my phone. Most debug sections we emit directly. For now, only .debug_line is emitted via MC and gets allocated by EFMM. Thanks for the review.

This revision was automatically updated to reflect the committed changes.
yota9 added inline comments.Sep 16 2022, 1:39 PM
bolt/include/bolt/Rewrite/ExecutableFileMemoryManager.h
36

Thanks for clarifying and this change :)