From 1f682f4323cb6b7d81dabccb0b989e6e542da7ce Mon Sep 17 00:00:00 2001 From: Thomas Lively <7121787+tlively@users.noreply.github.com> Date: Thu, 27 Feb 2020 20:08:06 -0800 Subject: Generalize binary writing for tuples (#2670) Updates `BinaryInstWriter::mapLocalsAndEmitHeader` so it no longer hardcodes each possible local type. Also adds a new inner loop over the elements of any local tuple type in the IR. Updates the map from IR local indices to binary indices to be additionally keyed on the index within a tuple type. Since we do not generate tuple types yet, this additional index is hardcoded to zero everywhere it is used for now. A later PR adding tuple creation operations will extend this functionality and add tests. --- src/wasm-stack.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/wasm-stack.h') diff --git a/src/wasm-stack.h b/src/wasm-stack.h index 863bbbf51..b42ae1253 100644 --- a/src/wasm-stack.h +++ b/src/wasm-stack.h @@ -166,8 +166,8 @@ private: // type => number of locals of that type in the compact form std::map numLocalsByType; - // local index => index in compact form of [all int32s][all int64s]etc - std::map mappedLocals; + // (local index, tuple index) => binary local index + std::map, size_t> mappedLocals; }; // Takes binaryen IR and converts it to something else (binary or stack IR) -- cgit v1.2.3