diff options
Diffstat (limited to 'src/ir/import-utils.h')
-rw-r--r-- | src/ir/import-utils.h | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/ir/import-utils.h b/src/ir/import-utils.h index 2e7a4f44c..d0b5a8042 100644 --- a/src/ir/import-utils.h +++ b/src/ir/import-utils.h @@ -30,6 +30,7 @@ struct ImportInfo { std::vector<Global*> importedGlobals; std::vector<Function*> importedFunctions; std::vector<Table*> importedTables; + std::vector<Memory*> importedMemories; std::vector<Tag*> importedTags; ImportInfo(Module& wasm) : wasm(wasm) { @@ -48,6 +49,11 @@ struct ImportInfo { importedTables.push_back(import.get()); } } + for (auto& import : wasm.memories) { + if (import->imported()) { + importedMemories.push_back(import.get()); + } + } for (auto& import : wasm.tags) { if (import->imported()) { importedTags.push_back(import.get()); @@ -88,11 +94,13 @@ struct ImportInfo { Index getNumImportedTables() { return importedTables.size(); } + Index getNumImportedMemories() { return importedMemories.size(); } + Index getNumImportedTags() { return importedTags.size(); } Index getNumImports() { return getNumImportedGlobals() + getNumImportedFunctions() + - getNumImportedTags() + (wasm.memory.imported() ? 1 : 0) + + getNumImportedTags() + getNumImportedMemories() + getNumImportedTables(); } @@ -108,6 +116,10 @@ struct ImportInfo { return wasm.tables.size() - getNumImportedTables(); } + Index getNumDefinedMemories() { + return wasm.memories.size() - getNumImportedMemories(); + } + Index getNumDefinedTags() { return wasm.tags.size() - getNumImportedTags(); } }; |