This is an archive of the discontinued LLVM Phabricator instance.

[WebAssembly] Encode numbers in ULEB128 in event section
ClosedPublic

Authored by aheejin on Mar 30 2021, 4:11 PM.

Details

Summary

The number of events and the type index should be encoded in ULEB128,
but they were incorrctly encoded in LEB128. The smallest number with
which its LEB128 and ULEB128 encodings are different is 64.
There's no way we can generate 64 events in the C++ toolchain
implementation so we can't test that, but the attached test tests when
the type index is 64.

Diff Detail

Event Timeline

aheejin created this revision.Mar 30 2021, 4:11 PM
aheejin requested review of this revision.Mar 30 2021, 4:11 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 30 2021, 4:11 PM
dschuff accepted this revision.Mar 30 2021, 4:13 PM
This revision is now accepted and ready to land.Mar 30 2021, 4:13 PM
This revision was landed with ongoing or failed builds.Mar 30 2021, 4:22 PM
This revision was automatically updated to reflect the committed changes.

Man, these kind of bug are so common, and so hard to test and occur across so many different tools.. I wonder if we would have made a different choice if we have known how many issues LEB128 would cause.

aheejin added a comment.EditedMar 31 2021, 2:51 AM

Yes that's unfortunate... By the way the title should have been "decoding", not "encoding".