Changeset 246589 in webkit
- Timestamp:
- Jun 19, 2019 8:36:46 AM (5 years ago)
- Location:
- trunk
- Files:
-
- 53 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JSTests/ChangeLog
r246577 r246589 1 2019-06-19 Justin Michaud <justin_michaud@apple.com> 2 3 [WASM-References] Rename anyfunc to funcref 4 https://bugs.webkit.org/show_bug.cgi?id=198983 5 6 Reviewed by Yusuke Suzuki. 7 8 * wasm/function-tests/basic-element.js: 9 * wasm/function-tests/context-switch.js: 10 (import.Builder.from.string_appeared_here.import.as.assert.from.string_appeared_here.makeInstance): 11 (makeInstance): 12 (assert.eq.makeInstance): 13 * wasm/function-tests/exceptions.js: 14 (import.Builder.from.string_appeared_here.import.as.assert.from.string_appeared_here.makeInstance): 15 * wasm/function-tests/grow-memory-2.js: 16 (assert.eq.instance.exports.foo): 17 * wasm/function-tests/nameSection.js: 18 (const.compile): 19 * wasm/function-tests/stack-overflow.js: 20 (import.Builder.from.string_appeared_here.import.as.assert.from.string_appeared_here.makeInstance): 21 (assertOverflows.makeInstance): 22 * wasm/function-tests/table-basic-2.js: 23 (import.Builder.from.string_appeared_here.import.as.assert.from.string_appeared_here.makeInstance): 24 * wasm/function-tests/table-basic.js: 25 (import.Builder.from.string_appeared_here.import.as.assert.from.string_appeared_here.makeInstance): 26 * wasm/function-tests/trap-from-start-async.js: 27 * wasm/function-tests/trap-from-start.js: 28 * wasm/js-api/Module.exports.js: 29 (assert.truthy): 30 * wasm/js-api/Module.imports.js: 31 (assert.truthy): 32 * wasm/js-api/call-indirect.js: 33 (const.oneTable): 34 (const.multiTable): 35 (multiTable.const.makeTable): 36 (multiTable): 37 (multiTable.Polyphic2Import): 38 (multiTable.VirtualImport): 39 * wasm/js-api/element-data.js: 40 * wasm/js-api/element.js: 41 (assert.throws.new.WebAssembly.Module.builder.WebAssembly): 42 (assert.throws): 43 (badInstantiation.makeModule): 44 (badInstantiation.test): 45 (badInstantiation): 46 * wasm/js-api/extension-MemoryMode.js: 47 * wasm/js-api/table.js: 48 (new.WebAssembly.Module): 49 (assert.throws): 50 (assertBadTableImport): 51 (assert.throws.WebAssembly.Table.prototype.grow): 52 (new.WebAssembly.Table): 53 (assertBadTable): 54 (assert.truthy): 55 * wasm/js-api/test_basic_api.js: 56 (const.c.in.constructorProperties.switch): 57 * wasm/js-api/unique-signature.js: 58 (CallIndirectWithDuplicateSignatures): 59 * wasm/js-api/wrapper-function.js: 60 * wasm/modules/table.wat: 61 * wasm/modules/wasm-imports-js-re-exports-wasm-exports/imports.wat: 62 * wasm/modules/wasm-imports-js-re-exports-wasm-exports/sum.wat: 63 * wasm/modules/wasm-imports-wasm-exports/imports.wat: 64 * wasm/modules/wasm-imports-wasm-exports/sum.wat: 65 * wasm/references/anyref_table.js: 66 * wasm/references/anyref_table_import.js: 67 (doSet): 68 (assert.throws): 69 * wasm/references/func_ref.js: 70 (makeFuncrefIdent): 71 (assert.eq.instance.exports.fix): 72 (GetLocal.0.I32Const.0.TableSet.0.End.End.WebAssembly.assert.throws): 73 (GetLocal.0.I32Const.0.TableSet.0.End.End.WebAssembly): 74 (let.importedFun.of): 75 (makeAnyfuncIdent): Deleted. 76 (makeAnyfuncIdent.fun): Deleted. 77 * wasm/references/multitable.js: 78 (assert.eq): 79 (assert.throws): 80 * wasm/references/table_misc.js: 81 (GetLocal.0.TableFill.0.End.End.WebAssembly): 82 * wasm/references/validation.js: 83 (assert.throws.new.WebAssembly.Module.bin): 84 (assert.throws): 85 * wasm/spec-harness/index.js: 86 * wasm/spec-harness/wasm-constants.js: 87 * wasm/spec-harness/wasm-module-builder.js: 88 (WasmModuleBuilder.prototype.toArray): 89 * wasm/spec-harness/wast.js: 90 (elem_type): 91 (string_of_elem_type): 92 (string_of_table_type): 93 * wasm/spec-tests/jsapi.js: 94 * wasm/stress/wasm-table-grow-initialize.js: 95 * wasm/wasm.json: 96 1 97 2019-06-18 Justin Michaud <justin_michaud@apple.com> 2 98 -
trunk/JSTests/wasm/function-tests/basic-element.js
r209785 r246589 3 3 4 4 5 const tableDescription = {initial: 1, element: " anyfunc"};5 const tableDescription = {initial: 1, element: "funcref"}; 6 6 const builder = new Builder() 7 7 .Type().End() -
trunk/JSTests/wasm/function-tests/context-switch.js
r217017 r246589 4 4 { 5 5 function makeInstance() { 6 const tableDescription = {initial: 1, element: " anyfunc"};6 const tableDescription = {initial: 1, element: "funcref"}; 7 7 const builder = new Builder() 8 8 .Type() … … 83 83 { 84 84 function makeInstance() { 85 const tableDescription = {initial: 1, element: " anyfunc"};85 const tableDescription = {initial: 1, element: "funcref"}; 86 86 const builder = new Builder() 87 87 .Type() … … 172 172 { 173 173 function makeInstance() { 174 const tableDescription = {initial: 1, element: " anyfunc"};174 const tableDescription = {initial: 1, element: "funcref"}; 175 175 const builder = new Builder() 176 176 .Type() -
trunk/JSTests/wasm/function-tests/exceptions.js
r210229 r246589 3 3 4 4 function makeInstance() { 5 const tableDescription = {initial: 1, element: " anyfunc"};5 const tableDescription = {initial: 1, element: "funcref"}; 6 6 const builder = new Builder() 7 7 .Type() -
trunk/JSTests/wasm/function-tests/grow-memory-2.js
r210201 r246589 38 38 { 39 39 const memoryDescription = {initial: 0, maximum: 2}; 40 const tableDescription = {initial: 1, maximum: 1, element: " anyfunc"};40 const tableDescription = {initial: 1, maximum: 1, element: "funcref"}; 41 41 const builder = (new Builder()) 42 42 .Type() -
trunk/JSTests/wasm/function-tests/nameSection.js
r225550 r246589 39 39 switch (imp.kind) { 40 40 case "function": importObject[imp.module][imp.name] = () => {}; break; 41 case "table": importObject[imp.module][imp.name] = new WebAssembly.Table({ initial: 6, maximum: 6, element: " anyfunc" }); break;41 case "table": importObject[imp.module][imp.name] = new WebAssembly.Table({ initial: 6, maximum: 6, element: "funcref" }); break; 42 42 case "memory": importObject[imp.module][imp.name] = new WebAssembly.Memory({ initial: 16777216 / (64 * 1024), maximum: 16777216 / (64 * 1024) }); break; 43 43 case "global": importObject[imp.module][imp.name] = 0; break; -
trunk/JSTests/wasm/function-tests/stack-overflow.js
r225550 r246589 4 4 { 5 5 function makeInstance() { 6 const tableDescription = {initial: 1, element: " anyfunc"};6 const tableDescription = {initial: 1, element: "funcref"}; 7 7 const builder = new Builder() 8 8 .Type() … … 58 58 { 59 59 function makeInstance() { 60 const tableDescription = {initial: 1, element: " anyfunc"};60 const tableDescription = {initial: 1, element: "funcref"}; 61 61 const builder = new Builder() 62 62 .Type() -
trunk/JSTests/wasm/function-tests/table-basic-2.js
r209771 r246589 9 9 .End() 10 10 .Import() 11 .Table("imp", "table", {initial: 20, element: " anyfunc"})11 .Table("imp", "table", {initial: 20, element: "funcref"}) 12 12 .Function("imp", "func", { params: ["i32"], ret: "i32" }) 13 13 .End() … … 34 34 const bin = builder.WebAssembly().get(); 35 35 const module = new WebAssembly.Module(bin); 36 const table = new WebAssembly.Table({initial: 20, element: " anyfunc"});36 const table = new WebAssembly.Table({initial: 20, element: "funcref"}); 37 37 return {instance: new WebAssembly.Instance(module, {imp: {table, func}}), table}; 38 38 } -
trunk/JSTests/wasm/function-tests/table-basic.js
r210026 r246589 9 9 .End() 10 10 .Import() 11 .Table("imp", "table", {initial: 20, element: " anyfunc"})11 .Table("imp", "table", {initial: 20, element: "funcref"}) 12 12 .End() 13 13 .Function().End() … … 34 34 const bin = builder.WebAssembly().get(); 35 35 const module = new WebAssembly.Module(bin); 36 const table = new WebAssembly.Table({initial: 20, element: " anyfunc"});36 const table = new WebAssembly.Table({initial: 20, element: "funcref"}); 37 37 return {instance: new WebAssembly.Instance(module, {imp: {table}}), table}; 38 38 } -
trunk/JSTests/wasm/function-tests/trap-from-start-async.js
r223274 r246589 3 3 4 4 const memoryInfo = { initial: 2 }; 5 const tableInfo = { element: " anyfunc", initial: 8 };5 const tableInfo = { element: "funcref", initial: 8 }; 6 6 7 7 async function StartTrapsAsync() { -
trunk/JSTests/wasm/function-tests/trap-from-start.js
r223274 r246589 3 3 4 4 const memoryInfo = { initial: 2 }; 5 const tableInfo = { element: " anyfunc", initial: 8 };5 const tableInfo = { element: "funcref", initial: 8 }; 6 6 7 7 (function StartTraps() { -
trunk/JSTests/wasm/js-api/Module.exports.js
r215664 r246589 18 18 .Function().End() 19 19 .Table() 20 .Table({initial: 20, maximum: 30, element: " anyfunc"})20 .Table({initial: 20, maximum: 30, element: "funcref"}) 21 21 .End() 22 22 .Memory().InitialMaxPages(1, 1).End() -
trunk/JSTests/wasm/js-api/Module.imports.js
r215664 r246589 18 18 .Import() 19 19 .Function("fooFunction", "barFunction", { params: [] }) 20 .Table("fooTable", "barTable", {initial: 20, element: " anyfunc"})20 .Table("fooTable", "barTable", {initial: 20, element: "funcref"}) 21 21 .Memory("fooMemory", "barMemory", {initial: 20}) 22 22 .Global().I32("fooGlobal", "barGlobal", "immutable").End() -
trunk/JSTests/wasm/js-api/call-indirect.js
r246571 r246589 7 7 .Import() 8 8 .Function("imp", "func", { params: ["i32"] }) 9 .Table("imp", "table", { initial: 1, maximum: 1, element: " anyfunc"})9 .Table("imp", "table", { initial: 1, maximum: 1, element: "funcref"}) 10 10 .End() 11 11 .Function().End() … … 37 37 .Import() 38 38 .Function("imp", "func", { params: ["i32"] }) 39 .Table("imp", "table0", { initial: 0, maximum: 0, element: " anyfunc"})40 .Table("imp", "table", { initial: 1, maximum: 1, element: " anyfunc"})39 .Table("imp", "table0", { initial: 0, maximum: 0, element: "funcref"}) 40 .Table("imp", "table", { initial: 1, maximum: 1, element: "funcref"}) 41 41 .End() 42 42 .Function().End() … … 66 66 67 67 const makeTable = () => { 68 return new WebAssembly.Table({initial: 1, maximum: 1, element: " anyfunc"});68 return new WebAssembly.Table({initial: 1, maximum: 1, element: "funcref"}); 69 69 }; 70 70 … … 74 74 const table = makeTable(); 75 75 const module = wasmModuleWhichImportJS(); 76 const instance = new WebAssembly.Instance(module, { imp: { func: counterSetter, table, table0: new WebAssembly.Table({initial: 0, maximum: 0, element: " anyfunc"}) } });76 const instance = new WebAssembly.Instance(module, { imp: { func: counterSetter, table, table0: new WebAssembly.Table({initial: 0, maximum: 0, element: "funcref"}) } }); 77 77 table.set(0, instance.exports.callFunc); 78 78 for (let i = 0; i < 4096; ++i) { … … 91 91 92 92 const tableA = makeTable(); 93 const instanceA = new WebAssembly.Instance(module, { imp: { func: counterASetter, table: tableA, table0: new WebAssembly.Table({initial: 0, maximum: 0, element: " anyfunc"}) } });93 const instanceA = new WebAssembly.Instance(module, { imp: { func: counterASetter, table: tableA, table0: new WebAssembly.Table({initial: 0, maximum: 0, element: "funcref"}) } }); 94 94 tableA.set(0, instanceA.exports.callFunc); 95 95 96 96 const tableB = makeTable(); 97 const instanceB = new WebAssembly.Instance(module, { imp: { func: counterBSetter, table: tableB, table0: new WebAssembly.Table({initial: 0, maximum: 0, element: " anyfunc"}) } });97 const instanceB = new WebAssembly.Instance(module, { imp: { func: counterBSetter, table: tableB, table0: new WebAssembly.Table({initial: 0, maximum: 0, element: "funcref"}) } }); 98 98 tableB.set(0, instanceB.exports.callFunc); 99 99 for (let i = 0; i < 2048; ++i) { … … 127 127 for (let i = 0; i < num; ++i) { 128 128 let table = makeTable(); 129 instances[i] = new WebAssembly.Instance(module, { imp: { func: counterSetters[i], table, table0: new WebAssembly.Table({initial: 0, maximum: 0, element: " anyfunc"}) } });129 instances[i] = new WebAssembly.Instance(module, { imp: { func: counterSetters[i], table, table0: new WebAssembly.Table({initial: 0, maximum: 0, element: "funcref"}) } }); 130 130 table.set(0, instances[i].exports.callFunc); 131 131 } -
trunk/JSTests/wasm/js-api/element-data.js
r210028 r246589 11 11 .Import() 12 12 .Memory("imp", "memory", memoryDescription) 13 .Table("imp", "table", {element: " anyfunc", initial: 19}) // unspecified maximum.13 .Table("imp", "table", {element: "funcref", initial: 19}) // unspecified maximum. 14 14 .End() 15 15 .Function().End() … … 31 31 const module = new WebAssembly.Module(bin); 32 32 const memory = new WebAssembly.Memory(memoryDescription); 33 const table = new WebAssembly.Table({element: " anyfunc", initial: 19});33 const table = new WebAssembly.Table({element: "funcref", initial: 19}); 34 34 const imports = { 35 35 imp: { -
trunk/JSTests/wasm/js-api/element.js
r235420 r246589 28 28 .Function().End() 29 29 .Table() 30 .Table({element: " anyfunc", initial: 20})30 .Table({element: "funcref", initial: 20}) 31 31 .End() 32 32 .Element() … … 51 51 .Function().End() 52 52 .Table() 53 .Table({element: " anyfunc", initial: 20, maximum: 20})53 .Table({element: "funcref", initial: 20, maximum: 20}) 54 54 .End() 55 55 .Element() … … 75 75 .Function().End() 76 76 .Table() 77 .Table({element: " anyfunc", initial: 20, maximum: 20})77 .Table({element: "funcref", initial: 20, maximum: 20}) 78 78 .End() 79 79 .Element() … … 99 99 .Function().End() 100 100 .Table() 101 .Table({element: " anyfunc", initial: 20, maximum: 20})101 .Table({element: "funcref", initial: 20, maximum: 20}) 102 102 .End() 103 103 .Element() … … 122 122 .Type().End() 123 123 .Import() 124 .Table("imp", "table", {element: " anyfunc", initial: 19}) // unspecified maximum.124 .Table("imp", "table", {element: "funcref", initial: 19}) // unspecified maximum. 125 125 .End() 126 126 .Function().End() … … 143 143 144 144 for (let i = 19; i < 19 + 5; i++) { 145 const table = new WebAssembly.Table({element: " anyfunc", initial: i});145 const table = new WebAssembly.Table({element: "funcref", initial: i}); 146 146 badInstantiation(table, WebAssembly.LinkError, "Element is trying to set an out of bounds table index (evaluating 'new WebAssembly.Instance(module, {imp: {table: actualTable}})')"); 147 147 } … … 153 153 .Type().End() 154 154 .Import() 155 .Table("imp", "table", {element: " anyfunc", initial: 19}) // unspecified maximum.155 .Table("imp", "table", {element: "funcref", initial: 19}) // unspecified maximum. 156 156 .Global().I32("imp", "global", "immutable").End() 157 157 .End() … … 174 174 175 175 function test(i) { 176 const table = new WebAssembly.Table({element: " anyfunc", initial: 19});176 const table = new WebAssembly.Table({element: "funcref", initial: 19}); 177 177 const global = i; 178 178 const module = makeModule(); … … 196 196 .Type().End() 197 197 .Import() 198 .Table("imp", "table", {element: " anyfunc", initial: 19}) // unspecified maximum.198 .Table("imp", "table", {element: "funcref", initial: 19}) // unspecified maximum. 199 199 .Global().F32("imp", "global", "immutable").End() 200 200 .End() -
trunk/JSTests/wasm/js-api/extension-MemoryMode.js
r215340 r246589 19 19 assert.throws(() => WebAssemblyMemoryMode({}), TypeError, message); 20 20 assert.throws(() => WebAssemblyMemoryMode(new WebAssembly.Module(emptyModuleArray)), TypeError, message); 21 assert.throws(() => WebAssemblyMemoryMode(new WebAssembly.Table({initial: 1, element: " anyfunc"})), TypeError, message);21 assert.throws(() => WebAssemblyMemoryMode(new WebAssembly.Table({initial: 1, element: "funcref"})), TypeError, message); 22 22 23 23 const validateMode = what => { -
trunk/JSTests/wasm/js-api/table.js
r246571 r246589 6 6 .Type().End() 7 7 .Import() 8 .Table("imp", "table", {initial: 20, element: " anyfunc"})9 .End() 10 .Function().End() 11 .Table() 12 .Table({initial: 20, maximum: 30, element: " anyfunc"})8 .Table("imp", "table", {initial: 20, element: "funcref"}) 9 .End() 10 .Function().End() 11 .Table() 12 .Table({initial: 20, maximum: 30, element: "funcref"}) 13 13 .End() 14 14 .Code() … … 34 34 .Function().End() 35 35 .Table() 36 .Table({initial: 20, maximum: 30, element: " anyfunc"})37 .Table({initial: 20, maximum: 30, element: " anyfunc"})36 .Table({initial: 20, maximum: 30, element: "funcref"}) 37 .Table({initial: 20, maximum: 30, element: "funcref"}) 38 38 .End() 39 39 .Code() … … 63 63 .Function().End() 64 64 .Table() 65 .Table({initial:20, element:" anyfunc"})65 .Table({initial:20, element:"funcref"}) 66 66 .End() 67 67 .Export() … … 82 82 .Function().End() 83 83 .Table() 84 .Table({initial:20, element:" anyfunc"})85 .Table({initial:20, element:" anyfunc"})84 .Table({initial:20, element:"funcref"}) 85 .Table({initial:20, element:"funcref"}) 86 86 .End() 87 87 .Export() … … 117 117 .Function().End() 118 118 .Table() 119 .Table({initial: 20, maximum: 30, element: " anyfunc"})119 .Table({initial: 20, maximum: 30, element: "funcref"}) 120 120 .End() 121 121 .Export() … … 154 154 let badDescriptions = [ 155 155 [{initial: 10, element: "i32"}, 156 "WebAssembly.Module doesn't parse at byte 18: Table type should be anyfuncor anyref, got -1 (evaluating 'new WebAssembly.Module(builder.WebAssembly().get())')",157 "WebAssembly.Module doesn't parse at byte 26: Table type should be anyfuncor anyref, got -1 (evaluating 'new WebAssembly.Module(builder.WebAssembly().get())')"],156 "WebAssembly.Module doesn't parse at byte 18: Table type should be funcref or anyref, got -1 (evaluating 'new WebAssembly.Module(builder.WebAssembly().get())')", 157 "WebAssembly.Module doesn't parse at byte 26: Table type should be funcref or anyref, got -1 (evaluating 'new WebAssembly.Module(builder.WebAssembly().get())')"], 158 158 [{initial: 10, element: "f32"}, 159 "WebAssembly.Module doesn't parse at byte 18: Table type should be anyfuncor anyref, got -3 (evaluating 'new WebAssembly.Module(builder.WebAssembly().get())')",160 "WebAssembly.Module doesn't parse at byte 26: Table type should be anyfuncor anyref, got -3 (evaluating 'new WebAssembly.Module(builder.WebAssembly().get())')"],159 "WebAssembly.Module doesn't parse at byte 18: Table type should be funcref or anyref, got -3 (evaluating 'new WebAssembly.Module(builder.WebAssembly().get())')", 160 "WebAssembly.Module doesn't parse at byte 26: Table type should be funcref or anyref, got -3 (evaluating 'new WebAssembly.Module(builder.WebAssembly().get())')"], 161 161 [{initial: 10, element: "f64"}, 162 "WebAssembly.Module doesn't parse at byte 18: Table type should be anyfuncor anyref, got -4 (evaluating 'new WebAssembly.Module(builder.WebAssembly().get())')",163 "WebAssembly.Module doesn't parse at byte 26: Table type should be anyfuncor anyref, got -4 (evaluating 'new WebAssembly.Module(builder.WebAssembly().get())')"],162 "WebAssembly.Module doesn't parse at byte 18: Table type should be funcref or anyref, got -4 (evaluating 'new WebAssembly.Module(builder.WebAssembly().get())')", 163 "WebAssembly.Module doesn't parse at byte 26: Table type should be funcref or anyref, got -4 (evaluating 'new WebAssembly.Module(builder.WebAssembly().get())')"], 164 164 [{initial: 10, element: "i64"}, 165 "WebAssembly.Module doesn't parse at byte 18: Table type should be anyfuncor anyref, got -2 (evaluating 'new WebAssembly.Module(builder.WebAssembly().get())')",166 "WebAssembly.Module doesn't parse at byte 26: Table type should be anyfuncor anyref, got -2 (evaluating 'new WebAssembly.Module(builder.WebAssembly().get())')"],165 "WebAssembly.Module doesn't parse at byte 18: Table type should be funcref or anyref, got -2 (evaluating 'new WebAssembly.Module(builder.WebAssembly().get())')", 166 "WebAssembly.Module doesn't parse at byte 26: Table type should be funcref or anyref, got -2 (evaluating 'new WebAssembly.Module(builder.WebAssembly().get())')"], 167 167 [{initial: 10, maximum: 20, element: "i32"}, 168 "WebAssembly.Module doesn't parse at byte 18: Table type should be anyfuncor anyref, got -1 (evaluating 'new WebAssembly.Module(builder.WebAssembly().get())')",169 "WebAssembly.Module doesn't parse at byte 26: Table type should be anyfuncor anyref, got -1 (evaluating 'new WebAssembly.Module(builder.WebAssembly().get())')"],168 "WebAssembly.Module doesn't parse at byte 18: Table type should be funcref or anyref, got -1 (evaluating 'new WebAssembly.Module(builder.WebAssembly().get())')", 169 "WebAssembly.Module doesn't parse at byte 26: Table type should be funcref or anyref, got -1 (evaluating 'new WebAssembly.Module(builder.WebAssembly().get())')"], 170 170 [{initial: 10, maximum: 20, element: "f32"}, 171 "WebAssembly.Module doesn't parse at byte 18: Table type should be anyfuncor anyref, got -3 (evaluating 'new WebAssembly.Module(builder.WebAssembly().get())')",172 "WebAssembly.Module doesn't parse at byte 26: Table type should be anyfuncor anyref, got -3 (evaluating 'new WebAssembly.Module(builder.WebAssembly().get())')"],171 "WebAssembly.Module doesn't parse at byte 18: Table type should be funcref or anyref, got -3 (evaluating 'new WebAssembly.Module(builder.WebAssembly().get())')", 172 "WebAssembly.Module doesn't parse at byte 26: Table type should be funcref or anyref, got -3 (evaluating 'new WebAssembly.Module(builder.WebAssembly().get())')"], 173 173 [{initial: 10, maximum: 20, element: "f64"}, 174 "WebAssembly.Module doesn't parse at byte 18: Table type should be anyfuncor anyref, got -4 (evaluating 'new WebAssembly.Module(builder.WebAssembly().get())')",175 "WebAssembly.Module doesn't parse at byte 26: Table type should be anyfuncor anyref, got -4 (evaluating 'new WebAssembly.Module(builder.WebAssembly().get())')"],174 "WebAssembly.Module doesn't parse at byte 18: Table type should be funcref or anyref, got -4 (evaluating 'new WebAssembly.Module(builder.WebAssembly().get())')", 175 "WebAssembly.Module doesn't parse at byte 26: Table type should be funcref or anyref, got -4 (evaluating 'new WebAssembly.Module(builder.WebAssembly().get())')"], 176 176 [{initial: 10, maximum: 20, element: "i64"}, 177 "WebAssembly.Module doesn't parse at byte 18: Table type should be anyfuncor anyref, got -2 (evaluating 'new WebAssembly.Module(builder.WebAssembly().get())')",178 "WebAssembly.Module doesn't parse at byte 26: Table type should be anyfuncor anyref, got -2 (evaluating 'new WebAssembly.Module(builder.WebAssembly().get())')"],179 180 [{initial: 10, maximum: 9, element: " anyfunc"},177 "WebAssembly.Module doesn't parse at byte 18: Table type should be funcref or anyref, got -2 (evaluating 'new WebAssembly.Module(builder.WebAssembly().get())')", 178 "WebAssembly.Module doesn't parse at byte 26: Table type should be funcref or anyref, got -2 (evaluating 'new WebAssembly.Module(builder.WebAssembly().get())')"], 179 180 [{initial: 10, maximum: 9, element: "funcref"}, 181 181 "WebAssembly.Module doesn't parse at byte 21: resizable limits has a initial page count of 10 which is greater than its maximum 9 (evaluating 'new WebAssembly.Module(builder.WebAssembly().get())')", 182 182 "WebAssembly.Module doesn't parse at byte 29: resizable limits has a initial page count of 10 which is greater than its maximum 9 (evaluating 'new WebAssembly.Module(builder.WebAssembly().get())')"], 183 [{initial: 1, maximum: 0, element: " anyfunc"},183 [{initial: 1, maximum: 0, element: "funcref"}, 184 184 "WebAssembly.Module doesn't parse at byte 21: resizable limits has a initial page count of 1 which is greater than its maximum 0 (evaluating 'new WebAssembly.Module(builder.WebAssembly().get())')", 185 185 "WebAssembly.Module doesn't parse at byte 29: resizable limits has a initial page count of 1 which is greater than its maximum 0 (evaluating 'new WebAssembly.Module(builder.WebAssembly().get())')"], 186 [{initial: 2**32 - 1, maximum: 2**32 - 2, element: " anyfunc"},186 [{initial: 2**32 - 1, maximum: 2**32 - 2, element: "funcref"}, 187 187 "WebAssembly.Module doesn't parse at byte 29: resizable limits has a initial page count of 4294967295 which is greater than its maximum 4294967294 (evaluating 'new WebAssembly.Module(builder.WebAssembly().get())')", 188 188 "WebAssembly.Module doesn't parse at byte 37: resizable limits has a initial page count of 4294967295 which is greater than its maximum 4294967294 (evaluating 'new WebAssembly.Module(builder.WebAssembly().get())')"], 189 [{initial: 2**31, element: " anyfunc"},189 [{initial: 2**31, element: "funcref"}, 190 190 "WebAssembly.Module doesn't parse at byte 24: Table's initial page count of 2147483648 is too big, maximum 10000000 (evaluating 'new WebAssembly.Module(builder.WebAssembly().get())')", 191 191 "WebAssembly.Module doesn't parse at byte 32: Table's initial page count of 2147483648 is too big, maximum 10000000 (evaluating 'new WebAssembly.Module(builder.WebAssembly().get())')"], … … 202 202 .Type().End() 203 203 .Import() 204 .Table("imp", "table", {initial: 20, element: " anyfunc"})205 .Table("imp", "table", {initial: 20, element: " anyfunc"})204 .Table("imp", "table", {initial: 20, element: "funcref"}) 205 .Table("imp", "table", {initial: 20, element: "funcref"}) 206 206 .End() 207 207 .Function().End() … … 227 227 228 228 const badTables = [ 229 [{initial: 100, maximum:100, element:" anyfunc"}, new WebAssembly.Table({initial:100, element: "anyfunc"}), "Table import imp:table does not have a 'maximum' but the module requires that it does (evaluating 'new WebAssembly.Instance(module, {imp: {table}})')"],230 [{initial: 100, maximum:100, element:" anyfunc"}, new WebAssembly.Table({initial:100, maximum:101, element: "anyfunc"}), "Imported Table imp:table 'maximum' is larger than the module's expected 'maximum' (evaluating 'new WebAssembly.Instance(module, {imp: {table}})')"],231 [{initial: 100, element:" anyfunc"}, new WebAssembly.Table({initial:10, element: "anyfunc"}), "Table import imp:table provided an 'initial' that is too small (evaluating 'new WebAssembly.Instance(module, {imp: {table}})')"],232 [{initial: 10, element:" anyfunc"}, new WebAssembly.Table({initial:9, element: "anyfunc"}), "Table import imp:table provided an 'initial' that is too small (evaluating 'new WebAssembly.Instance(module, {imp: {table}})')"],229 [{initial: 100, maximum:100, element:"funcref"}, new WebAssembly.Table({initial:100, element: "funcref"}), "Table import imp:table does not have a 'maximum' but the module requires that it does (evaluating 'new WebAssembly.Instance(module, {imp: {table}})')"], 230 [{initial: 100, maximum:100, element:"funcref"}, new WebAssembly.Table({initial:100, maximum:101, element: "funcref"}), "Imported Table imp:table 'maximum' is larger than the module's expected 'maximum' (evaluating 'new WebAssembly.Instance(module, {imp: {table}})')"], 231 [{initial: 100, element:"funcref"}, new WebAssembly.Table({initial:10, element: "funcref"}), "Table import imp:table provided an 'initial' that is too small (evaluating 'new WebAssembly.Instance(module, {imp: {table}})')"], 232 [{initial: 10, element:"funcref"}, new WebAssembly.Table({initial:9, element: "funcref"}), "Table import imp:table provided an 'initial' that is too small (evaluating 'new WebAssembly.Instance(module, {imp: {table}})')"], 233 233 ]; 234 234 for (const [d, t, m] of badTables) { … … 241 241 { 242 242 { 243 const table = new WebAssembly.Table({element: " anyfunc", initial: 20, maximum: 30});243 const table = new WebAssembly.Table({element: "funcref", initial: 20, maximum: 30}); 244 244 assert.eq(20, table.grow(0)); 245 245 assert.eq(20, table.length); … … 249 249 250 250 { 251 const table = new WebAssembly.Table({element: " anyfunc", initial: 20, maximum: 30});251 const table = new WebAssembly.Table({element: "funcref", initial: 20, maximum: 30}); 252 252 assert.eq(20, table.grow(10)); 253 253 assert.eq(30, table.grow(0)); … … 256 256 257 257 { 258 const table = new WebAssembly.Table({element: " anyfunc", initial: 20});258 const table = new WebAssembly.Table({element: "funcref", initial: 20}); 259 259 let called = false; 260 260 table.grow({valueOf() { called = true; return 42; }}); … … 264 264 265 265 { 266 const table = new WebAssembly.Table({element: " anyfunc", initial: 20});266 const table = new WebAssembly.Table({element: "funcref", initial: 20}); 267 267 assert.throws(() => table.get(20), RangeError, "WebAssembly.Table.prototype.get expects an integer less than the length of the table"); 268 268 for (let i = 0; i < 20; i++) … … 271 271 272 272 { 273 const table = new WebAssembly.Table({element: " anyfunc", initial: 20});273 const table = new WebAssembly.Table({element: "funcref", initial: 20}); 274 274 assert.throws(() => table.set(20, null), RangeError, "WebAssembly.Table.prototype.set expects an integer less than the length of the table"); 275 275 for (let i = 0; i < 20; i++) … … 279 279 { 280 280 // This should not throw 281 new WebAssembly.Table({initial: 2**20, maximum: 2**32 - 1, element: " anyfunc"});281 new WebAssembly.Table({initial: 2**20, maximum: 2**32 - 1, element: "funcref"}); 282 282 } 283 283 } … … 289 289 .Type().End() 290 290 .Import() 291 .Table("imp", "table", {initial: 25, element: " anyfunc"})291 .Table("imp", "table", {initial: 25, element: "funcref"}) 292 292 .End() 293 293 .Function().End() … … 307 307 .Type().End() 308 308 .Import() 309 .Table("imp", "table", {initial: 25, element: " anyfunc"})309 .Table("imp", "table", {initial: 25, element: "funcref"}) 310 310 .End() 311 311 .Function().End() … … 317 317 318 318 const module = new WebAssembly.Module(builder.WebAssembly().get()); 319 const table = new WebAssembly.Table({element: " anyfunc", initial: 25});319 const table = new WebAssembly.Table({element: "funcref", initial: 25}); 320 320 const instance = new WebAssembly.Instance(module, {imp: {table}}); 321 321 assert.truthy(table === instance.exports.table); … … 328 328 .Function().End() 329 329 .Table() 330 .Table({initial: 20, maximum: 30, element: " anyfunc"})330 .Table({initial: 20, maximum: 30, element: "funcref"}) 331 331 .End() 332 332 .Export() … … 348 348 .Function().End() 349 349 .Table() 350 .Table({initial: 0, maximum: 1, element: " anyfunc"})351 .Table({initial: 20, maximum: 30, element: " anyfunc"})350 .Table({initial: 0, maximum: 1, element: "funcref"}) 351 .Table({initial: 20, maximum: 30, element: "funcref"}) 352 352 .End() 353 353 .Export() -
trunk/JSTests/wasm/js-api/test_basic_api.js
r235420 r246589 94 94 break; 95 95 case "Table": 96 new WebAssembly.Table({initial: 20, element: " anyfunc"});97 new WebAssembly.Table({initial: 20, maximum: 20, element: " anyfunc"});98 new WebAssembly.Table({initial: 20, maximum: 25, element: " anyfunc"});96 new WebAssembly.Table({initial: 20, element: "funcref"}); 97 new WebAssembly.Table({initial: 20, maximum: 20, element: "funcref"}); 98 new WebAssembly.Table({initial: 20, maximum: 25, element: "funcref"}); 99 99 break; 100 100 case "CompileError": -
trunk/JSTests/wasm/js-api/unique-signature.js
r210026 r246589 17 17 .Function().End() 18 18 .Table() 19 .Table({initial: 4, maximum: 4, element: " anyfunc"})19 .Table({initial: 4, maximum: 4, element: "funcref"}) 20 20 .End() 21 21 .Export() -
trunk/JSTests/wasm/js-api/wrapper-function.js
r223274 r246589 57 57 58 58 { 59 const tableDescription = {element: " anyfunc", initial: 2};59 const tableDescription = {element: "funcref", initial: 2}; 60 60 function makeInstance(type, imp) { 61 61 const builder = new Builder() -
trunk/JSTests/wasm/modules/table.wat
r230759 r246589 1 1 (module 2 (table $table (export "table") 3 anyfunc)2 (table $table (export "table") 3 funcref) 3 3 (func $f0 (result i32) i32.const 42) 4 4 (func $f1 (result i32) i32.const 83) -
trunk/JSTests/wasm/modules/wasm-imports-js-re-exports-wasm-exports/imports.wat
r230768 r246589 2 2 (import "./re-export.js" "sum" (func $sum (param i32 i32) (result i32))) 3 3 (import "./re-export.js" "answer" (global i32)) 4 (import "./re-export.js" "table" (table $table 4 anyfunc))4 (import "./re-export.js" "table" (table $table 4 funcref)) 5 5 (export "table" (table $table)) 6 6 (type $t0 (func (param i32) (result i32))) -
trunk/JSTests/wasm/modules/wasm-imports-js-re-exports-wasm-exports/sum.wat
r230768 r246589 6 6 i32.add) 7 7 (global (export "answer") i32 i32.const 42) 8 (table $table (export "table") 4 anyfunc)8 (table $table (export "table") 4 funcref) 9 9 (elem (i32.const 0) $sum)) -
trunk/JSTests/wasm/modules/wasm-imports-wasm-exports/imports.wat
r230768 r246589 6 6 (import "./sum.wasm" "answer3" (global f32)) 7 7 (import "./sum.wasm" "answer4" (global f64)) 8 (import "./sum.wasm" "table" (table $table 4 anyfunc))8 (import "./sum.wasm" "table" (table $table 4 funcref)) 9 9 (type $t0 (func (param i32) (result i32))) 10 10 (func $addOne (export "addOne") (type $t0) (param $p0 i32) (result i32) -
trunk/JSTests/wasm/modules/wasm-imports-wasm-exports/sum.wat
r230768 r246589 1 1 (module 2 (table $table (export "table") 4 anyfunc)2 (table $table (export "table") 4 funcref) 3 3 (type $t0 (func (param i32 i32) (result i32))) 4 4 (func $sum (export "sum") (type $t0) (param $p0 i32) (param $p1 i32) (result i32) -
trunk/JSTests/wasm/references/anyref_table.js
r246571 r246589 74 74 .I32Const(42) 75 75 .End() 76 .End().WebAssembly().get())), Error, "WebAssembly.Module doesn't parse at byte 30: Table 0 must have type ' anyfunc' to have an element section (evaluating 'new WebAssembly.Module')")76 .End().WebAssembly().get())), Error, "WebAssembly.Module doesn't parse at byte 30: Table 0 must have type 'funcref' to have an element section (evaluating 'new WebAssembly.Module')") 77 77 78 78 function doGCSet() { -
trunk/JSTests/wasm/references/anyref_table_import.js
r246571 r246589 211 211 212 212 { 213 const tbl = new WebAssembly.Table({initial:2, element:" anyfunc"});213 const tbl = new WebAssembly.Table({initial:2, element:"funcref"}); 214 214 215 215 const mod = new WebAssembly.Module((new Builder()) … … 226 226 assert.throws(() => new WebAssembly.Instance(mod, { imp: { tbl }}), Error, "Table import imp:tbl provided a 'type' that is wrong (evaluating 'new WebAssembly.Instance(mod, { imp: { tbl }})')"); 227 227 } 228 229 { 230 const tbl = new WebAssembly.Table({initial:2, element:"funcref"}); 231 232 const mod = new WebAssembly.Module((new Builder()) 233 .Type().End() 234 .Import() 235 .Table("imp", "tbl", {initial: 2, element: "anyref"}) 236 .End() 237 .Function().End() 238 .Export() 239 .End() 240 .Code() 241 .End().WebAssembly().get()) 242 243 assert.throws(() => new WebAssembly.Instance(mod, { imp: { tbl }}), Error, "Table import imp:tbl provided a 'type' that is wrong (evaluating 'new WebAssembly.Instance(mod, { imp: { tbl }})')"); 244 } -
trunk/JSTests/wasm/references/func_ref.js
r246571 r246589 45 45 } 46 46 47 function make AnyfuncIdent() {47 function makeFuncrefIdent() { 48 48 const builder = (new Builder()) 49 49 .Type().End() … … 53 53 .End() 54 54 .Code() 55 .Function("h", { params: [" anyfunc"], ret: "anyfunc" }, [])55 .Function("h", { params: ["funcref"], ret: "funcref" }, []) 56 56 .GetLocal(0) 57 57 .End() … … 83 83 .End() 84 84 .Code() 85 .Function("h", { params: [" anyfunc"], ret: "anyref" }, ["anyref"])85 .Function("h", { params: ["funcref"], ret: "anyref" }, ["anyref"]) 86 86 .GetLocal(0) 87 87 .SetLocal(1) … … 89 89 .End() 90 90 91 .Function("i", { params: [" anyfunc"], ret: "anyfunc" }, ["anyfunc"])91 .Function("i", { params: ["funcref"], ret: "funcref" }, ["funcref"]) 92 92 .GetLocal(0) 93 93 .SetLocal(1) … … 95 95 .End() 96 96 97 .Function("get_h", { params: [], ret: " anyfunc" }, ["anyfunc"])97 .Function("get_h", { params: [], ret: "funcref" }, ["funcref"]) 98 98 .I32Const(0) 99 99 .RefFunc(0) 100 100 .SetLocal(0) 101 .If(" anyfunc")102 .Block(" anyfunc", (b) =>101 .If("funcref") 102 .Block("funcref", (b) => 103 103 b.GetLocal(0) 104 104 ) 105 105 .Else() 106 .Block(" anyfunc", (b) =>106 .Block("funcref", (b) => 107 107 b.GetLocal(0) 108 108 ) … … 110 110 .End() 111 111 112 .Function("fix", { params: [], ret: " anyfunc" }, [])112 .Function("fix", { params: [], ret: "funcref" }, []) 113 113 .RefFunc(3) 114 114 .End() 115 115 116 .Function("get_not_exported", { params: [], ret: " anyfunc" }, [])116 .Function("get_not_exported", { params: [], ret: "funcref" }, []) 117 117 .RefFunc(5) 118 118 .End() … … 122 122 .End() 123 123 124 .Function("local_read", { params: [], ret: "i32" }, [" anyfunc"])124 .Function("local_read", { params: [], ret: "i32" }, ["funcref"]) 125 125 .GetLocal(0) 126 126 .RefIsNull() … … 136 136 assert.eq(instance.exports.h(null), null) 137 137 138 assert.throws(() => instance.exports.h(fun), Error, " Anyfuncmust be an exported wasm function (evaluating 'func(...args)')")138 assert.throws(() => instance.exports.h(fun), Error, "Funcref must be an exported wasm function (evaluating 'func(...args)')") 139 139 assert.eq(instance.exports.h(myfun), myfun) 140 assert.throws(() => instance.exports.h(5), Error, " Anyfuncmust be an exported wasm function (evaluating 'func(...args)')")141 assert.throws(() => instance.exports.h(undefined), Error, " Anyfuncmust be an exported wasm function (evaluating 'func(...args)')")140 assert.throws(() => instance.exports.h(5), Error, "Funcref must be an exported wasm function (evaluating 'func(...args)')") 141 assert.throws(() => instance.exports.h(undefined), Error, "Funcref must be an exported wasm function (evaluating 'func(...args)')") 142 142 143 143 assert.eq(instance.exports.i(null), null) 144 144 assert.eq(instance.exports.i(myfun), myfun) 145 assert.throws(() => instance.exports.i(fun), Error, " Anyfuncmust be an exported wasm function (evaluating 'func(...args)')")146 assert.throws(() => instance.exports.i(5), Error, " Anyfuncmust be an exported wasm function (evaluating 'func(...args)')")147 148 assert.throws(() => instance.exports.get_h()(fun), Error, " Anyfuncmust be an exported wasm function (evaluating 'func(...args)')")145 assert.throws(() => instance.exports.i(fun), Error, "Funcref must be an exported wasm function (evaluating 'func(...args)')") 146 assert.throws(() => instance.exports.i(5), Error, "Funcref must be an exported wasm function (evaluating 'func(...args)')") 147 148 assert.throws(() => instance.exports.get_h()(fun), Error, "Funcref must be an exported wasm function (evaluating 'func(...args)')") 149 149 assert.eq(instance.exports.get_h()(null), null) 150 150 assert.eq(instance.exports.get_h()(myfun), myfun) 151 assert.throws(() => instance.exports.get_h()(5), Error, " Anyfuncmust be an exported wasm function (evaluating 'func(...args)')")151 assert.throws(() => instance.exports.get_h()(5), Error, "Funcref must be an exported wasm function (evaluating 'func(...args)')") 152 152 153 153 assert.eq(instance.exports.get_not_exported()(), 42) … … 168 168 .Type().End() 169 169 .Import() 170 .Global(). Anyfunc("imp", "ref", "immutable").End()170 .Global().Funcref("imp", "ref", "immutable").End() 171 171 .End() 172 172 .Function().End() 173 173 .Global() 174 .RefNull(" anyfunc", "mutable")175 .RefNull(" anyfunc", "immutable")176 .GetGlobal(" anyfunc", 0, "mutable")177 .RefFunc(" anyfunc", 2, "immutable")174 .RefNull("funcref", "mutable") 175 .RefNull("funcref", "immutable") 176 .GetGlobal("funcref", 0, "mutable") 177 .RefFunc("funcref", 2, "immutable") 178 178 .End() 179 179 .Export() … … 188 188 .End() 189 189 .Code() 190 .Function("set_glob", { params: [" anyfunc"], ret: "void" })190 .Function("set_glob", { params: ["funcref"], ret: "void" }) 191 191 .GetLocal(0) 192 192 .SetGlobal(1) 193 193 .End() 194 194 195 .Function("get_glob", { params: [], ret: " anyfunc" })195 .Function("get_glob", { params: [], ret: "funcref" }) 196 196 .GetGlobal(1) 197 197 .End() … … 207 207 .End() 208 208 209 .Function("get_import", { params: [], ret: " anyfunc" })209 .Function("get_import", { params: [], ret: "funcref" }) 210 210 .GetGlobal(0) 211 211 .End() … … 224 224 $1.exports.set_glob(myfun); assert.eq($1.exports.get_glob()(), 42); 225 225 226 assert.throws(() => $1.exports.set_glob(fun), Error, " Anyfuncmust be an exported wasm function (evaluating 'func(...args)')")226 assert.throws(() => $1.exports.set_glob(fun), Error, "Funcref must be an exported wasm function (evaluating 'func(...args)')") 227 227 228 228 assert.eq($1.exports.glob_is_null(), 0) … … 234 234 .Type().End() 235 235 .Import() 236 .Global(). Anyfunc("imp", "ref", "immutable").End()236 .Global().Funcref("imp", "ref", "immutable").End() 237 237 .End() 238 238 .Function().End() … … 243 243 .Function().End() 244 244 .Code() 245 .Function("h", { params: [" anyfunc"], ret: "anyref" })245 .Function("h", { params: ["funcref"], ret: "anyref" }) 246 246 .GetLocal(0) 247 247 .End() … … 252 252 .Function().End() 253 253 .Table() 254 .Table({initial: 1, element: " anyfunc"})254 .Table({initial: 1, element: "funcref"}) 255 255 .End() 256 256 .Code() … … 260 260 .TableSet(0) 261 261 .End() 262 .End().WebAssembly().get()), Error, "WebAssembly.Module doesn't validate: table.set value to type I32 expected Anyfunc, in function at index 0 (evaluating 'new WebAssembly.Module')");262 .End().WebAssembly().get()), Error, "WebAssembly.Module doesn't validate: table.set value to type I32 expected Funcref, in function at index 0 (evaluating 'new WebAssembly.Module')"); 263 263 264 264 // Tables … … 269 269 .Table() 270 270 .Table({initial: 0, element: "anyref"}) 271 .Table({initial: 1, element: " anyfunc"})271 .Table({initial: 1, element: "funcref"}) 272 272 .End() 273 273 .Global() 274 .RefNull(" anyfunc", "mutable")274 .RefNull("funcref", "mutable") 275 275 .End() 276 276 .Export() … … 281 281 .End() 282 282 .Code() 283 .Function("set_glob", { params: [" anyfunc"], ret: "void" })283 .Function("set_glob", { params: ["funcref"], ret: "void" }) 284 284 .GetLocal(0) 285 285 .SetGlobal(0) 286 286 .End() 287 287 288 .Function("get_glob", { params: [], ret: " anyfunc" })288 .Function("get_glob", { params: [], ret: "funcref" }) 289 289 .GetGlobal(0) 290 290 .End() … … 315 315 $1.exports.set_glob(ident); assert.eq($1.exports.get_glob(), ident); assert.eq($1.exports.call_glob(42), 42) 316 316 317 assert.throws(() => $1.exports.set_glob(fun), Error, " Anyfuncmust be an exported wasm function (evaluating 'func(...args)')")317 assert.throws(() => $1.exports.set_glob(fun), Error, "Funcref must be an exported wasm function (evaluating 'func(...args)')") 318 318 $1.exports.set_glob(myfun); assert.eq($1.exports.get_glob(), myfun); assert.throws(() => $1.exports.call_glob(42), Error, "call_indirect to a signature that does not match (evaluating 'func(...args)')") 319 319 320 320 for (let i=0; i<1000; ++i) { 321 assert.throws(() => $1.exports.set_glob(function() {}), Error, " Anyfuncmust be an exported wasm function (evaluating 'func(...args)')");321 assert.throws(() => $1.exports.set_glob(function() {}), Error, "Funcref must be an exported wasm function (evaluating 'func(...args)')"); 322 322 } 323 323 } … … 331 331 .Table() 332 332 .Table({initial: 0, element: "anyref"}) 333 .Table({initial: 1, element: " anyfunc"})333 .Table({initial: 1, element: "funcref"}) 334 334 .End() 335 335 .Export() … … 338 338 .End() 339 339 .Code() 340 .Function("set", { params: [" anyfunc"], ret: "void" })340 .Function("set", { params: ["funcref"], ret: "void" }) 341 341 .I32Const(0) 342 342 .GetLocal(0) … … 344 344 .End() 345 345 346 .Function("get", { params: [], ret: " anyfunc" })346 .Function("get", { params: [], ret: "funcref" }) 347 347 .I32Const(0) 348 348 .TableGet(1) … … 377 377 // Wasm->JS Calls 378 378 379 for (let importedFun of [function(i) { return i; }, make AnyfuncIdent()]) {379 for (let importedFun of [function(i) { return i; }, makeFuncrefIdent()]) { 380 380 const $1 = new WebAssembly.Instance(new WebAssembly.Module((new Builder()) 381 381 .Type().End() 382 382 .Import() 383 .Function("imp", "h", { params: [" anyfunc"], ret: "anyfunc" })383 .Function("imp", "h", { params: ["funcref"], ret: "funcref" }) 384 384 .End() 385 385 .Function().End() 386 386 .Table() 387 .Table({initial: 1, element: " anyfunc"})387 .Table({initial: 1, element: "funcref"}) 388 388 .End() 389 389 .Export() … … 394 394 .End() 395 395 .Code() 396 .Function("test1", { params: [" anyfunc"], ret: "anyfunc" })396 .Function("test1", { params: ["funcref"], ret: "funcref" }) 397 397 .GetLocal(0) 398 398 .Call(0) 399 399 .End() 400 400 401 .Function("test2", { params: [], ret: " anyfunc" })401 .Function("test2", { params: [], ret: "funcref" }) 402 402 .RefFunc(1) 403 403 .Call(0) 404 404 .End() 405 405 406 .Function("test3", { params: [" anyfunc"], ret: "anyfunc" })406 .Function("test3", { params: ["funcref"], ret: "funcref" }) 407 407 .GetLocal(0) 408 408 .I32Const(0) … … 413 413 .End() 414 414 415 .Function("test4", { params: [], ret: " anyfunc" })415 .Function("test4", { params: [], ret: "funcref" }) 416 416 .RefFunc(1) 417 417 .I32Const(0) … … 431 431 assert.eq(test(myfun), myfun) 432 432 assert.eq(test(myfun)(), 1337) 433 assert.throws(() => test(fun), Error, " Anyfuncmust be an exported wasm function (evaluating 'func(...args)')")433 assert.throws(() => test(fun), Error, "Funcref must be an exported wasm function (evaluating 'func(...args)')") 434 434 435 435 for (let i=0; i<1000; ++i) { 436 assert.throws(() => test(fun), Error, " Anyfuncmust be an exported wasm function (evaluating 'func(...args)')")436 assert.throws(() => test(fun), Error, "Funcref must be an exported wasm function (evaluating 'func(...args)')") 437 437 } 438 438 } … … 441 441 assert.eq(test(), $1.exports.test1) 442 442 assert.eq(test()(myfun), myfun) 443 assert.throws(() => test()(fun), Error, " Anyfuncmust be an exported wasm function (evaluating 'func(...args)')")443 assert.throws(() => test()(fun), Error, "Funcref must be an exported wasm function (evaluating 'func(...args)')") 444 444 445 445 for (let i=0; i<1000; ++i) { 446 assert.throws(() => test()(fun), Error, " Anyfuncmust be an exported wasm function (evaluating 'func(...args)')")446 assert.throws(() => test()(fun), Error, "Funcref must be an exported wasm function (evaluating 'func(...args)')") 447 447 } 448 448 } -
trunk/JSTests/wasm/references/multitable.js
r246571 r246589 172 172 .Function().End() 173 173 .Table() 174 .Table({initial: 3, maximum: 30, element: " anyfunc"})175 .Table({initial: 2, maximum: 30, element: " anyfunc"})174 .Table({initial: 3, maximum: 30, element: "funcref"}) 175 .Table({initial: 2, maximum: 30, element: "funcref"}) 176 176 .End() 177 177 .Export() … … 221 221 .Function().End() 222 222 .Table() 223 .Table({initial: 3, maximum: 30, element: " anyfunc"})224 .Table({initial: 2, maximum: 30, element: " anyfunc"})223 .Table({initial: 3, maximum: 30, element: "funcref"}) 224 .Table({initial: 2, maximum: 30, element: "funcref"}) 225 225 .End() 226 226 .Export() … … 273 273 .Function().End() 274 274 .Table() 275 .Table({initial: 3, maximum: 3, element: " anyfunc"})276 .Table({initial: 2, maximum: 2, element: " anyfunc"})275 .Table({initial: 3, maximum: 3, element: "funcref"}) 276 .Table({initial: 2, maximum: 2, element: "funcref"}) 277 277 .End() 278 278 .Element() … … 292 292 .Table() 293 293 .Table({initial: 3, maximum: 3, element: "anyref"}) 294 .Table({initial: 2, maximum: 3, element: " anyfunc"})294 .Table({initial: 2, maximum: 3, element: "funcref"}) 295 295 .End() 296 296 .Element() … … 303 303 .I32Const(42) 304 304 .End() 305 .End().WebAssembly().get())), Error, "WebAssembly.Module doesn't parse at byte 40: Table 0 must have type ' anyfunc' to have an element section (evaluating 'new WebAssembly.Module')")306 307 assert.throws(() => new WebAssembly.Instance(new WebAssembly.Module((new Builder()) 308 .Type().End() 309 .Function().End() 310 .Table() 311 .Table({initial: 3, maximum: 3, element: "anyref"}) 312 .Table({initial: 2, maximum: 3, element: " anyfunc"})305 .End().WebAssembly().get())), Error, "WebAssembly.Module doesn't parse at byte 40: Table 0 must have type 'funcref' to have an element section (evaluating 'new WebAssembly.Module')") 306 307 assert.throws(() => new WebAssembly.Instance(new WebAssembly.Module((new Builder()) 308 .Type().End() 309 .Function().End() 310 .Table() 311 .Table({initial: 3, maximum: 3, element: "anyref"}) 312 .Table({initial: 2, maximum: 3, element: "funcref"}) 313 313 .End() 314 314 .Code() … … 324 324 .Table() 325 325 .Table({initial: 3, maximum: 3, element: "anyref"}) 326 .Table({initial: 2, maximum: 3, element: " anyfunc"})326 .Table({initial: 2, maximum: 3, element: "funcref"}) 327 327 .End() 328 328 .Code() … … 339 339 .Table() 340 340 .Table({initial: 3, maximum: 3, element: "anyref"}) 341 .Table({initial: 2, maximum: 3, element: " anyfunc"})341 .Table({initial: 2, maximum: 3, element: "funcref"}) 342 342 .End() 343 343 .Code() … … 352 352 .Table() 353 353 .Table({initial: 3, maximum: 3, element: "anyref"}) 354 .Table({initial: 2, maximum: 3, element: " anyfunc"})354 .Table({initial: 2, maximum: 3, element: "funcref"}) 355 355 .End() 356 356 .Code() … … 358 358 .CallIndirect(0,0) 359 359 .End() 360 .End().WebAssembly().get())), Error, "WebAssembly.Module doesn't parse at byte 4: call_indirect is only valid when a table has type anyfunc, in function at index 0 (evaluating 'new WebAssembly.Module')")361 362 assert.throws(() => new WebAssembly.Instance(new WebAssembly.Module((new Builder()) 363 .Type().End() 364 .Function().End() 365 .Table() 366 .Table({initial: 3, maximum: 3, element: "anyref"}) 367 .Table({initial: 2, maximum: 3, element: " anyfunc"})360 .End().WebAssembly().get())), Error, "WebAssembly.Module doesn't parse at byte 4: call_indirect is only valid when a table has type funcref, in function at index 0 (evaluating 'new WebAssembly.Module')") 361 362 assert.throws(() => new WebAssembly.Instance(new WebAssembly.Module((new Builder()) 363 .Type().End() 364 .Function().End() 365 .Table() 366 .Table({initial: 3, maximum: 3, element: "anyref"}) 367 .Table({initial: 2, maximum: 3, element: "funcref"}) 368 368 .End() 369 369 .Code() … … 372 372 .TableGet(0) 373 373 .End() 374 .End().WebAssembly().get())), Error, "WebAssembly.Module doesn't validate: table.get index to type Anyfuncexpected I32, in function at index 0 (evaluating 'new WebAssembly.Module')")375 376 377 assert.throws(() => new WebAssembly.Instance(new WebAssembly.Module((new Builder()) 378 .Type().End() 379 .Function().End() 380 .Table() 381 .Table({initial: 3, maximum: 3, element: "anyref"}) 382 .Table({initial: 2, maximum: 3, element: " anyfunc"})374 .End().WebAssembly().get())), Error, "WebAssembly.Module doesn't validate: table.get index to type Funcref expected I32, in function at index 0 (evaluating 'new WebAssembly.Module')") 375 376 377 assert.throws(() => new WebAssembly.Instance(new WebAssembly.Module((new Builder()) 378 .Type().End() 379 .Function().End() 380 .Table() 381 .Table({initial: 3, maximum: 3, element: "anyref"}) 382 .Table({initial: 2, maximum: 3, element: "funcref"}) 383 383 .End() 384 384 .Code() … … 388 388 .TableSet(0) 389 389 .End() 390 .End().WebAssembly().get())), Error, "WebAssembly.Module doesn't validate: table.set index to type Anyfuncexpected I32, in function at index 0 (evaluating 'new WebAssembly.Module')")391 392 assert.throws(() => new WebAssembly.Instance(new WebAssembly.Module((new Builder()) 393 .Type().End() 394 .Function().End() 395 .Table() 396 .Table({initial: 3, maximum: 3, element: "anyref"}) 397 .Table({initial: 2, maximum: 3, element: " anyfunc"})390 .End().WebAssembly().get())), Error, "WebAssembly.Module doesn't validate: table.set index to type Funcref expected I32, in function at index 0 (evaluating 'new WebAssembly.Module')") 391 392 assert.throws(() => new WebAssembly.Instance(new WebAssembly.Module((new Builder()) 393 .Type().End() 394 .Function().End() 395 .Table() 396 .Table({initial: 3, maximum: 3, element: "anyref"}) 397 .Table({initial: 2, maximum: 3, element: "funcref"}) 398 398 .End() 399 399 .Code() … … 403 403 .TableSet(1) 404 404 .End() 405 .End().WebAssembly().get())), Error, "WebAssembly.Module doesn't validate: table.set value to type Anyref expected Anyfunc, in function at index 0 (evaluating 'new WebAssembly.Module')")405 .End().WebAssembly().get())), Error, "WebAssembly.Module doesn't validate: table.set value to type Anyref expected Funcref, in function at index 0 (evaluating 'new WebAssembly.Module')") 406 406 407 407 function tableInsanity(num, b) { … … 429 429 const $1 = new WebAssembly.Instance(new WebAssembly.Module(tableInsanity(1000000-2, (new Builder()) 430 430 .Type().End()) 431 .Table({initial: 3, maximum: 3, element: " anyfunc"})431 .Table({initial: 3, maximum: 3, element: "funcref"}) 432 432 .Table({initial: 3, maximum: 3, element: "anyref"}) 433 433 .End() -
trunk/JSTests/wasm/references/table_misc.js
r246577 r246589 195 195 .Function().End() 196 196 .Table() 197 .Table({initial: 0, maximum: 0, element: " anyfunc"})198 .Table({initial: 20, maximum: 30, element: " anyfunc"})197 .Table({initial: 0, maximum: 0, element: "funcref"}) 198 .Table({initial: 20, maximum: 30, element: "funcref"}) 199 199 .End() 200 200 .Export() -
trunk/JSTests/wasm/references/validation.js
r246571 r246589 26 26 .Type().End() 27 27 .Import() 28 .Table("imp", "tbl", {initial: 2, element: " anyfunc"})28 .Table("imp", "tbl", {initial: 2, element: "funcref"}) 29 29 .End() 30 30 .Function().End() … … 43 43 bin.trim(); 44 44 45 assert.throws(() => new WebAssembly.Module(bin.get()), WebAssembly.CompileError, "WebAssembly.Module doesn't validate: table.set value to type I32 expected Anyfunc, in function at index 0 (evaluating 'new WebAssembly.Module(bin.get())')");45 assert.throws(() => new WebAssembly.Module(bin.get()), WebAssembly.CompileError, "WebAssembly.Module doesn't validate: table.set value to type I32 expected Funcref, in function at index 0 (evaluating 'new WebAssembly.Module(bin.get())')"); 46 46 } 47 47 … … 50 50 .Type().End() 51 51 .Import() 52 .Table("imp", "tbl", {initial: 2, element: " anyfunc"})52 .Table("imp", "tbl", {initial: 2, element: "funcref"}) 53 53 .End() 54 54 .Function().End() … … 67 67 bin.trim(); 68 68 69 assert.throws(() => new WebAssembly.Module(bin.get()), WebAssembly.CompileError, "WebAssembly.Module doesn't validate: table.set value to type Anyref expected Anyfunc, in function at index 0 (evaluating 'new WebAssembly.Module(bin.get())')");69 assert.throws(() => new WebAssembly.Module(bin.get()), WebAssembly.CompileError, "WebAssembly.Module doesn't validate: table.set value to type Anyref expected Funcref, in function at index 0 (evaluating 'new WebAssembly.Module(bin.get())')"); 70 70 } 71 71 … … 74 74 .Type().End() 75 75 .Import() 76 .Table("imp", "tbl", {initial: 2, element: " anyfunc"})76 .Table("imp", "tbl", {initial: 2, element: "funcref"}) 77 77 .End() 78 78 .Function().End() … … 94 94 95 95 { 96 assert.throws(() => new WebAssembly.Table({initial:2, element:"i32"}), TypeError, "WebAssembly.Table expects its 'element' field to be the string ' anyfunc' or 'anyref'");96 assert.throws(() => new WebAssembly.Table({initial:2, element:"i32"}), TypeError, "WebAssembly.Table expects its 'element' field to be the string 'funcref' or 'anyref'"); 97 97 } -
trunk/JSTests/wasm/spec-harness/index.js
r245496 r246589 83 83 print: print, 84 84 global: 666, 85 table: new WebAssembly.Table({initial: 10, maximum: 20, element: ' anyfunc'}),85 table: new WebAssembly.Table({initial: 10, maximum: 20, element: 'funcref'}), 86 86 memory: new WebAssembly.Memory({initial: 1, maximum: 2}) 87 87 } -
trunk/JSTests/wasm/spec-harness/wasm-constants.js
r218216 r246589 72 72 73 73 let kWasmFunctionTypeForm = 0x60; 74 let kWasm AnyFunctionTypeForm = 0x70;74 let kWasmFuncReftionTypeForm = 0x70; 75 75 76 76 let kResizableMaximumFlag = 1; -
trunk/JSTests/wasm/spec-harness/wasm-module-builder.js
r218216 r246589 322 322 if (has_max) section.emit_u32v(imp.maximum); // maximum 323 323 } else if (imp.kind == kExternalTable) { 324 section.emit_u8(kWasm AnyFunctionTypeForm);324 section.emit_u8(kWasmFuncReftionTypeForm); 325 325 var has_max = (typeof imp.maximum) != "undefined"; 326 326 section.emit_u8(has_max ? 1 : 0); // flags … … 355 355 binary.emit_section(kTableSectionCode, section => { 356 356 section.emit_u8(1); // one table entry 357 section.emit_u8(kWasm AnyFunctionTypeForm);357 section.emit_u8(kWasmFuncReftionTypeForm); 358 358 section.emit_u8(1); 359 359 section.emit_u32v(wasm.function_table_length); -
trunk/JSTests/wasm/spec-harness/wast.js
r214824 r246589 14832 14832 } 14833 14833 else { 14834 return /* AnyFuncType */0;14834 return /* FuncRefType */0; 14835 14835 } 14836 14836 } … … 20707 20707 })]); 20708 20708 case 11 : 20709 return /* ANYFUNC*/0;20709 return /* FUNCREF */0; 20710 20710 case 12 : 20711 20711 return /* MUT */1; … … 25994 25994 }, 25995 25995 function () { 25996 return /* AnyFuncType */0;25996 return /* FuncRefType */0; 25997 25997 }, 25998 25998 function (__caml_parser_env) { … … 27679 27679 /* check */"Y\0\0\0\\\0\xb5\0^\0\xbf\0\xb4\0\x8f\0\xbc\0\xbd\0\xd7\0\x89\0Z\0[\0\xbc\0]\0\xce\0\xca\0\xc4\0^\0X\0\b\x01\xc5\0\xc6\0\\\0\x97\0^\0\x9b\0\xce\0\x9d\0\xd6\0\xd7\0\t\x01\xd1\0\xd2\0\xdf\0\xe0\0\xe1\0i\x01j\x01k\x01+\x01\x01\x01\n\0b\x01c\x012\x011\x01\x8a\x003\x01\t\x015\x01\x8e\0\x04\x01F\0\t\x01<\x01=\x01\xea\0\n\x01\xe6\0\xe7\0N\0\x8a\0\0\0\x9a\0\x9b\0\x8e\0\x9d\x008\x019\x01&\0<\x01=\x01\b\x01\xcb\0\xcc\0\xcd\0\xfc\0\x85\x01\xd8\0\x87\0\x88\0\x04\x012\x01\x11\x01\b\x01\x8d\0\t\x01\n\x01\x9e\0\x9f\0\xa0\0\xa1\0\xa2\0\x04\x01\xa4\0\xa5\0\xa6\0\xa7\0\xa8\0\n\x01\x10\x01\xaa\x01\x12\x01\x01\x01\x87\0\x88\0\0\0)\x01\x05\x01\x07\x01\x8d\0\t\x01\xcb\0\xcc\0\xcd\0\xcf\0\x01\x01\x03\0\xf6\0\t\x01\xf8\0\x04\x01\x07\x01\xfb\0\n\x011\x01<\x01=\x01\x0e\x01\x04\x01\x01\x01\x11\x01\xdf\0\t\x01\xe1\0\n\x01\x07\x01\x17\0\x18\0\x19\0\x1a\0+\x01\x01\x01\x1d\0\x1a\x012\x01\x05\x011\x01\x04\x013\x01\t\x015\x01\xde\0:\x01;\x01<\x01=\x01>\x01?\x01@\x01A\x01B\x01C\x01D\x01E\x01F\x01G\x01\x13\0\t\x01\x15\0\x16\0\x04\x01{\x01\x04\x01\x04\x01\x04\x01`\x01\n\x01\t\x01\x1f\0 \0\n\x01\x01\x01\n\x01\x14\x01\n\x01\x05\x01'\0x\x01\x04\x01\n\x01z\x01r\x01{\x01x\x01\n\x01\x04\x01.\x01/\x01Q\x01y\x01\x05\x01\n\x01\x04\x016\x01\t\x018\x019\x01\x8c\x01\x81\x01\x8e\x01\x01\0\x02\0\x03\0\x8a\x01\x1b\0\x1c\0\x1d\0\x1e\0\x04\x01\x90\x01#\x01$\x01%\x01&\x01<\x01\x9e\x019\0:\0;\0<\0=\0>\0?\0@\0A\0B\0\x06\x01\xa2\x01K\x01\t\x01\x06\x01\x0e\x01s\x01\t\x01\x11\x01\x06\x01\x06\x01\x04\x01\t\x01\t\x01\x04\x01\x07\x01\x04\x01\xb2\x01\n\x01\x04\x01\xb5\x01\x82\x018\x019\x01U\x01V\x01W\x01X\x01\n\x01\x01\x01\x02\x01\x03\x01h\x01i\x01j\x01k\x01\x91\x01-\x01.\x01/\x01\x05\x01\x06\x01\x04\x01t\x01\n\x01\x06\x01\t\x01\n\x01\t\x01\x04\x01\x0b\x01\f\x01\r\x01\x0e\x01\x0f\x01\t\x01\x11\x01\x12\x01\x13\x01\x14\x01\x15\x01\x16\x01\x17\x01\x18\x01\x19\x01\x1a\x01\x1b\x01\x1c\x01\x1d\x01\x1e\x01\x1f\x01 \x01\n\x01\x92\x01#\x01$\x01%\x01&\x01'\x01(\x01)\x01*\x01\n\x01+\x01,\x01-\x01\t\x01\n\x01\n\x011\x01\n\x013\x014\x015\x016\x01\n\x018\x019\x01\xaa\x01#\x01\x06\x01\n\x01\n\x01\t\x01\x05\x01\x0b\x01\f\x01\r\x01\x0e\x01\x0f\x01\n\x01H\x01\x12\x01\x13\x01\x14\x01\x15\x01\x16\x01\x17\x01\x18\x01\x19\x01\x1a\x01\x1b\x01\x1c\x01\x1d\x01\x1e\x01\x1f\x01 \x01\n\x01\n\x01#\x01$\x01%\x01&\x01'\x01(\x01)\x01*\x01\n\x01\x06\x01\x04\x01\x04\x01\t\x01\n\x01\x0b\x01\f\x01\r\x01+\x01\x0f\x01\n\x01\n\x01\x12\x01\x13\x01\x14\x01\x15\x01\x16\x01\x17\x01\x18\x01\x19\x01\x1a\x01\x1b\x01\x1c\x01\x1d\x01\x1e\x01\x1f\x01 \x01\n\x01H\x01#\x01$\x01%\x01&\x01'\x01(\x01)\x01*\x01\t\x01\x04\x01\t\x01\t\x01\t\x01\t\x01\n\x01\x0b\x01\f\x01\r\x01\x0e\x01\x0f\x01\t\x01\x11\x01\x12\x01\x13\x01\x14\x01\x15\x01\x16\x01\x17\x01\x18\x01\x19\x01\x1a\x01\x1b\x01\x1c\x01\x1d\x01\x1e\x01\x1f\x01 \x01H\x01\"\x01#\x01$\x01%\x01&\x01'\x01(\x01)\x01*\x01\n\x01!\x01\n\x01\t\x01\t\x01\n\x01\x0b\x01\f\x01\r\x01\x0e\x01\x0f\x01\t\x01\x11\x01\x12\x01\x13\x01\x14\x01\x15\x01\x16\x01\x17\x01\x18\x01\x19\x01\x1a\x01\x1b\x01\x1c\x01\x1d\x01\x1e\x01\x1f\x01 \x01\n\x01H\x01#\x01$\x01%\x01&\x01'\x01(\x01)\x01*\x01\x01\x01\t\x01\x06\x01\n\x01\t\x01\n\x01\x0b\x01\f\x01\r\x01\x0e\x01\x0f\x01\n\x01\x11\x01\x12\x01\x13\x01\x14\x01\x15\x01\x16\x01\x17\x01\x18\x01\x19\x01\x1a\x01\x1b\x01\x1c\x01\x1d\x01\x1e\x01\x1f\x01 \x01\t\x01H\x01#\x01$\x01%\x01&\x01'\x01(\x01)\x01*\x01\t\x01\x04\x01\n\x01\x04\x01\t\x01\n\x01\x0b\x01\f\x01\r\x01\x0e\x01\x0f\x01\"\x01\x11\x01\x12\x01\x13\x01\x14\x01\x15\x01\x16\x01\x17\x01\x18\x01\x19\x01\x1a\x01\x1b\x01\x1c\x01\x1d\x01\x1e\x01\x1f\x01 \x01\n\x01H\x01#\x01$\x01%\x01&\x01'\x01(\x01)\x01*\x01\n\x01\n\x01\n\x01\n\x01\t\x01\n\x01\x0b\x01\f\x01\r\x01\x0e\x01\x0f\x01\x06\x01\x11\x01\x12\x01\x13\x01\x14\x01\x15\x01\x16\x01\x17\x01\x18\x01\x19\x01\x1a\x01\x1b\x01\x1c\x01\x1d\x01\x1e\x01\x1f\x01 \x01\n\x01H\x01#\x01$\x01%\x01&\x01'\x01(\x01)\x01*\x01\b\x01\n\x01\x01\x01\t\x01\t\x01\x07\x01\x0b\x01\f\x01\r\x01\x0e\x01\x0f\x01\x06\x01\x11\x01\x12\x01\x13\x01\x14\x01\x15\x01\x16\x01\x17\x01\x18\x01\x19\x01\x1a\x01\x1b\x01\x1c\x01\x1d\x01\x1e\x01\x1f\x01 \x01\n\x01H\x01#\x01$\x01%\x01&\x01'\x01(\x01)\x01*\x01\n\x01\n\x01\n\x016\x01\t\x01\n\x01\x0b\x01\f\x01\r\x01\n\x01\x0f\x01\n\x01\n\x01\x12\x01\x13\x01\x14\x01\x15\x01\x16\x01\x17\x01\x18\x01\x19\x01\x1a\x01\x1b\x01\x1c\x01\x1d\x01\x1e\x01\x1f\x01 \x01\n\x01H\x01#\x01$\x01%\x01&\x01'\x01(\x01)\x01*\x01\n\x01\n\x01\n\x01\x06\x01\t\x01\x04\x01\x0b\x01\f\x01\r\x01\x0e\x01\x0f\x014\x01\n\x01\x12\x01\x13\x01\x14\x01\x15\x01\x16\x01\x17\x01\x18\x01\x19\x01\x1a\x01\x1b\x01\x1c\x01\x1d\x01\x1e\x01\x1f\x01 \x01\x0e\x01H\x01#\x01$\x01%\x01&\x01'\x01(\x01)\x01*\x01\x0e\x01\n\x01\n\x01\n\x01\t\x01\n\x01\x0b\x01\f\x01\r\x01\t\x01\x0f\x01\n\x01\n\x01\x12\x01\x13\x01\x14\x01\x15\x01\x16\x01\x17\x01\x18\x01\x19\x01\x1a\x01\x1b\x01\x1c\x01\x1d\x01\x1e\x01\x1f\x01 \x01\n\x01H\x01#\x01$\x01%\x01&\x01'\x01(\x01)\x01*\x01\n\x01\n\x01\n\x01\n\x01\t\x01\x06\x01\x0b\x01\f\x01\r\x01\x0e\x01\x0f\x01\n\x01\n\x01\x12\x01\x13\x01\x14\x01\x15\x01\x16\x01\x17\x01\x18\x01\x19\x01\x1a\x01\x1b\x01\x1c\x01\x1d\x01\x1e\x01\x1f\x01 \x01\t\x01H\x01#\x01$\x01%\x01&\x01'\x01(\x01)\x01*\x01\n\x01\n\x01\n\x01\n\x01\t\x01\t\x01\x0b\x01\f\x01\r\x01\n\x01\x0f\x01\n\x01\n\x01\x12\x01\x13\x01\x14\x01\x15\x01\x16\x01\x17\x01\x18\x01\x19\x01\x1a\x01\x1b\x01\x1c\x01\x1d\x01\x1e\x01\x1f\x01 \x01\n\x01H\x01#\x01$\x01%\x01&\x01'\x01(\x01)\x01*\x01\n\x01\x0e\x01\n\x01\n\x01\t\x01\x11\x01\x0b\x01\f\x01\r\x01\n\x01\x0f\x01\t\x01\0\0\x12\x01\x13\x01\x14\x01\x15\x01\x16\x01\x17\x01\x18\x01\x19\x01\x1a\x01\x1b\x01\x1c\x01\x1d\x01\x1e\x01\x1f\x01 \x01\x11\x01H\x01#\x01$\x01%\x01&\x01'\x01(\x01)\x01*\x01\n\x01\n\x01\n\x01\n\x01\t\x01\x01\x01\x0b\x01\f\x01\r\x01\n\x01\x0f\x01\n\x01\n\x01\x12\x01\x13\x01\x14\x01\x15\x01\x16\x01\x17\x01\x18\x01\x19\x01\x1a\x01\x1b\x01\x1c\x01\x1d\x01\x1e\x01\x1f\x01 \x01\n\x01H\x01#\x01$\x01%\x01&\x01'\x01(\x01)\x01*\x01\n\x01\n\x01\x01\x01\n\x01\t\x01\t\x01\x0b\x01\f\x01\r\x01\x01\x01\x0f\x01\x0e\x01\n\x01\x12\x01\x13\x01\x14\x01\x15\x01\x16\x01\x17\x01\x18\x01\x19\x01\x1a\x01\x1b\x01\x1c\x01\x1d\x01\x1e\x01\x1f\x01 \x01\n\x01H\x01#\x01$\x01%\x01&\x01'\x01(\x01)\x01*\x01\x0e\x01\x86\0\xab\0\xaa\0\t\x01\xf4\0\x0b\x01\f\x01\r\x01\x14\x01\x0f\x01\x02\0\x8d\0\x12\x01\x13\x01\x14\x01\x15\x01\x16\x01\x17\x01\x18\x01\x19\x01\x1a\x01\x1b\x01\x1c\x01\x1d\x01\x1e\x01\x1f\x01 \x01\xff\xffH\x01#\x01$\x01%\x01&\x01'\x01(\x01)\x01*\x01\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x0b\x01\f\x01\r\x01\xff\xff\x0f\x01\xff\xff\xff\xff\x12\x01\x13\x01\x14\x01\x15\x01\x16\x01\x17\x01\x18\x01\x19\x01\x1a\x01\x1b\x01\x1c\x01\x1d\x01\x1e\x01\x1f\x01 \x01\xff\xffH\x01#\x01$\x01%\x01&\x01'\x01(\x01)\x01*\x01\xff\xff\xff\xff-\x01.\x01/\x010\x01\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff8\x019\x01\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x0b\x01\f\x01\r\x01\xff\xff\x0f\x01\xff\xffH\x01\x12\x01\x13\x01\x14\x01\x15\x01\x16\x01\x17\x01\x18\x01\x19\x01\x1a\x01\x1b\x01\x1c\x01\x1d\x01\x1e\x01\x1f\x01 \x01\xff\xff\xff\xff#\x01$\x01%\x01&\x01'\x01(\x01)\x01*\x01\xff\xff\xff\xff-\x01.\x01/\x010\x01\x0b\x01\f\x01\r\x01\xff\xff\x0f\x01\xff\xff\xff\xff\x12\x01\x13\x01\x14\x01\x15\x01\x16\x01\x17\x01\x18\x01\x19\x01\x1a\x01\x1b\x01\x1c\x01\x1d\x01\x1e\x01\x1f\x01 \x01\xff\xffH\x01#\x01$\x01%\x01&\x01'\x01(\x01)\x01*\x01\xff\xff\xff\xff\xff\xff.\x01/\x010\x01\x0b\x01\f\x01\r\x01\xff\xff\x0f\x01\xff\xff\xff\xff\x12\x01\x13\x01\x14\x01\x15\x01\x16\x01\x17\x01\x18\x01\x19\x01\x1a\x01\x1b\x01\x1c\x01\x1d\x01\x1e\x01\x1f\x01 \x01\xff\xffH\x01#\x01$\x01%\x01&\x01'\x01(\x01)\x01*\x01\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x0b\x01\f\x01\r\x01\xff\xff\x0f\x01\x10\x017\x01\x12\x01\x13\x01\x14\x01\x15\x01\x16\x01\x17\x01\x18\x01\x19\x01\x1a\x01\x1b\x01\x1c\x01\x1d\x01\x1e\x01\x1f\x01 \x01\xff\xffH\x01#\x01$\x01%\x01&\x01'\x01(\x01)\x01*\x01\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x0b\x01\f\x01\r\x01\xff\xff\x0f\x01\xff\xff\xff\xff\x12\x01\x13\x01\x14\x01\x15\x01\x16\x01\x17\x01\x18\x01\x19\x01\x1a\x01\x1b\x01\x1c\x01\x1d\x01\x1e\x01\x1f\x01 \x01\xff\xffH\x01#\x01$\x01%\x01&\x01'\x01(\x01)\x01*\x01\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff0\x01\x0b\x01\f\x01\r\x01\xff\xff\x0f\x01\x10\x01\xff\xff\x12\x01\x13\x01\x14\x01\x15\x01\x16\x01\x17\x01\x18\x01\x19\x01\x1a\x01\x1b\x01\x1c\x01\x1d\x01\x1e\x01\x1f\x01 \x01\xff\xffH\x01#\x01$\x01%\x01&\x01'\x01(\x01)\x01*\x01\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x0b\x01\f\x01\r\x01\xff\xff\x0f\x01\xff\xff\xff\xff\x12\x01\x13\x01\x14\x01\x15\x01\x16\x01\x17\x01\x18\x01\x19\x01\x1a\x01\x1b\x01\x1c\x01\x1d\x01\x1e\x01\x1f\x01 \x01\xff\xffH\x01#\x01$\x01%\x01&\x01'\x01(\x01)\x01*\x01\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xffH\x01", 27680 27680 /* error_function */parse_error, 27681 /* names_const */" ANYFUNC\0MUT\0LPAR\0RPAR\0NOP\0DROP\0BLOCK\0END\0IF\0THEN\0ELSE\0SELECT\0LOOP\0BR\0BR_IF\0BR_TABLE\0CALL\0CALL_INDIRECT\0RETURN\0GET_LOCAL\0SET_LOCAL\0TEE_LOCAL\0GET_GLOBAL\0SET_GLOBAL\0UNREACHABLE\0CURRENT_MEMORY\0GROW_MEMORY\0FUNC\0START\0TYPE\0PARAM\0RESULT\0LOCAL\0GLOBAL\0MODULE\0TABLE\0ELEM\0MEMORY\0DATA\0OFFSET\0IMPORT\0EXPORT\0SCRIPT\0REGISTER\0INVOKE\0GET\0ASSERT_MALFORMED\0ASSERT_INVALID\0ASSERT_SOFT_INVALID\0ASSERT_UNLINKABLE\0ASSERT_RETURN\0ASSERT_RETURN_NAN\0ASSERT_TRAP\0ASSERT_EXHAUSTION\0INPUT\0OUTPUT\0EOF\0",27681 /* names_const */"FUNCREF\0MUT\0LPAR\0RPAR\0NOP\0DROP\0BLOCK\0END\0IF\0THEN\0ELSE\0SELECT\0LOOP\0BR\0BR_IF\0BR_TABLE\0CALL\0CALL_INDIRECT\0RETURN\0GET_LOCAL\0SET_LOCAL\0TEE_LOCAL\0GET_GLOBAL\0SET_GLOBAL\0UNREACHABLE\0CURRENT_MEMORY\0GROW_MEMORY\0FUNC\0START\0TYPE\0PARAM\0RESULT\0LOCAL\0GLOBAL\0MODULE\0TABLE\0ELEM\0MEMORY\0DATA\0OFFSET\0IMPORT\0EXPORT\0SCRIPT\0REGISTER\0INVOKE\0GET\0ASSERT_MALFORMED\0ASSERT_INVALID\0ASSERT_SOFT_INVALID\0ASSERT_UNLINKABLE\0ASSERT_RETURN\0ASSERT_RETURN_NAN\0ASSERT_TRAP\0ASSERT_EXHAUSTION\0INPUT\0OUTPUT\0EOF\0", 27682 27682 /* names_block */"NAT\0INT\0FLOAT\0TEXT\0VAR\0VALUE_TYPE\0LOAD\0STORE\0OFFSET_EQ_NAT\0ALIGN_EQ_NAT\0CONST\0UNARY\0BINARY\0COMPARE\0CONVERT\0TEST\0" 27683 27683 ]; … … 29468 29468 29469 29469 function string_of_elem_type() { 29470 return " anyfunc";29470 return "funcref"; 29471 29471 } 29472 29472 … … 29483 29483 29484 29484 function string_of_table_type(param) { 29485 return string_of_limits(param[0]) + " anyfunc";29485 return string_of_limits(param[0]) + " funcref"; 29486 29486 } 29487 29487 -
trunk/JSTests/wasm/spec-tests/jsapi.js
r218216 r246589 515 515 assertThrows(() => new Table({initial:1, element:1}), TypeError); 516 516 assertThrows(() => new Table({initial:1, element:"any"}), TypeError); 517 assertThrows(() => new Table({initial:1, element:{valueOf() { return " anyfunc" }}}), TypeError);518 assertThrows(() => new Table({initial:{valueOf() { throw new Error("here")}}, element:" anyfunc"}), Error);519 assertThrows(() => new Table({initial:-1, element:" anyfunc"}), RangeError);520 assertThrows(() => new Table({initial:Math.pow(2,32), element:" anyfunc"}), RangeError);521 assertThrows(() => new Table({initial:2, maximum:1, element:" anyfunc"}), RangeError);522 assertThrows(() => new Table({initial:2, maximum:Math.pow(2,32), element:" anyfunc"}), RangeError);523 assert_equals(new Table({initial:1, element:" anyfunc"}) instanceof Table, true);524 assert_equals(new Table({initial:1.5, element:" anyfunc"}) instanceof Table, true);525 assert_equals(new Table({initial:1, maximum:1.5, element:" anyfunc"}) instanceof Table, true);526 assert_equals(new Table({initial:1, maximum:Math.pow(2,32)-1, element:" anyfunc"}) instanceof Table, true);517 assertThrows(() => new Table({initial:1, element:{valueOf() { return "funcref" }}}), TypeError); 518 assertThrows(() => new Table({initial:{valueOf() { throw new Error("here")}}, element:"funcref"}), Error); 519 assertThrows(() => new Table({initial:-1, element:"funcref"}), RangeError); 520 assertThrows(() => new Table({initial:Math.pow(2,32), element:"funcref"}), RangeError); 521 assertThrows(() => new Table({initial:2, maximum:1, element:"funcref"}), RangeError); 522 assertThrows(() => new Table({initial:2, maximum:Math.pow(2,32), element:"funcref"}), RangeError); 523 assert_equals(new Table({initial:1, element:"funcref"}) instanceof Table, true); 524 assert_equals(new Table({initial:1.5, element:"funcref"}) instanceof Table, true); 525 assert_equals(new Table({initial:1, maximum:1.5, element:"funcref"}) instanceof Table, true); 526 assert_equals(new Table({initial:1, maximum:Math.pow(2,32)-1, element:"funcref"}) instanceof Table, true); 527 527 }, "'WebAssembly.Table' constructor function"); 528 528 … … 544 544 545 545 test(() => { 546 tbl1 = new Table({initial:2, element:" anyfunc"});546 tbl1 = new Table({initial:2, element:"funcref"}); 547 547 assert_equals(typeof tbl1, "object"); 548 548 assert_equals(String(tbl1), "[object WebAssembly.Table]"); … … 632 632 assertThrows(() => tblGrow.call(tbl1, -1), RangeError); 633 633 assertThrows(() => tblGrow.call(tbl1, Math.pow(2,32)), RangeError); 634 var tbl = new Table({element:" anyfunc", initial:1, maximum:2});634 var tbl = new Table({element:"funcref", initial:1, maximum:2}); 635 635 assert_equals(tbl.length, 1); 636 636 assert_equals(tbl.grow(0), 1); … … 733 733 } 734 734 var scratch_memory = new WebAssembly.Memory({initial:1}); 735 var scratch_table = new WebAssembly.Table({element:" anyfunc", initial:1, maximum:1});735 var scratch_table = new WebAssembly.Table({element:"funcref", initial:1, maximum:1}); 736 736 assertInstantiateError([], TypeError); 737 737 assertInstantiateError([undefined], TypeError); -
trunk/JSTests/wasm/stress/wasm-table-grow-initialize.js
r246487 r246589 5 5 6 6 var table = new WebAssembly.Table({ 7 element: " anyfunc",7 element: "funcref", 8 8 initial: 20 9 9 }); -
trunk/JSTests/wasm/wasm.json
r246577 r246589 12 12 "f32": { "type": "varint7", "value": -3, "b3type": "B3::Float" }, 13 13 "f64": { "type": "varint7", "value": -4, "b3type": "B3::Double" }, 14 " anyfunc": { "type": "varint7", "value": -16, "b3type": "B3::Int64" },14 "funcref": { "type": "varint7", "value": -16, "b3type": "B3::Int64" }, 15 15 "anyref": { "type": "varint7", "value": -17, "b3type": "B3::Int64" }, 16 16 "func": { "type": "varint7", "value": -32, "b3type": "B3::Void" }, 17 17 "void": { "type": "varint7", "value": -64, "b3type": "B3::Void" } 18 18 }, 19 "value_type": ["i32", "i64", "f32", "f64", "anyref", " anyfunc"],20 "block_type": ["i32", "i64", "f32", "f64", "void", "anyref", " anyfunc"],21 "elem_type": [" anyfunc","anyref"],19 "value_type": ["i32", "i64", "f32", "f64", "anyref", "funcref"], 20 "block_type": ["i32", "i64", "f32", "f64", "void", "anyref", "funcref"], 21 "elem_type": ["funcref","anyref"], 22 22 "external_kind": { 23 23 "Function": { "type": "uint8", "value": 0 }, … … 60 60 "f64.const": { "category": "special", "value": 68, "return": ["f64"], "parameter": [], "immediate": [{"name": "value", "type": "double"}], "description": "a constant value interpreted as f64" }, 61 61 "f32.const": { "category": "special", "value": 67, "return": ["f32"], "parameter": [], "immediate": [{"name": "value", "type": "float"}], "description": "a constant value interpreted as f32" }, 62 "ref.null": { "category": "special", "value": 208, "return": [" anyfunc"], "parameter": [], "immediate": [], "description": "a constant null reference" },62 "ref.null": { "category": "special", "value": 208, "return": ["funcref"], "parameter": [], "immediate": [], "description": "a constant null reference" }, 63 63 "ref.is_null": { "category": "special", "value": 209, "return": ["i32"], "parameter": ["anyref"], "immediate": [], "description": "determine if a reference is null" }, 64 "ref.func": { "category": "special", "value": 210, "return": [" anyfunc"], "parameter": [], "immediate": [{"name": "function_index", "type": "varuint32"}], "description": "return a reference to the function at the given index" },64 "ref.func": { "category": "special", "value": 210, "return": ["funcref"], "parameter": [], "immediate": [{"name": "function_index", "type": "varuint32"}], "description": "return a reference to the function at the given index" }, 65 65 "get_local": { "category": "special", "value": 32, "return": ["any"], "parameter": [], "immediate": [{"name": "local_index", "type": "varuint32"}], "description": "read a local variable or parameter" }, 66 66 "set_local": { "category": "special", "value": 33, "return": [], "parameter": ["any"], "immediate": [{"name": "local_index", "type": "varuint32"}], "description": "write a local variable or parameter" }, -
trunk/Source/JavaScriptCore/ChangeLog
r246587 r246589 1 2019-06-19 Justin Michaud <justin_michaud@apple.com> 2 3 [WASM-References] Rename anyfunc to funcref 4 https://bugs.webkit.org/show_bug.cgi?id=198983 5 6 Reviewed by Yusuke Suzuki. 7 8 Anyfunc should become funcref since it was renamed in the spec. We should also support the string 'anyfunc' in the table constructor since this is 9 the only non-binary-format place where it is exposed to users. 10 11 * wasm/WasmAirIRGenerator.cpp: 12 (JSC::Wasm::AirIRGenerator::gFuncref): 13 (JSC::Wasm::AirIRGenerator::tmpForType): 14 (JSC::Wasm::AirIRGenerator::emitCCall): 15 (JSC::Wasm::AirIRGenerator::moveOpForValueType): 16 (JSC::Wasm::AirIRGenerator::AirIRGenerator): 17 (JSC::Wasm::AirIRGenerator::addLocal): 18 (JSC::Wasm::AirIRGenerator::addConstant): 19 (JSC::Wasm::AirIRGenerator::addRefFunc): 20 (JSC::Wasm::AirIRGenerator::addReturn): 21 (JSC::Wasm::AirIRGenerator::gAnyfunc): Deleted. 22 * wasm/WasmCallingConvention.h: 23 (JSC::Wasm::CallingConventionAir::marshallArgument const): 24 (JSC::Wasm::CallingConventionAir::setupCall const): 25 * wasm/WasmExceptionType.h: 26 * wasm/WasmFormat.h: 27 (JSC::Wasm::isValueType): 28 (JSC::Wasm::isSubtype): 29 (JSC::Wasm::TableInformation::wasmType const): 30 * wasm/WasmFunctionParser.h: 31 (JSC::Wasm::FunctionParser<Context>::parseExpression): 32 * wasm/WasmSectionParser.cpp: 33 (JSC::Wasm::SectionParser::parseTableHelper): 34 (JSC::Wasm::SectionParser::parseElement): 35 (JSC::Wasm::SectionParser::parseInitExpr): 36 * wasm/WasmValidate.cpp: 37 (JSC::Wasm::Validate::addRefFunc): 38 * wasm/js/JSToWasm.cpp: 39 (JSC::Wasm::createJSToWasmWrapper): 40 * wasm/js/WasmToJS.cpp: 41 (JSC::Wasm::wasmToJS): 42 * wasm/js/WebAssemblyFunction.cpp: 43 (JSC::callWebAssemblyFunction): 44 (JSC::WebAssemblyFunction::jsCallEntrypointSlow): 45 * wasm/js/WebAssemblyModuleRecord.cpp: 46 (JSC::WebAssemblyModuleRecord::link): 47 * wasm/js/WebAssemblyTableConstructor.cpp: 48 (JSC::constructJSWebAssemblyTable): 49 * wasm/wasm.json: 50 1 51 2019-06-19 Fujii Hironori <Hironori.Fujii@sony.com> 2 52 -
trunk/Source/JavaScriptCore/wasm/WasmAirIRGenerator.cpp
r246577 r246589 366 366 TypedTmp g64() { return { newTmp(B3::GP), Type::I64 }; } 367 367 TypedTmp gAnyref() { return { newTmp(B3::GP), Type::Anyref }; } 368 TypedTmp g Anyfunc() { return { newTmp(B3::GP), Type::Anyfunc}; }368 TypedTmp gFuncref() { return { newTmp(B3::GP), Type::Funcref }; } 369 369 TypedTmp f32() { return { newTmp(B3::FP), Type::F32 }; } 370 370 TypedTmp f64() { return { newTmp(B3::FP), Type::F64 }; } … … 377 377 case Type::I64: 378 378 return g64(); 379 case Type:: Anyfunc:380 return g Anyfunc();379 case Type::Funcref: 380 return gFuncref(); 381 381 case Type::Anyref: 382 382 return gAnyref(); … … 517 517 case Type::I64: 518 518 case Type::Anyref: 519 case Type:: Anyfunc:519 case Type::Funcref: 520 520 resultType = B3::Int64; 521 521 break; … … 566 566 case Type::I64: 567 567 case Type::Anyref: 568 case Type:: Anyfunc:568 case Type::Funcref: 569 569 return Move; 570 570 case Type::F32: … … 814 814 case Type::I64: 815 815 case Type::Anyref: 816 case Type:: Anyfunc:816 case Type::Funcref: 817 817 append(Move, arg, m_locals[i]); 818 818 break; … … 900 900 switch (type) { 901 901 case Type::Anyref: 902 case Type:: Anyfunc:902 case Type::Funcref: 903 903 append(Move, Arg::imm(JSValue::encode(jsNull())), local); 904 904 break; … … 935 935 case Type::I64: 936 936 case Type::Anyref: 937 case Type:: Anyfunc:937 case Type::Funcref: 938 938 append(block, Move, Arg::bigImm(value), result); 939 939 break; … … 974 974 { 975 975 // FIXME: Emit this inline <https://bugs.webkit.org/show_bug.cgi?id=198506>. 976 result = tmpForType(Type:: Anyfunc);976 result = tmpForType(Type::Funcref); 977 977 emitCCall(&doWasmRefFunc, result, instanceValue(), addConstant(Type::I32, index)); 978 978 … … 1700 1700 case Type::I64: 1701 1701 case Type::Anyref: 1702 case Type:: Anyfunc:1702 case Type::Funcref: 1703 1703 append(Move, returnValues[0], returnValueGPR); 1704 1704 append(Ret64, returnValueGPR); -
trunk/Source/JavaScriptCore/wasm/WasmCallingConvention.h
r246504 r246589 237 237 case Type::I64: 238 238 case Type::Anyref: 239 case Wasm:: Anyfunc:239 case Wasm::Funcref: 240 240 marshallArgumentImpl(m_gprArgs, gpArgumentCount, stackOffset, regFunc, stackFunc); 241 241 break; … … 303 303 case Type::I64: 304 304 case Type::Anyref: 305 case Wasm:: Anyfunc:305 case Wasm::Funcref: 306 306 patchpoint->resultConstraint = B3::ValueRep::reg(GPRInfo::returnValueGPR); 307 307 break; -
trunk/Source/JavaScriptCore/wasm/WasmExceptionType.h
r246577 r246589 45 45 macro(I64ArgumentType, "WebAssembly function with an i64 argument can't be called from JavaScript") \ 46 46 macro(I64ReturnType, "WebAssembly function that returns i64 can't be called from JavaScript") \ 47 macro(FuncrefNotWasm, " Anyfuncmust be an exported wasm function")47 macro(FuncrefNotWasm, "Funcref must be an exported wasm function") 48 48 49 49 enum class ExceptionType : uint32_t { -
trunk/Source/JavaScriptCore/wasm/WasmFormat.h
r246571 r246589 69 69 return true; 70 70 case Anyref: 71 case Anyfunc:71 case Funcref: 72 72 return Options::useWebAssemblyReferences(); 73 73 default: … … 81 81 if (sub == parent) 82 82 return true; 83 return sub == Anyfunc&& parent == Anyref;83 return sub == Funcref && parent == Anyref; 84 84 } 85 85 … … 246 246 Optional<uint32_t> maximum() const { return m_maximum; } 247 247 TableElementType type() const { return m_type; } 248 Wasm::Type wasmType() const { return m_type == TableElementType::Funcref ? Type:: Anyfunc: Type::Anyref; }248 Wasm::Type wasmType() const { return m_type == TableElementType::Funcref ? Type::Funcref : Type::Anyref; } 249 249 250 250 private: -
trunk/Source/JavaScriptCore/wasm/WasmFunctionParser.h
r246577 r246589 343 343 case RefNull: { 344 344 WASM_PARSER_FAIL_IF(!Options::useWebAssemblyReferences(), "references are not enabled"); 345 m_expressionStack.append(m_context.addConstant( Anyfunc, JSValue::encode(jsNull())));345 m_expressionStack.append(m_context.addConstant(Funcref, JSValue::encode(jsNull()))); 346 346 return { }; 347 347 } … … 444 444 WASM_PARSER_FAIL_IF(tableIndex >= m_info.tableCount(), "call_indirect's table index ", tableIndex, " invalid, limit is ", m_info.tableCount()); 445 445 WASM_PARSER_FAIL_IF(m_info.usedSignatures.size() <= signatureIndex, "call_indirect's signature index ", signatureIndex, " exceeds known signatures ", m_info.usedSignatures.size()); 446 WASM_PARSER_FAIL_IF(m_info.tables[tableIndex].type() != TableElementType::Funcref, "call_indirect is only valid when a table has type anyfunc");446 WASM_PARSER_FAIL_IF(m_info.tables[tableIndex].type() != TableElementType::Funcref, "call_indirect is only valid when a table has type funcref"); 447 447 448 448 const Signature& calleeSignature = m_info.usedSignatures[signatureIndex].get(); -
trunk/Source/JavaScriptCore/wasm/WasmSectionParser.cpp
r246571 r246589 199 199 int8_t type; 200 200 WASM_PARSER_FAIL_IF(!parseInt7(type), "can't parse Table type"); 201 WASM_PARSER_FAIL_IF(type != Wasm:: Anyfunc && type != Wasm::Anyref, "Table type should be anyfuncor anyref, got ", type);201 WASM_PARSER_FAIL_IF(type != Wasm::Funcref && type != Wasm::Anyref, "Table type should be funcref or anyref, got ", type); 202 202 203 203 uint32_t initial; … … 210 210 ASSERT(!maximum || *maximum >= initial); 211 211 212 TableElementType tableType = type == Wasm:: Anyfunc? TableElementType::Funcref : TableElementType::Anyref;212 TableElementType tableType = type == Wasm::Funcref ? TableElementType::Funcref : TableElementType::Anyref; 213 213 m_info->tables.append(TableInformation(initial, maximum, isImport, tableType)); 214 214 … … 379 379 WASM_PARSER_FAIL_IF(!parseVarUInt32(tableIndex), "can't get ", elementNum, "th Element table index"); 380 380 WASM_PARSER_FAIL_IF(tableIndex >= m_info->tableCount(), "Element section for Table ", tableIndex, " exceeds available Table ", m_info->tableCount()); 381 WASM_PARSER_FAIL_IF(m_info->tables[tableIndex].type() != TableElementType::Funcref, "Table ", tableIndex, " must have type ' anyfunc' to have an element section");381 WASM_PARSER_FAIL_IF(m_info->tables[tableIndex].type() != TableElementType::Funcref, "Table ", tableIndex, " must have type 'funcref' to have an element section"); 382 382 Type initExprType; 383 383 WASM_FAIL_IF_HELPER_FAILS(parseInitExpr(initOpcode, initExprBits, initExprType)); … … 482 482 483 483 case RefNull: { 484 resultType = Anyfunc;484 resultType = Funcref; 485 485 bitsOrImportNumber = JSValue::encode(jsNull()); 486 486 break; … … 492 492 WASM_PARSER_FAIL_IF(index >= m_info->functions.size(), "ref.func index", index, " exceeds the number of functions ", m_info->functions.size()); 493 493 494 resultType = Anyfunc;494 resultType = Funcref; 495 495 bitsOrImportNumber = index; 496 496 break; -
trunk/Source/JavaScriptCore/wasm/WasmValidate.cpp
r246577 r246589 239 239 auto Validate::addRefFunc(uint32_t index, ExpressionType& result) -> Result 240 240 { 241 result = Type:: Anyfunc;241 result = Type::Funcref; 242 242 WASM_VALIDATOR_FAIL_IF(index >= m_module.functionIndexSpaceSize(), "ref.func index ", index, " is too large, max is ", m_module.functionIndexSpaceSize()); 243 243 m_module.addReferencedFunction(index); -
trunk/Source/JavaScriptCore/wasm/js/JSToWasm.cpp
r246504 r246589 85 85 case Wasm::I32: 86 86 case Wasm::Anyref: 87 case Wasm:: Anyfunc:87 case Wasm::Funcref: 88 88 if (numGPRs >= wasmCallingConvention().m_gprArgs.size()) 89 89 totalFrameSize += sizeof(void*); … … 155 155 case Wasm::I32: 156 156 case Wasm::I64: 157 case Wasm:: Anyfunc:157 case Wasm::Funcref: 158 158 case Wasm::Anyref: 159 159 if (numGPRs >= wasmCallingConvention().m_gprArgs.size()) { … … 241 241 break; 242 242 case Wasm::Anyref: 243 case Wasm:: Anyfunc:243 case Wasm::Funcref: 244 244 break; 245 245 case Wasm::I32: -
trunk/Source/JavaScriptCore/wasm/js/WasmToJS.cpp
r246504 r246589 166 166 RELEASE_ASSERT_NOT_REACHED(); 167 167 case Anyref: 168 case Anyfunc:168 case Funcref: 169 169 case I32: { 170 170 GPRReg gprReg; … … 243 243 arg = jsNumber(static_cast<int32_t>(buffer[argNum])); 244 244 break; 245 case Anyfunc: {245 case Funcref: { 246 246 arg = JSValue::decode(buffer[argNum]); 247 247 ASSERT(isWebAssemblyHostFunction(*vm, arg) || arg.isNull()); … … 281 281 break; 282 282 } 283 case Anyfunc: {283 case Funcref: { 284 284 realResult = JSValue::encode(result); 285 285 ASSERT(result.isFunction(*vm) || result.isNull()); … … 382 382 RELEASE_ASSERT_NOT_REACHED(); // Handled above. 383 383 case Anyref: 384 case Anyfunc:384 case Funcref: 385 385 case I32: { 386 386 GPRReg gprReg; … … 451 451 RELEASE_ASSERT_NOT_REACHED(); // Handled above. 452 452 case Anyref: 453 case Anyfunc:453 case Funcref: 454 454 case I32: 455 455 // Skipped: handled above. … … 559 559 break; 560 560 } 561 case Anyfunc:561 case Funcref: 562 562 case Anyref: 563 563 break; -
trunk/Source/JavaScriptCore/wasm/js/WebAssemblyFunction.cpp
r246504 r246589 85 85 arg = JSValue::decode(arg.toInt32(exec)); 86 86 break; 87 case Wasm:: Anyfunc: {87 case Wasm::Funcref: { 88 88 if (!isWebAssemblyHostFunction(vm, arg) && !arg.isNull()) 89 return JSValue::encode(throwException(exec, scope, createJSWebAssemblyRuntimeError(exec, vm, " Anyfuncmust be an exported wasm function")));89 return JSValue::encode(throwException(exec, scope, createJSWebAssemblyRuntimeError(exec, vm, "Funcref must be an exported wasm function"))); 90 90 break; 91 91 } … … 233 233 break; 234 234 case Wasm::Anyref: 235 case Wasm:: Anyfunc:235 case Wasm::Funcref: 236 236 case Wasm::I32: 237 237 if (numGPRs >= Wasm::wasmCallingConvention().m_gprArgs.size()) … … 309 309 } 310 310 break; 311 case Wasm:: Anyfunc: {311 case Wasm::Funcref: { 312 312 // FIXME: Emit this inline <https://bugs.webkit.org/show_bug.cgi?id=198506>. 313 313 bool (*shouldThrow)(Wasm::Instance*, JSValue) = [] (Wasm::Instance* wasmInstance, JSValue arg) -> bool { … … 493 493 break; 494 494 } 495 case Wasm:: Anyfunc:495 case Wasm::Funcref: 496 496 case Wasm::Anyref: 497 497 break; -
trunk/Source/JavaScriptCore/wasm/js/WebAssemblyModuleRecord.cpp
r246571 r246589 238 238 // iii. Append ToWebAssemblyValue(v) to imports. 239 239 switch (moduleInformation.globals[import.kindIndex].type) { 240 case Wasm:: Anyfunc:240 case Wasm::Funcref: 241 241 if (!isWebAssemblyHostFunction(vm, value) && !value.isNull()) 242 242 return exception(createJSWebAssemblyLinkError(exec, vm, importFailMessage(import, "imported global", "must be a wasm exported function or null"))); … … 411 411 switch (global.type) { 412 412 case Wasm::Anyref: 413 case Wasm:: Anyfunc:413 case Wasm::Funcref: 414 414 exportedValue = JSValue::decode(m_instance->instance().loadI64Global(exp.kindIndex)); 415 415 break; -
trunk/Source/JavaScriptCore/wasm/js/WebAssemblyTableConstructor.cpp
r246139 r246589 66 66 String elementString = elementValue.toWTFString(exec); 67 67 RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); 68 if (elementString == " anyfunc")68 if (elementString == "funcref" || elementString == "anyfunc") 69 69 type = Wasm::TableElementType::Funcref; 70 70 else if (elementString == "anyref") 71 71 type = Wasm::TableElementType::Anyref; 72 72 else 73 return JSValue::encode(throwException(exec, throwScope, createTypeError(exec, "WebAssembly.Table expects its 'element' field to be the string ' anyfunc' or 'anyref'"_s)));73 return JSValue::encode(throwException(exec, throwScope, createTypeError(exec, "WebAssembly.Table expects its 'element' field to be the string 'funcref' or 'anyref'"_s))); 74 74 } 75 75 -
trunk/Source/JavaScriptCore/wasm/wasm.json
r246577 r246589 12 12 "f32": { "type": "varint7", "value": -3, "b3type": "B3::Float" }, 13 13 "f64": { "type": "varint7", "value": -4, "b3type": "B3::Double" }, 14 " anyfunc": { "type": "varint7", "value": -16, "b3type": "B3::Int64" },14 "funcref": { "type": "varint7", "value": -16, "b3type": "B3::Int64" }, 15 15 "anyref": { "type": "varint7", "value": -17, "b3type": "B3::Int64" }, 16 16 "func": { "type": "varint7", "value": -32, "b3type": "B3::Void" }, 17 17 "void": { "type": "varint7", "value": -64, "b3type": "B3::Void" } 18 18 }, 19 "value_type": ["i32", "i64", "f32", "f64", "anyref", " anyfunc"],20 "block_type": ["i32", "i64", "f32", "f64", "void", "anyref", " anyfunc"],21 "elem_type": [" anyfunc","anyref"],19 "value_type": ["i32", "i64", "f32", "f64", "anyref", "funcref"], 20 "block_type": ["i32", "i64", "f32", "f64", "void", "anyref", "funcref"], 21 "elem_type": ["funcref","anyref"], 22 22 "external_kind": { 23 23 "Function": { "type": "uint8", "value": 0 }, … … 60 60 "f64.const": { "category": "special", "value": 68, "return": ["f64"], "parameter": [], "immediate": [{"name": "value", "type": "double"}], "description": "a constant value interpreted as f64" }, 61 61 "f32.const": { "category": "special", "value": 67, "return": ["f32"], "parameter": [], "immediate": [{"name": "value", "type": "float"}], "description": "a constant value interpreted as f32" }, 62 "ref.null": { "category": "special", "value": 208, "return": [" anyfunc"], "parameter": [], "immediate": [], "description": "a constant null reference" },62 "ref.null": { "category": "special", "value": 208, "return": ["funcref"], "parameter": [], "immediate": [], "description": "a constant null reference" }, 63 63 "ref.is_null": { "category": "special", "value": 209, "return": ["i32"], "parameter": ["anyref"], "immediate": [], "description": "determine if a reference is null" }, 64 "ref.func": { "category": "special", "value": 210, "return": [" anyfunc"], "parameter": [], "immediate": [{"name": "function_index", "type": "varuint32"}], "description": "return a reference to the function at the given index" },64 "ref.func": { "category": "special", "value": 210, "return": ["funcref"], "parameter": [], "immediate": [{"name": "function_index", "type": "varuint32"}], "description": "return a reference to the function at the given index" }, 65 65 "get_local": { "category": "special", "value": 32, "return": ["any"], "parameter": [], "immediate": [{"name": "local_index", "type": "varuint32"}], "description": "read a local variable or parameter" }, 66 66 "set_local": { "category": "special", "value": 33, "return": [], "parameter": ["any"], "immediate": [{"name": "local_index", "type": "varuint32"}], "description": "write a local variable or parameter" },
Note: See TracChangeset
for help on using the changeset viewer.