Skip to content

Commit 5817346

Browse files
Rename tableMeta to getDefinition
1 parent 0a3f4b1 commit 5817346

File tree

4 files changed

+15
-14
lines changed

4 files changed

+15
-14
lines changed

src/ir/runtime-table.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ std::optional<std::size_t> RealRuntimeTable::grow(std::size_t delta,
5656
return std::nullopt;
5757
}
5858

59-
if (newSize > WebLimitations::MaxTableSize || newSize > tableMeta_.max) {
59+
if (newSize > WebLimitations::MaxTableSize || newSize > tableDefinition.max) {
6060
return std::nullopt;
6161
}
6262

src/ir/runtime-table.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ namespace wasm {
3030
// out-of-bounds access.
3131
class RuntimeTable {
3232
public:
33-
RuntimeTable(Table table) : tableMeta_(table) {}
33+
RuntimeTable(Table table) : tableDefinition(table) {}
3434
virtual ~RuntimeTable() = default;
3535

3636
virtual void set(std::size_t i, Literal l) = 0;
@@ -46,21 +46,21 @@ class RuntimeTable {
4646
// True iff this is a subtype of the definition `other`. i.e. This table can
4747
// be imported with the definition of `other`
4848
virtual bool isSubType(const Table& other) {
49-
return tableMeta_.addressType == other.addressType &&
50-
Type::isSubType(tableMeta_.type, other.type) &&
51-
size() >= other.initial && tableMeta_.max <= other.max;
49+
return tableDefinition.addressType == other.addressType &&
50+
Type::isSubType(tableDefinition.type, other.type) &&
51+
size() >= other.initial && tableDefinition.max <= other.max;
5252
}
5353

54-
const Table* tableMeta() const { return &tableMeta_; }
54+
const Table* getDefinition() const { return &tableDefinition; }
5555

5656
protected:
57-
const Table tableMeta_;
57+
const Table tableDefinition;
5858
};
5959

6060
class RealRuntimeTable : public RuntimeTable {
6161
public:
6262
RealRuntimeTable(Literal initial, Table table_) : RuntimeTable(table_) {
63-
table.resize(tableMeta_.initial, initial);
63+
table.resize(tableDefinition.initial, initial);
6464
}
6565

6666
RealRuntimeTable(const RealRuntimeTable&) = delete;

src/tools/wasm-ctor-eval.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ class EvallingRuntimeTable : public RuntimeTable {
110110
// so we want the last one.
111111
Expression* value = nullptr;
112112
for (auto& segment : wasm.elementSegments) {
113-
if (segment->table != tableMeta_.name) {
113+
if (segment->table != tableDefinition.name) {
114114
continue;
115115
}
116116

@@ -157,7 +157,7 @@ class EvallingRuntimeTable : public RuntimeTable {
157157

158158
std::size_t size() const override {
159159
// See set() above, we assume the table is not modified FIXME
160-
return tableMeta_.initial;
160+
return tableDefinition.initial;
161161
}
162162

163163
private:

src/wasm-interpreter.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3415,7 +3415,7 @@ class ModuleRunnerBase : public ExpressionRunner<SubType> {
34153415
if (!importedTable->isSubType(**tableDecl)) {
34163416
trap(
34173417
(std::stringstream()
3418-
<< "Imported table " << importedTable->tableMeta()
3418+
<< "Imported table " << importedTable->getDefinition()
34193419
<< " with size " << importedTable->size()
34203420
<< " isn't compatible with import declaration: " << **tableDecl)
34213421
.str());
@@ -3858,7 +3858,7 @@ class ModuleRunnerBase : public ExpressionRunner<SubType> {
38583858
Flow visitTableSize(TableSize* curr) {
38593859
auto* table = allTables[curr->table];
38603860
return Literal::makeFromInt64(static_cast<int64_t>(table->size()),
3861-
table->tableMeta()->addressType);
3861+
table->getDefinition()->addressType);
38623862
}
38633863

38643864
Flow visitTableGrow(TableGrow* curr) {
@@ -3868,10 +3868,11 @@ class ModuleRunnerBase : public ExpressionRunner<SubType> {
38683868
auto* table = allTables[curr->table];
38693869
if (auto newSize = table->grow(deltaFlow.getSingleValue().getUnsigned(),
38703870
valueFlow.getSingleValue())) {
3871-
return Literal::makeFromInt64(*newSize, table->tableMeta()->addressType);
3871+
return Literal::makeFromInt64(*newSize,
3872+
table->getDefinition()->addressType);
38723873
}
38733874

3874-
return Literal::makeFromInt64(-1, table->tableMeta()->addressType);
3875+
return Literal::makeFromInt64(-1, table->getDefinition()->addressType);
38753876
}
38763877

38773878
Flow visitTableFill(TableFill* curr) {

0 commit comments

Comments
 (0)