This is an archive of the discontinued LLVM Phabricator instance.

Merge two small functions and add comments.
ClosedPublic

Authored by ruiu on Feb 16 2018, 12:45 PM.

Diff Detail

Repository
rLLD LLVM Linker

Event Timeline

ruiu created this revision.Feb 16 2018, 12:45 PM
ruiu added a comment.Feb 16 2018, 12:50 PM

By the way, what is InputChunk::copyRelocations for? That function copies relocations from other InputChunk, but it's not clear to me why we need to do that.

sbc100 accepted this revision.Feb 16 2018, 12:53 PM
sbc100 added inline comments.
lld/wasm/InputChunks.cpp
77 ↗(On Diff #134696)

I think this static function was probably a legacy of time where it have many calls sites.. Thanks for cleaning this up.

79 ↗(On Diff #134696)

How do you feel about documentation here vs declaration in the .h file?

This revision is now accepted and ready to land.Feb 16 2018, 12:53 PM
ruiu added inline comments.Feb 16 2018, 12:57 PM
lld/wasm/InputChunks.cpp
79 ↗(On Diff #134696)

Why not both? :)

ruiu updated this revision to Diff 134703.Feb 16 2018, 12:57 PM
  • update as per Sam's comments

By the way, what is InputChunk::copyRelocations for? That function copies relocations from other InputChunk, but it's not clear to me why we need to do that.

Its makes a copy of the relocations that apply to that particular chunk. They are used later in calcRelocations, but I imagine they could be merged.

(BTW, We are considering moving to a model where relocations would be stored on a per-chunk, rather than per section basis, to avoid this linear search, which seems rather pointless).

sbc100 added inline comments.Feb 16 2018, 1:01 PM
lld/wasm/InputChunks.cpp
79 ↗(On Diff #134696)

Not sure that makes sense. It means the old probably of comments being out-of-date is now double because the can also be out of date with themselves! :)

ruiu added inline comments.Feb 16 2018, 1:03 PM
lld/wasm/InputChunks.cpp
79 ↗(On Diff #134696)

writeTo() is actually pretty stable interface and I don't think it would change. But if you don't want to have duplicate comments, I can remove it from, perhaps, .h file, because we have bunch of comments in this file rather than in the .h file.

sbc100 added inline comments.Feb 16 2018, 2:36 PM
lld/wasm/InputChunks.cpp
79 ↗(On Diff #134696)

I don't feel strongly but I feel like we should probably be consistent and decide which we prefer (.h or .cpp). No urgent need to fix this one now.

ruiu added inline comments.Feb 16 2018, 2:54 PM
lld/wasm/InputChunks.cpp
79 ↗(On Diff #134696)

I'll go ahead with removing the comment from .h file because it is at least consistent with the local convention in this file.

ruiu updated this revision to Diff 134740.Feb 16 2018, 3:06 PM
  • removed a comment from the .h file
This revision was automatically updated to reflect the committed changes.