Closed Bug 1342893 Opened 7 years ago Closed 7 years ago

wasm: Add signatures for function imports/exports in wasmTestMode

Categories

(Core :: JavaScript Engine: JIT, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla54
Tracking Status
firefox54 --- fixed

People

(Reporter: bbouvier, Assigned: bbouvier)

Details

Attachments

(1 file)

Attached patch exportsigs.patchSplinter Review
Christian: with this patch, you'll be able to get the signatures of wasm function exports and imports, in wasm test mode:


setJitCompilerOption('wasm.test-mode', 1);

const module = new WebAssembly.Module(...);

for (let desc of WebAssembly.Module.imports) {
  if (desc.kind === 'function') {
    print(desc.signature);
  }
}


The string format for the signature is "(arg_type1, ..., arg_typeN) -> (ret_type)". Note the parens around the ret_type, since in the future there might be more than once.
Attachment #8841508 - Flags: review?(luke)
Comment on attachment 8841508 [details] [diff] [review]
exportsigs.patch

Review of attachment 8841508 [details] [diff] [review]:
-----------------------------------------------------------------

Nice!

::: js/src/wasm/WasmJS.cpp
@@ +622,5 @@
> +        first = false;
> +    }
> +
> +    // Alternatively, print "void" if there were no arguments.
> +    if (!sig.args().length() && !buf.append("void", strlen("void")))

I'm guessing this is for symmetry with the return type?  Since the return type will be generalized to be a list (with void = []), could you instead use "()" to mean void and change the return type to match?
Attachment #8841508 - Flags: review?(luke) → review+
Pushed by bbouvier@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/8e98edd1c6d4
Add signatures for function imports and exports in wasmTestMode; r=luke
https://hg.mozilla.org/mozilla-central/rev/8e98edd1c6d4
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla54
You need to log in before you can comment on or make changes to this bug.