This is an archive of the discontinued LLVM Phabricator instance.

[lld][WebAssembly] Refactor input chunk class hierarchy. NFC
ClosedPublic

Authored by sbc100 on May 14 2021, 9:51 PM.

Details

Summary

The main motivation for this refactor is to remove the subclass
relationship between the InputSegment and MergeInputSegment and
SyntenticMergedInputSegment so that we can use the merging classes for
debug sections which are not data segments.

In the process of refactoring I also remove all the virtual functions
from the class hierarchy, reusing techniques used in the ELF
linker (see lld/ELF/InputSections.h).

Diff Detail

Event Timeline

sbc100 created this revision.May 14 2021, 9:51 PM
sbc100 requested review of this revision.May 14 2021, 9:51 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 14 2021, 9:51 PM
sbc100 updated this revision to Diff 345607.May 14 2021, 9:54 PM
  • rebase
sbc100 updated this revision to Diff 345964.May 17 2021, 12:16 PM
  • remove last virtual functions
sbc100 edited the summary of this revision. (Show Details)May 17 2021, 12:33 PM
sbc100 added a reviewer: dschuff.
dschuff added inline comments.May 17 2021, 5:07 PM
lld/wasm/InputChunks.h
68–69
123

Ick. I guess this is the trick you borrowed from ELF to avoid virtual functions? I guess the idea is that the subclass can mutate this directly, but the superclass can return it as const?

156

Is this still true?

230

should we rename this kind to MergedChunk?

322

why this naming scheme for body_?

sbc100 updated this revision to Diff 346021.May 17 2021, 5:15 PM
sbc100 marked 3 inline comments as done.
  • feedback

Thanks!

lld/wasm/InputChunks.h
123

Oops, thanks for spotting that! I don't need that here.. was cargo culted directly from ELF

156

Yes. In fact its more true now since the name here matches the ELF name now.

dschuff accepted this revision.May 17 2021, 5:53 PM
This revision is now accepted and ready to land.May 17 2021, 5:53 PM
This revision was landed with ongoing or failed builds.May 17 2021, 9:02 PM
This revision was automatically updated to reflect the committed changes.