This is an archive of the discontinued LLVM Phabricator instance.

[WebAssembly] Fix bugs in rethrow depth counting and InstPrinter
ClosedPublic

Authored by aheejin on Oct 29 2018, 8:53 AM.

Details

Summary

EH stack depth is incremented at try and decremented at catch. When
there are more than two catch instructions for a try instruction, we
shouldn't count non-first catches when calculating EH stack depths.

This patch fixes two bugs:

  • CFGStackify: Exclude catch_all in the terminate catch pad when calculating EH pad stack, because when we have multiple catches for a try we should count only the first catch instruction when calculating EH pad stack.
  • InstPrinter: The initial intention was also to exclude non-first catches, but it didn't account nested try-catches, so it failed on this case:
try
  try
  catch
  end
catch    <-- (1)
end

In the example, when we are at the catch (1), the last seen EH
instruction is not try but end_try, violating the wrong assumption.

We don't need these after we switch to the second proposal because there
is gonna be only one catch instruction. But anyway before then these
bugfixes are necessary for keep trunk in working state.

Diff Detail

Repository
rL LLVM

Event Timeline

aheejin created this revision.Oct 29 2018, 8:53 AM

By "Multiple catches for a try" you mean catches with different tags?

dschuff accepted this revision.Nov 1 2018, 3:55 PM
This revision is now accepted and ready to land.Nov 1 2018, 3:55 PM

Yes, try with catches with different tags (which we don't generate currently) or a try with both catch and catch_all (which we generate for terminate lpads). Anyway this is just to keep the trunk working and gonna go away soon ༼ ༎ຶ ෴ ༎ຶ༽

This revision was automatically updated to reflect the committed changes.