This is an archive of the discontinued LLVM Phabricator instance.

[WebAssembly] Implement --trace (-y) and --trace-symbol
ClosedPublic

Authored by sbc100 on Feb 4 2019, 4:36 PM.

Diff Detail

Repository
rLLD LLVM Linker

Event Timeline

sbc100 created this revision.Feb 4 2019, 4:36 PM
sbc100 added a reviewer: ruiu.Feb 4 2019, 4:36 PM
sbc100 updated this revision to Diff 185190.Feb 4 2019, 4:39 PM
  • update test
sbc100 updated this revision to Diff 185191.Feb 4 2019, 4:39 PM
  • remove debugging
sbc100 retitled this revision from [WebAssembly] Implement --trace and --trace-symbol to [WebAssembly] Implement --trace (-y) and --trace-symbol.Feb 5 2019, 8:48 AM
ruiu added inline comments.Feb 5 2019, 10:41 AM
wasm/SymbolTable.cpp
439

Is this implementation complete? I think you can track only one symbol with this implementation.

sbc100 marked an inline comment as done.Feb 5 2019, 10:56 AM
sbc100 added inline comments.
wasm/SymbolTable.cpp
439

Yes, you are correct. Thats all I needed in my example use case, so I didn't realize the intention was allow multiple symbols to be traced.

sbc100 updated this revision to Diff 185410.Feb 5 2019, 2:30 PM
  • .
  • support multiple traced symbols
  • feedback
sbc100 updated this revision to Diff 185411.Feb 5 2019, 2:31 PM
  • clang-format
ruiu added inline comments.Feb 5 2019, 2:35 PM
wasm/SymbolTable.cpp
106–107

Any operation that we do for each symbol can be super expensive, as the number of symbols can be in the order of millions. In particular, lld should do more than one hash table lookup for each symbol. This is one of reasons why lld is so fast.

So, this new hash table shouldn't be added. Take a look at ELF/SymbolTable.cpp. We implemented this feature without adding a new hash table lookup.

sbc100 updated this revision to Diff 185424.Feb 5 2019, 3:20 PM
  • update test
  • avoid hash
ruiu added a comment.Feb 5 2019, 3:47 PM

Overall looks good.

test/ELF/trace.s
9 ↗(On Diff #185424)

unrelated change?

wasm/SymbolTable.cpp
112

Use true instead of 1.

wasm/SymbolTable.h
84–88

Thank you for adding this comment.

92–95

Dead members.

sbc100 updated this revision to Diff 185443.Feb 5 2019, 4:50 PM
  • feedback
ruiu accepted this revision.Feb 5 2019, 5:31 PM

LGTM

This revision is now accepted and ready to land.Feb 5 2019, 5:31 PM
This revision was automatically updated to reflect the committed changes.