diff options
author | Ben Smith <binjimin@gmail.com> | 2019-04-18 16:37:58 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-18 16:37:58 -0700 |
commit | e7a3802b6e8bb1ab88d9b0bc97d7f5a20ffe0ab9 (patch) | |
tree | a10f021e6eeefe1fa5cca343156adc328913b115 /src/ir.h | |
parent | 791896866ee26621ba806d03c69b64ece0992c66 (diff) | |
download | wabt-e7a3802b6e8bb1ab88d9b0bc97d7f5a20ffe0ab9.tar.gz wabt-e7a3802b6e8bb1ab88d9b0bc97d7f5a20ffe0ab9.tar.bz2 wabt-e7a3802b6e8bb1ab88d9b0bc97d7f5a20ffe0ab9.zip |
Proper encoding of passive element segments (#1066)
* Store element segments as a vector of `ElemExpr`, instead of func index
* Read/write binary format for each element expression
* Read/write text format for each element expression
Diffstat (limited to 'src/ir.h')
-rw-r--r-- | src/ir.h | 17 |
1 files changed, 16 insertions, 1 deletions
@@ -546,6 +546,21 @@ struct Table { Type elem_type; }; +enum class ElemExprKind { + RefNull, + RefFunc, +}; + +struct ElemExpr { + ElemExpr() : kind(ElemExprKind::RefNull) {} + explicit ElemExpr(Var var) : kind(ElemExprKind::RefFunc), var(var) {} + + ElemExprKind kind; + Var var; // Only used when kind == RefFunc. +}; + +typedef std::vector<ElemExpr> ElemExprVector; + struct ElemSegment { explicit ElemSegment(string_view name) : name(name.to_string()) {} @@ -553,7 +568,7 @@ struct ElemSegment { Var table_var; bool passive = false; ExprList offset; - VarVector vars; + ElemExprVector elem_exprs; }; struct Memory { |