Bug 181440

Summary: WebAssembly exported host functions should be reused if present in imports
Product: WebKit Reporter: Daniel Ehrenberg <littledan>
Component: WebAssemblyAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: jfbastien
Priority: P2    
Version: WebKit Local Build   
Hardware: Unspecified   
OS: Unspecified   

Description Daniel Ehrenberg 2018-01-09 10:01:04 PST
According to the WebAssembly JS API specification, if a WebAssembly function is imported and then exported again, the same function object should be exported. This property doesn't seem to hold when I run the test [1] against JSC for host functions--although the function is supposed to be wrapped as a WebAssembly function once, if it is then imported and exported a second time, the same function value should result.

[1] https://github.com/WebAssembly/spec/pull/644
Comment 1 JF Bastien 2018-01-09 14:11:28 PST
This is the same as discussed here:
  https://github.com/WebAssembly/design/issues/920
?

So it's a spec change?
Comment 2 Daniel Ehrenberg 2018-01-09 23:19:44 PST
No, there's no spec change here. This link is just provided to show the tests; the spec is not changing with respect to this property. See the logic in [1] and [2]. SpiderMonkey passes these tests.

[1] https://github.com/WebAssembly/design/blob/master/JS.md#webassemblyinstance-constructor in the logic with the `funcs` list.
[2] https://webassembly.github.io/spec/js-api/index.html#a-new-exported-function step 2