From 89b8af006bc56cb4bf68f12a80b1cfe8e7a353d4 Mon Sep 17 00:00:00 2001 From: Abbas Mashayekh Date: Sat, 6 Mar 2021 03:08:51 +0330 Subject: [reference-types] Support passive elem segments (#3572) Passive element segments do not belong to any table, so the link between Table and elem needs to be weaker; i.e. an elem may have a table in case of active segments, or simply be a collection of function references in case of passive/declarative segments. This PR takes Table::Segment out and turns it into a first class module element just like tables and functions. It also implements early support for parsing, printing, encoding and decoding passive/declarative elem segments. --- test/binaryen.js/reloc.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test/binaryen.js/reloc.js') diff --git a/test/binaryen.js/reloc.js b/test/binaryen.js/reloc.js index bb011916d..2b7cc9f90 100644 --- a/test/binaryen.js/reloc.js +++ b/test/binaryen.js/reloc.js @@ -15,7 +15,7 @@ module.setMemory(1, -1, null, [ var func = module.addFunction("func", binaryen.none, binaryen.none, [], module.nop()); module.addGlobalImport("table_base", "env", "table_base", binaryen.i32, false); -module.setFunctionTable(1, -1, [ "func", "func" ], module.global.get("table_base", binaryen.i32)); - +module.addTable("0", 1, -1); +module.addActiveElementSegment("0", "0", [ "func", "func" ], module.global.get("table_base", binaryen.i32)); assert(module.validate()); console.log(module.emitText()); -- cgit v1.2.3