Conversation
Added link to V8 design portfolio for stack switching
Also tightened up language obout requiring traps when promise/suspending not correctly lined up.
Some of the changes that follow from reviewer's remarks. Co-authored-by: Shu-yu Guo <syg@chromium.org>
Make it clear that a 'long jump' in the meta-interpreter is being affected.
Updated test suite for jspi to reflect new API
Implementation notes
Merge remote-tracking branch 'spec/wasm-3.0'
Fix JSPI tests
Some minor tweaks in response to reviewer's remarks.
Co-authored-by: Shu-yu Guo <syg@chromium.org>
Co-authored-by: Shu-yu Guo <syg@chromium.org>
Co-authored-by: Shu-yu Guo <syg@chromium.org>
use 'marker' suffix to better distinguish Suspending objects from functions
Small changes, responding to remarks by reviewer.
Small tweak: Add an explanation for the role of the map Big tweak: Arrange to throw a JS RuntimeError rather than trap when JSPI usage not properly balanced.
Tidy up punctuation.
Clean up throwing exceptions from JS (a little bit)
Draft of spec for jspi
Use the new standard exception type SuspendError if a problem arises with trying to suspend.
Add SuspendError
Co-authored-by: Francis McCabe <fmccabe@gmail.com>
eqrion
left a comment
There was a problem hiding this comment.
This is a tricky one, and I'm still learning the spec interactions for WHATWG/TC39 so forgive me if I messed some of these comments up. I'd like to take another look at this.
| .. |WasmDraft| replace:: |pagelink| | ||
| .. _WasmDraft: |pagelink| | ||
| .. |WasmDraft| replace:: https://webassembly.github.io/js-promise-integration/core/ | ||
| .. _WasmDraft: https://webassembly.github.io/js-promise-integration/core/ | ||
|
|
||
| .. |WasmIssues| replace:: |issuelink| | ||
| .. _WasmIssues: |issuelink| | ||
| .. |WasmIssues| replace:: https://github.com/webassembly/js-promise-integration/issues/ | ||
| .. _WasmIssues: https://github.com/webassembly/js-promise-integration/issues/ | ||
|
|
||
| .. |IEEE754| replace:: IEEE 754 | ||
| .. |IEEE754| replace:: IEEE 754-2019 | ||
| .. _IEEE754: https://ieeexplore.ieee.org/document/8766229 |
There was a problem hiding this comment.
I think we want to revert these changes.
|
|
||
| .. only:: html | ||
|
|
||
| | Release |release| |
|  | ||
|  | ||
|  | ||
| [](https://travis-ci.org/WebAssembly/js-promise-integration) |
There was a problem hiding this comment.
This looks like an accidental removal?
| text: evaluation_suspend; url: appendix/embedding.html#embed-evaluation-suspend | ||
| text: evaluation_resume; url: appendix/embedding.html#embed-evaluation-resume |
There was a problem hiding this comment.
These are broken links. Did you intend to use them?
| 1. Set the [=surrounding agent=]'s [=associated store=] to |store|. | ||
| 1. If |result| is [=error=], throw a WebAssembly {{RuntimeError}} exception, unless otherwise indicated by <a href="#errors">the WebAssembly error mapping</a>. | ||
| 1. Otherwise, if |result| is of the form [=throw=] exnaddr, | ||
| 1. [=Reject=] |promise| with |result|. |
There was a problem hiding this comment.
|result| here is a throw exnaddr abstract value, and we're rejecting a promise with it. I think we need to convert the exnaddr into a JS value first.
| 1. Otherwise, return the result of performing [=coerce a JavaScript return=] on |resultTypes| and |awaitResult|. | ||
| 1. Otherwise, return the result of performing [=coerce a JavaScript return=] on |resultTypes| and |ret|. |
There was a problem hiding this comment.
Both of these pass args in the reverse order the op expects.
| 1. If [$IsCallable$](|wasmFunc|) is false, throw a {{TypeError}}. | ||
| 1. If |wasmFunc| does not have a \[[FunctionAddress]] internal slot, throw a {{TypeError}}. | ||
| 1. Let |builder| be a new [=AbstractClosure=] with no parameters that captures |wasmFunc| and performs [=run a Promising function=] when called. | ||
| 1. Returns the result of [=CreateBuiltinFunction=](|builder|,1,"", « »). |
There was a problem hiding this comment.
| 1. Returns the result of [=CreateBuiltinFunction=](|builder|,1,"", « »). | |
| 1. Return the result of [=CreateBuiltinFunction=](|builder|,1,"", « »). |
| 1. Let |suspendingProto| be \[[%WebAssembly.Suspending.prototype%]]. | ||
| 1. Let |susp| be the result of [$OrdinaryObjectCreate$](|suspendingProto|,«\[[WrappedFunction]]»). | ||
| 1. Set |susp|.\[[WrappedFunction]] to |jsFun|. | ||
| 1. Return |susp|. |
There was a problem hiding this comment.
WebIDL will automatically create an object for us that is wired up with the correct prototype (and other slots such as the internal platform object brand). The other WebIDL constructors in this spec just initialize the slots on the this object.
| 1. Let [|parameters|] → [|results|] be |functype|. | ||
| 1. If any type in |parameters| or |results| [=matches/valtype|matches=] [=v128=] or [=exnref=], throw a {{TypeError}}. | ||
|
|
||
| 1. If |parameters| or |results| contain [=v128=] or [=exnref=], throw a {{TypeError}}. | ||
| Note: the above error is thrown each time the \[[Call]] method is invoked. |
There was a problem hiding this comment.
Did you mean to delete this?
PR that represents merging of JSPI into main spec.