This is an archive of the discontinued LLVM Phabricator instance.

[lld][WebAssembly] Common superclass for input globals/events/tables
ClosedPublic

Authored by wingo on Jan 14 2021, 4:49 AM.

Details

Summary

This commit regroups commonalities among InputGlobal, InputEvent, and
InputTable into the new InputDefinition. The subclasses are defined
inline in the new InputDefinition.h. NFC.

Depends on D91870.

Diff Detail

Event Timeline

wingo created this revision.Jan 14 2021, 4:49 AM
wingo requested review of this revision.Jan 14 2021, 4:49 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 14 2021, 4:49 AM
wingo added a comment.Jan 14 2021, 4:52 AM

This followup refactor is as suggested in https://reviews.llvm.org/D94075. NFC.

wingo added a comment.Feb 3 2021, 2:02 AM

This followup refactor is as suggested in https://reviews.llvm.org/D94075. NFC.

Ping. Should apply more or less fine to "main".

wingo added 1 blocking reviewer(s): sbc100.Feb 3 2021, 2:02 AM
sbc100 added a subscriber: tlively.Feb 3 2021, 8:18 AM

You can add "NFC" to the title to label this as a non-functional change.

lld/wasm/InputDefinition.h
2 ↗(On Diff #316626)

I don't love the name "InputDefinition", but I don't have any great ideas for anything better.

Maybe @tlively has some thoughts?

lld/wasm/Writer.cpp
213

Is moving this code into a method a separate refactor, or essential to the PR? (Just wondering, not asking you split it out necessarily).

Why make this into its own method? Given that it only has a single call site. I'm mostly curious what your thinking is, not opposed to this.

Do you think its still worth keeping this function now now that its just one line?

tlively added inline comments.Feb 3 2021, 11:05 AM
lld/wasm/InputDefinition.h
2 ↗(On Diff #316626)

Would InputItem be better?

sbc100 requested changes to this revision.Feb 8 2021, 3:17 PM
This revision now requires changes to proceed.Feb 8 2021, 3:17 PM
wingo added a comment.Feb 9 2021, 7:28 AM

I see that this is marked changes requested, but I don't understand what changes -- is it InputItem?

lld/wasm/Writer.cpp
213

Paging this back in -- I think this was because the different InputGlobal, InputEvent etc had different styles with regards to what was public instance state and what had to be accessed via methods. To harmonize these things, now that they are all in one file, I made the InitExpr be private and added the method accessor. & Of course no, this setGlobalPointer method is certainly no longer needed at this point. WDYT?

sbc100 added a comment.Feb 9 2021, 7:47 AM

lgtm with the base class rename.

Regarding the "requested changes" features, I was going through all my outstanding reviews and trying to audit them all. For any issue where the last set of comments were from me I thought it would make sense to mark like this to take it off my incoming queue.

lld/wasm/InputDefinition.h
2 ↗(On Diff #316626)

How about "InputElement" ? I think we have used element elsewhere to refer to something that might be global or an event, etc. See ElementIndex in WasmSymbolInfo for example.

25 ↗(On Diff #316626)

Is the explicit keyword useful here? I'm used to seeing it mostly on single-arg constructors.

sbc100 added inline comments.Feb 9 2021, 7:49 AM
lld/wasm/Writer.cpp
213

I'll leave to you.. if you think this one-line method makes the code below more readable feel free to leave it.

sbc100 accepted this revision.Feb 9 2021, 7:49 AM
This revision is now accepted and ready to land.Feb 9 2021, 7:49 AM
wingo updated this revision to Diff 322967.Feb 11 2021, 5:50 AM
wingo marked 3 inline comments as done.

Address feedback

wingo added inline comments.Feb 11 2021, 5:54 AM
lld/wasm/InputDefinition.h
25 ↗(On Diff #316626)

Aah good catch; fixed.

This revision was landed with ongoing or failed builds.Feb 11 2021, 5:57 AM
This revision was automatically updated to reflect the committed changes.
lld/wasm/InputFiles.cpp