-
Notifications
You must be signed in to change notification settings - Fork 3
Conversation
We do not use the tags in any translation yet.
That one is not a case class, and therefore does not depend on plenty of things from the scalalib that we do not support yet.
Because the latest nightly of Node.js does not support the latest specification for Wasm exceptions yet.
Including adding all the missing instructions and types for the latest specification of exception handling.
Currently, it does not correctly handle `Labeled/Return` pairs that cross its boundary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Thank you for updating the EH-spec related stuffs, I didn't know that there was an update on the spec recently WebAssembly/exception-handling#283 😅
IIUC, this implementation is able to catch the exception thrown from JS like
JS throws something else -> Scala.js catches it wrapped in a js.JavaScriptException
https://www.scala-js.org/doc/interoperability/exceptions.html
am I right?
val resultLocals = resultType.map(fctx.addSyntheticLocal(_)) | ||
|
||
fctx.block() { doneLabel => | ||
fctx.block(Types.WasmExnRef) { catchLabel => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(note) If the inner try block throws an uncaught exception, jump to the outside of this block (skipping ref.null exn
)
Can we say the t.block
is always TryCatch
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
try_table
is always a try..catch, yes. We have to implement the finally
behavior manually on top of that.
(That's not uncommon for low-level bytecode formats. The JVM does the same.)
Unfortunately not yet. For that we will need a not-yet-approved addition to the exception handling feature. See WebAssembly/exception-handling#269 Currently all the wrap/unwrap thing does is allow to throw non- |
Gotcha, thanks! |
Unfortunately, we cannot write unit tests for
TryCatch
andTryFinally
yet. The latest Node.js nightly build is still using an old version of v8 that does not support the latest spec for Wasm exception handling. However, it possible to run thesample
from a web browser when it containstry..catch
andtry..finally
.