Skip to content

Conversation

@aheejin
Copy link
Member

@aheejin aheejin commented Jan 18, 2021

This updates the interpreter for the EH instructions (modulo delegate)
to match the new spec. Before we had an exnref type so threw a
Literal of exnref type which contained ExceptionPackage. But now
that we don't have exnref anymore, so we add the contents of
ExceptionPackage to WasmException, which is used only for the
ExpressionRunner class hierarchy. exnref and ExceptionPackage will
be removed in a followup CL.

This allows nonzero depths for rethrow for now for testing; we
disallowed that for safety measure, but given that there are no passes
that modifies that field, I think the risk is low.

@aheejin aheejin requested review from kripken and tlively January 18, 2021 13:42
@aheejin
Copy link
Member Author

aheejin commented Jan 18, 2021

Currently the EH spec test fails on wasm-opt -O test due to the missing CFG traversal handling. After #3494 lands it will pass.

WASM_UNREACHABLE("rethrow");
*/
}
Flow visitRethrow(Rethrow* curr) { WASM_UNREACHABLE("unimp"); }
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was moved to RuntimeExpressionRunner, because not rethrow needs an access to the exception stack.

This updates the interpreter for the EH instructions (modulo `delegate`)
to match the new spec. Before we had an `exnref` type so threw a
`Literal` of `exnref` type which contained `ExceptionPackage`. But now
that we don't have `exnref` anymore, so we add the contents of
`ExceptionPackage` to `WasmException`, which is used only for the
`ExpressionRunner` class hierarchy. `exnref` and `ExceptionPackage` will
be removed in a followup CL.

This allows nonzero depths for `rethrow` for now for testing; we
disallowed that for safety measure, but given that there are no passes
that modifies that field, I think the risk is low.
Copy link
Member

@kripken kripken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, the rethrowing adds some complexity, but otherwise this is pretty simple and neat.

}
// This exception is not caught by this try-catch. Rethrow it.
throw;
WASM_UNREACHABLE("try");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this WASM_UNREACHABLE still needed?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess not. Thanks. Removed.

Base automatically changed from master to main January 19, 2021 21:59
@aheejin
Copy link
Member Author

aheejin commented Jan 20, 2021

By the way my latest commit title should be not "Remove the unnecessary throw;" but "Remove the unnecessary WASM_UNREACHABLE" 😂

@aheejin aheejin merged commit 527e9f9 into WebAssembly:main Jan 21, 2021
@aheejin aheejin deleted the eh_interpreter branch January 21, 2021 12:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants