ewasm / design

Ewasm Design Overview and Specification
Apache License 2.0
1.02k stars 125 forks source link

EEI: change revert, return and selfdestruct to cause a trap #87

Closed axic closed 6 years ago

axic commented 6 years ago

Fixes #72. Fixes #86.

chfast commented 6 years ago

PoC of finish() implementation in JavaScript: https://webassembly.studio/?f=t7qzdo96re.

axic commented 6 years ago

Yep, it definitely is possible in the Javascript API and with Binaryen. I think it should be possible with wasmi, but not sure about wabt and WAVM.

Since the POSIX exit is usually implemented using the same technique and most of the Wasm VMs support it, I believe there should be no blocker for this change.

axic commented 6 years ago

@gballet how about Wagon?

Update: @gballet responded that it is a possible in Wagon, but it isn't idiomatic.

poemm commented 6 years ago

It looks like wabt can handle a trap in a host function, see here https://github.com/WebAssembly/wabt/blob/d23c99d036ab31f7de21bc4a90b651c4cfd4a356/src/interp.cc#L1428 .

axic commented 6 years ago

@poemm prototyped this and handling it is possible in wabt.

axic commented 6 years ago

Given, useGas does the same and there was agreement last time that following the wasm spec a VM must make this possible, lets merge this.