From c4e70a04c42cdad380707d2e4b4f6f9503462414 Mon Sep 17 00:00:00 2001 From: Derek Schuff Date: Mon, 3 Oct 2016 21:41:43 -0700 Subject: More binary updates for 0xc (#733) Refine tables to explicitly exist or not. Previously they were printed or encoded if it had any segments, or an initial or max size. However tables can be defined but empty, so we had a special hack that defined an empty segment when we really just wanted an empty table. Now, just make the existence explicit. Update Function table encoding for 0xc (Table and Element sections) Add end opcodes after function bodies (these are consumed by getMaybeBlock with the same behavior that it had before when it reached the function end, so no explicit decode) Update call_indirect encoding for 0xc (no arity, call target is last) --- src/binaryen-c.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/binaryen-c.cpp') diff --git a/src/binaryen-c.cpp b/src/binaryen-c.cpp index 310757cad..b8933147f 100644 --- a/src/binaryen-c.cpp +++ b/src/binaryen-c.cpp @@ -756,6 +756,7 @@ void BinaryenSetFunctionTable(BinaryenModuleRef module, BinaryenFunctionRef* fun } auto* wasm = (Module*)module; + wasm->table.exists = true; Table::Segment segment(wasm->allocator.alloc()->set(Literal(int32_t(0)))); for (BinaryenIndex i = 0; i < numFuncs; i++) { segment.data.push_back(((Function*)funcs[i])->name); -- cgit v1.2.3