Skip to content

Commit

Permalink
Bug 1638446 - Change wasm start function to not pre-declare a valid r…
Browse files Browse the repository at this point in the history
…ef.func index. r=lth

This was omitted from the original upstream spec-tests that changed validation to treat
the whole module environment as pre-declaring ref.func indices, and added after our
commit landed.

Differential Revision: https://phabricator.services.mozilla.com/D75989
  • Loading branch information
eqrion committed May 21, 2020
1 parent 0e99db9 commit 26564e4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 2 additions & 2 deletions js/src/jit-test/tests/wasm/gc/ref-func.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ assertEq(validFuncRefText('(global funcref (ref.func $referenced))', 'anyref') i
// reference function can be forward declared via export
assertEq(validFuncRefText('(export "referenced" (func $referenced))', 'anyref') instanceof WebAssembly.Instance, true);

// reference function can be forward declared via start
assertEq(validFuncRefText('(start $referenced)', 'anyref') instanceof WebAssembly.Instance, true);
// reference function cannot be forward declared via start
assertErrorMessage(() => validFuncRefText('(start $referenced)', 'anyref'), WebAssembly.CompileError, /function index is not declared in a section before the code section/);

// Tests not expressible in the text format.

Expand Down
2 changes: 0 additions & 2 deletions js/src/wasm/WasmValidate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2563,8 +2563,6 @@ static bool DecodeStartSection(Decoder& d, ModuleEnvironment* env) {
return d.fail("unknown start function");
}

env->validForRefFunc.setBit(funcIndex);

const FuncType& funcType = *env->funcTypes[funcIndex];
if (funcType.results().length() > 0) {
return d.fail("start function must not return anything");
Expand Down

0 comments on commit 26564e4

Please sign in to comment.