diff options
author | Alon Zakai <alonzakai@gmail.com> | 2018-04-05 14:49:25 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-05 14:49:25 -0700 |
commit | 5b5789495a97602869f18d552b2a9e1814edefae (patch) | |
tree | f70e304fc85dca03ebd6d2311007476700e1ffd0 /src/wasm.h | |
parent | 82151243bbd4c018191721dce5381c8e449f3c77 (diff) | |
download | binaryen-5b5789495a97602869f18d552b2a9e1814edefae.tar.gz binaryen-5b5789495a97602869f18d552b2a9e1814edefae.tar.bz2 binaryen-5b5789495a97602869f18d552b2a9e1814edefae.zip |
when creating blocks in binary format parsing, we know if a block has a break to it - use that to avoid rescanning blocks for unreachability purposes (#1495)
Diffstat (limited to 'src/wasm.h')
-rw-r--r-- | src/wasm.h | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/wasm.h b/src/wasm.h index f5802052b..9d8648308 100644 --- a/src/wasm.h +++ b/src/wasm.h @@ -250,13 +250,20 @@ public: Name name; ExpressionList list; + // set the type purely based on its contents. this scans the block, so it is not fast. + void finalize(); + // set the type given you know its type, which is the case when parsing // s-expression or binary, as explicit types are given. the only additional work - // this does is to set the type to unreachable in the cases that is needed. + // this does is to set the type to unreachable in the cases that is needed + // (which may require scanning the block) void finalize(Type type_); - // set the type purely based on its contents. this scans the block, so it is not fast - void finalize(); + // set the type given you know its type, and you know if there is a break to this + // block. this avoids the need to scan the contents of the block in the case that + // it might be unreachable, so it is recommended if you already know the type + // and breakability anyhow. + void finalize(Type type_, bool hasBreak); }; class If : public SpecificExpression<Expression::IfId> { |