summaryrefslogtreecommitdiff
path: root/src/wasm-binary.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/wasm-binary.h')
-rw-r--r--src/wasm-binary.h22
1 files changed, 19 insertions, 3 deletions
diff --git a/src/wasm-binary.h b/src/wasm-binary.h
index 9ac5664d3..c869adf06 100644
--- a/src/wasm-binary.h
+++ b/src/wasm-binary.h
@@ -393,6 +393,14 @@ enum Subsection {
NameModule = 0,
NameFunction = 1,
NameLocal = 2,
+ // see: https://github.com/WebAssembly/extended-name-section
+ NameLabel = 3,
+ NameType = 4,
+ NameTable = 5,
+ NameMemory = 6,
+ NameGlobal = 7,
+ NameElem = 8,
+ NameData = 9
};
} // namespace UserSections
@@ -1299,8 +1307,8 @@ public:
Name getNextLabel();
- // We read functions before we know their names, so we need to backpatch the
- // names later
+ // We read functions and globals before we know their names, so we need to
+ // backpatch the names later
// we store functions here before wasm.addFunction after we know their names
std::vector<Function*> functions;
@@ -1314,6 +1322,14 @@ public:
// function to check
Index endOfFunction = -1;
+ // we store globals here before wasm.addGlobal after we know their names
+ std::vector<Global*> globals;
+ // we store global imports here before wasm.addGlobalImport after we know
+ // their names
+ std::vector<Global*> globalImports;
+ // at index i we have all refs to the global i
+ std::map<Index, std::vector<Expression*>> globalRefs;
+
// Throws a parsing error if we are not in a function context
void requireFunctionContext(const char* error);
@@ -1382,7 +1398,7 @@ public:
Expression* popTypedExpression(Type type);
void validateBinary(); // validations that cannot be performed on the Module
- void processFunctions();
+ void processNames();
size_t dataCount = 0;
bool hasDataCount = false;