Skip to content
This repository was archived by the owner on Apr 25, 2025. It is now read-only.

Rethrow after access to the exnref parameters #106

Closed
Horcrux7 opened this issue Apr 12, 2020 · 2 comments
Closed

Rethrow after access to the exnref parameters #106

Horcrux7 opened this issue Apr 12, 2020 · 2 comments

Comments

@Horcrux7
Copy link

Is there a simple solution to rethrow an exception after access to the parameters of the exnref?

Currently the only solution seems to be:

  • save the exception in a local variable
  • push the exception on the stack
  • pushes the exception's argument values on top of the stack with br_on_exn
  • inspect the arguments
  • rethrow depending the inspection result

Sounds not very efficient. I am also not clear if a rethrow is possible after a br_on_exn.

Background: I am working on a compiler for Java (JWebAssembly). The exception there are hierarchical. That I can not use the plain exception type of this spec. I use only one event type. In the parameters of exnref there are the hierarchical exception details.

@aheejin
Copy link
Member

aheejin commented Apr 14, 2020

rethrow is possible after br_on_exn. And I think you're right that you need to save exnref (pushed onto the stack by catch) to a local to rethrow it again. This is not a problem specific to exnref; wasm is a stack machine, and if you want to use a value on top of the stack (pushed by any instruction) twice, you need to save it to a local, for any instruction.

@Horcrux7
Copy link
Author

Thanks.

ioannad pushed a commit to ioannad/exception-handling that referenced this issue Jun 6, 2020
Also clean up some `table.copy` text.

* WIP on fixes; checkpoint to avoid working over ssh
* Address comments and other fixes
* Add missing `if n=0` case to `memory.fill` and `memory.init`
* Move `n=0` case to the top in `memory.fill`
* Use `\vconst` to ensure constants are well-formed
* Use 3 spaces instead of 4 in `memory.copy` and `table.copy` to prevent
  double-spaced numeric list
* Add `_t` subscript to '`\vconst`
* Add cnt=1 case
* Make prose match formal
ioannad pushed a commit to ioannad/exception-handling that referenced this issue Feb 23, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants