From 58173465713be0775acba670b178f2c8a9eda589 Mon Sep 17 00:00:00 2001 From: stevenfontanella Date: Fri, 23 Jan 2026 21:14:21 +0000 Subject: [PATCH] Rename tableMeta to getDefinition --- src/ir/runtime-table.cpp | 2 +- src/ir/runtime-table.h | 14 +++++++------- src/tools/wasm-ctor-eval.cpp | 4 ++-- src/wasm-interpreter.h | 9 +++++---- 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/ir/runtime-table.cpp b/src/ir/runtime-table.cpp index 92a6578f5d7..a2e2cb1da02 100644 --- a/src/ir/runtime-table.cpp +++ b/src/ir/runtime-table.cpp @@ -56,7 +56,7 @@ std::optional RealRuntimeTable::grow(std::size_t delta, return std::nullopt; } - if (newSize > WebLimitations::MaxTableSize || newSize > tableMeta_.max) { + if (newSize > WebLimitations::MaxTableSize || newSize > tableDefinition.max) { return std::nullopt; } diff --git a/src/ir/runtime-table.h b/src/ir/runtime-table.h index a8deaa4f6c6..c38214f34b7 100644 --- a/src/ir/runtime-table.h +++ b/src/ir/runtime-table.h @@ -30,7 +30,7 @@ namespace wasm { // out-of-bounds access. class RuntimeTable { public: - RuntimeTable(Table table) : tableMeta_(table) {} + RuntimeTable(Table table) : tableDefinition(table) {} virtual ~RuntimeTable() = default; virtual void set(std::size_t i, Literal l) = 0; @@ -46,21 +46,21 @@ class RuntimeTable { // True iff this is a subtype of the definition `other`. i.e. This table can // be imported with the definition of `other` virtual bool isSubType(const Table& other) { - return tableMeta_.addressType == other.addressType && - Type::isSubType(tableMeta_.type, other.type) && - size() >= other.initial && tableMeta_.max <= other.max; + return tableDefinition.addressType == other.addressType && + Type::isSubType(tableDefinition.type, other.type) && + size() >= other.initial && tableDefinition.max <= other.max; } - const Table* tableMeta() const { return &tableMeta_; } + const Table* getDefinition() const { return &tableDefinition; } protected: - const Table tableMeta_; + const Table tableDefinition; }; class RealRuntimeTable : public RuntimeTable { public: RealRuntimeTable(Literal initial, Table table_) : RuntimeTable(table_) { - table.resize(tableMeta_.initial, initial); + table.resize(tableDefinition.initial, initial); } RealRuntimeTable(const RealRuntimeTable&) = delete; diff --git a/src/tools/wasm-ctor-eval.cpp b/src/tools/wasm-ctor-eval.cpp index 7a3ca3b6272..fb57865999d 100644 --- a/src/tools/wasm-ctor-eval.cpp +++ b/src/tools/wasm-ctor-eval.cpp @@ -110,7 +110,7 @@ class EvallingRuntimeTable : public RuntimeTable { // so we want the last one. Expression* value = nullptr; for (auto& segment : wasm.elementSegments) { - if (segment->table != tableMeta_.name) { + if (segment->table != tableDefinition.name) { continue; } @@ -157,7 +157,7 @@ class EvallingRuntimeTable : public RuntimeTable { std::size_t size() const override { // See set() above, we assume the table is not modified FIXME - return tableMeta_.initial; + return tableDefinition.initial; } private: diff --git a/src/wasm-interpreter.h b/src/wasm-interpreter.h index 3b2c5d8b7ff..4f979817226 100644 --- a/src/wasm-interpreter.h +++ b/src/wasm-interpreter.h @@ -3415,7 +3415,7 @@ class ModuleRunnerBase : public ExpressionRunner { if (!importedTable->isSubType(**tableDecl)) { trap( (std::stringstream() - << "Imported table " << importedTable->tableMeta() + << "Imported table " << importedTable->getDefinition() << " with size " << importedTable->size() << " isn't compatible with import declaration: " << **tableDecl) .str()); @@ -3858,7 +3858,7 @@ class ModuleRunnerBase : public ExpressionRunner { Flow visitTableSize(TableSize* curr) { auto* table = allTables[curr->table]; return Literal::makeFromInt64(static_cast(table->size()), - table->tableMeta()->addressType); + table->getDefinition()->addressType); } Flow visitTableGrow(TableGrow* curr) { @@ -3868,10 +3868,11 @@ class ModuleRunnerBase : public ExpressionRunner { auto* table = allTables[curr->table]; if (auto newSize = table->grow(deltaFlow.getSingleValue().getUnsigned(), valueFlow.getSingleValue())) { - return Literal::makeFromInt64(*newSize, table->tableMeta()->addressType); + return Literal::makeFromInt64(*newSize, + table->getDefinition()->addressType); } - return Literal::makeFromInt64(-1, table->tableMeta()->addressType); + return Literal::makeFromInt64(-1, table->getDefinition()->addressType); } Flow visitTableFill(TableFill* curr) {