summaryrefslogtreecommitdiff
path: root/src/ir.h
diff options
context:
space:
mode:
authorBen Smith <binjimin@gmail.com>2019-04-18 16:37:58 -0700
committerGitHub <noreply@github.com>2019-04-18 16:37:58 -0700
commite7a3802b6e8bb1ab88d9b0bc97d7f5a20ffe0ab9 (patch)
treea10f021e6eeefe1fa5cca343156adc328913b115 /src/ir.h
parent791896866ee26621ba806d03c69b64ece0992c66 (diff)
downloadwabt-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.h17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/ir.h b/src/ir.h
index eb014024..a7f973f2 100644
--- a/src/ir.h
+++ b/src/ir.h
@@ -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 {