summaryrefslogtreecommitdiff
path: root/src/wasm
diff options
context:
space:
mode:
Diffstat (limited to 'src/wasm')
-rw-r--r--src/wasm/wasm-binary.cpp66
-rw-r--r--src/wasm/wasm-emscripten.cpp42
-rw-r--r--src/wasm/wasm-s-parser.cpp24
-rw-r--r--src/wasm/wasm-validator.cpp31
-rw-r--r--src/wasm/wasm.cpp20
5 files changed, 93 insertions, 90 deletions
diff --git a/src/wasm/wasm-binary.cpp b/src/wasm/wasm-binary.cpp
index 8d0581312..d8ce18de5 100644
--- a/src/wasm/wasm-binary.cpp
+++ b/src/wasm/wasm-binary.cpp
@@ -1798,8 +1798,8 @@ Expression* WasmBinaryBuilder::popNonVoidExpression() {
auto type = block->list[0]->type;
if (isConcreteType(type)) {
auto local = builder.addVar(currFunction, type);
- block->list[0] = builder.makeSetLocal(local, block->list[0]);
- block->list.push_back(builder.makeGetLocal(local, type));
+ block->list[0] = builder.makeLocalSet(local, block->list[0]);
+ block->list.push_back(builder.makeLocalGet(local, type));
} else {
assert(type == unreachable);
// nothing to do here - unreachable anyhow
@@ -2109,7 +2109,7 @@ BinaryConsts::ASTNodes WasmBinaryBuilder::readExpression(Expression*& curr) {
case BinaryConsts::BrIf:
visitBreak((curr = allocator.alloc<Break>())->cast<Break>(), code);
break; // code distinguishes br from br_if
- case BinaryConsts::TableSwitch:
+ case BinaryConsts::BrTable:
visitSwitch((curr = allocator.alloc<Switch>())->cast<Switch>());
break;
case BinaryConsts::CallFunction:
@@ -2119,19 +2119,19 @@ BinaryConsts::ASTNodes WasmBinaryBuilder::readExpression(Expression*& curr) {
visitCallIndirect(
(curr = allocator.alloc<CallIndirect>())->cast<CallIndirect>());
break;
- case BinaryConsts::GetLocal:
- visitGetLocal((curr = allocator.alloc<GetLocal>())->cast<GetLocal>());
+ case BinaryConsts::LocalGet:
+ visitLocalGet((curr = allocator.alloc<LocalGet>())->cast<LocalGet>());
break;
- case BinaryConsts::TeeLocal:
- case BinaryConsts::SetLocal:
- visitSetLocal((curr = allocator.alloc<SetLocal>())->cast<SetLocal>(),
+ case BinaryConsts::LocalTee:
+ case BinaryConsts::LocalSet:
+ visitLocalSet((curr = allocator.alloc<LocalSet>())->cast<LocalSet>(),
code);
break;
- case BinaryConsts::GetGlobal:
- visitGetGlobal((curr = allocator.alloc<GetGlobal>())->cast<GetGlobal>());
+ case BinaryConsts::GlobalGet:
+ visitGlobalGet((curr = allocator.alloc<GlobalGet>())->cast<GlobalGet>());
break;
- case BinaryConsts::SetGlobal:
- visitSetGlobal((curr = allocator.alloc<SetGlobal>())->cast<SetGlobal>());
+ case BinaryConsts::GlobalSet:
+ visitGlobalSet((curr = allocator.alloc<GlobalSet>())->cast<GlobalSet>());
break;
case BinaryConsts::Select:
visitSelect((curr = allocator.alloc<Select>())->cast<Select>());
@@ -2302,8 +2302,8 @@ void WasmBinaryBuilder::pushBlockElements(Block* curr,
Builder builder(wasm);
auto* item = curr->list[consumable]->cast<Drop>()->value;
auto temp = builder.addVar(currFunction, item->type);
- curr->list[consumable] = builder.makeSetLocal(temp, item);
- curr->list.push_back(builder.makeGetLocal(temp, item->type));
+ curr->list[consumable] = builder.makeLocalSet(temp, item);
+ curr->list.push_back(builder.makeLocalGet(temp, item->type));
}
}
@@ -2544,9 +2544,9 @@ void WasmBinaryBuilder::visitCallIndirect(CallIndirect* curr) {
curr->finalize();
}
-void WasmBinaryBuilder::visitGetLocal(GetLocal* curr) {
+void WasmBinaryBuilder::visitLocalGet(LocalGet* curr) {
if (debug) {
- std::cerr << "zz node: GetLocal " << pos << std::endl;
+ std::cerr << "zz node: LocalGet " << pos << std::endl;
}
requireFunctionContext("local.get");
curr->index = getU32LEB();
@@ -2557,9 +2557,9 @@ void WasmBinaryBuilder::visitGetLocal(GetLocal* curr) {
curr->finalize();
}
-void WasmBinaryBuilder::visitSetLocal(SetLocal* curr, uint8_t code) {
+void WasmBinaryBuilder::visitLocalSet(LocalSet* curr, uint8_t code) {
if (debug) {
- std::cerr << "zz node: Set|TeeLocal" << std::endl;
+ std::cerr << "zz node: Set|LocalTee" << std::endl;
}
requireFunctionContext("local.set outside of function");
curr->index = getU32LEB();
@@ -2568,22 +2568,22 @@ void WasmBinaryBuilder::visitSetLocal(SetLocal* curr, uint8_t code) {
}
curr->value = popNonVoidExpression();
curr->type = curr->value->type;
- curr->setTee(code == BinaryConsts::TeeLocal);
+ curr->setTee(code == BinaryConsts::LocalTee);
curr->finalize();
}
-void WasmBinaryBuilder::visitGetGlobal(GetGlobal* curr) {
+void WasmBinaryBuilder::visitGlobalGet(GlobalGet* curr) {
if (debug) {
- std::cerr << "zz node: GetGlobal " << pos << std::endl;
+ std::cerr << "zz node: GlobalGet " << pos << std::endl;
}
auto index = getU32LEB();
curr->name = getGlobalName(index);
curr->type = wasm.getGlobal(curr->name)->type;
}
-void WasmBinaryBuilder::visitSetGlobal(SetGlobal* curr) {
+void WasmBinaryBuilder::visitGlobalSet(GlobalSet* curr) {
if (debug) {
- std::cerr << "zz node: SetGlobal" << std::endl;
+ std::cerr << "zz node: GlobalSet" << std::endl;
}
auto index = getU32LEB();
curr->name = getGlobalName(index);
@@ -3177,15 +3177,15 @@ bool WasmBinaryBuilder::maybeVisitUnary(Expression*& out, uint8_t code) {
curr->op = ConvertSInt64ToFloat64;
break;
- case BinaryConsts::I64STruncI32:
+ case BinaryConsts::I64SExtendI32:
curr = allocator.alloc<Unary>();
curr->op = ExtendSInt32;
break;
- case BinaryConsts::I64UTruncI32:
+ case BinaryConsts::I64UExtendI32:
curr = allocator.alloc<Unary>();
curr->op = ExtendUInt32;
break;
- case BinaryConsts::I32ConvertI64:
+ case BinaryConsts::I32WrapI64:
curr = allocator.alloc<Unary>();
curr->op = WrapInt64;
break;
@@ -3232,11 +3232,11 @@ bool WasmBinaryBuilder::maybeVisitUnary(Expression*& out, uint8_t code) {
curr->op = TruncFloat64;
break;
- case BinaryConsts::F32ConvertF64:
+ case BinaryConsts::F32DemoteI64:
curr = allocator.alloc<Unary>();
curr->op = DemoteFloat64;
break;
- case BinaryConsts::F64ConvertF32:
+ case BinaryConsts::F64PromoteF32:
curr = allocator.alloc<Unary>();
curr->op = PromoteFloat32;
break;
@@ -4191,14 +4191,14 @@ void WasmBinaryBuilder::visitReturn(Return* curr) {
bool WasmBinaryBuilder::maybeVisitHost(Expression*& out, uint8_t code) {
Host* curr;
switch (code) {
- case BinaryConsts::CurrentMemory: {
+ case BinaryConsts::MemorySize: {
curr = allocator.alloc<Host>();
- curr->op = CurrentMemory;
+ curr->op = MemorySize;
break;
}
- case BinaryConsts::GrowMemory: {
+ case BinaryConsts::MemoryGrow: {
curr = allocator.alloc<Host>();
- curr->op = GrowMemory;
+ curr->op = MemoryGrow;
curr->operands.resize(1);
curr->operands[0] = popNonVoidExpression();
break;
@@ -4211,7 +4211,7 @@ bool WasmBinaryBuilder::maybeVisitHost(Expression*& out, uint8_t code) {
}
auto reserved = getU32LEB();
if (reserved != 0) {
- throwError("Invalid reserved field on grow_memory/current_memory");
+ throwError("Invalid reserved field on memory.grow/memory.size");
}
curr->finalize();
out = curr;
diff --git a/src/wasm/wasm-emscripten.cpp b/src/wasm/wasm-emscripten.cpp
index cd27c2821..383902971 100644
--- a/src/wasm/wasm-emscripten.cpp
+++ b/src/wasm/wasm-emscripten.cpp
@@ -89,7 +89,7 @@ Expression* EmscriptenGlueGenerator::generateLoadStackPointer() {
if (!stackPointer) {
Fatal() << "stack pointer global not found";
}
- return builder.makeGetGlobal(stackPointer->name, i32);
+ return builder.makeGlobalGet(stackPointer->name, i32);
}
Expression*
@@ -107,7 +107,7 @@ EmscriptenGlueGenerator::generateStoreStackPointer(Expression* value) {
if (!stackPointer) {
Fatal() << "stack pointer global not found";
}
- return builder.makeSetGlobal(stackPointer->name, value);
+ return builder.makeGlobalSet(stackPointer->name, value);
}
void EmscriptenGlueGenerator::generateStackSaveFunction() {
@@ -125,18 +125,18 @@ void EmscriptenGlueGenerator::generateStackAllocFunction() {
Function* function =
builder.makeFunction(STACK_ALLOC, std::move(params), i32, {{"1", i32}});
Expression* loadStack = generateLoadStackPointer();
- GetLocal* getSizeArg = builder.makeGetLocal(0, i32);
+ LocalGet* getSizeArg = builder.makeLocalGet(0, i32);
Binary* sub = builder.makeBinary(SubInt32, loadStack, getSizeArg);
const static uint32_t bitAlignment = 16;
const static uint32_t bitMask = bitAlignment - 1;
Const* subConst = builder.makeConst(Literal(~bitMask));
Binary* maskedSub = builder.makeBinary(AndInt32, sub, subConst);
- SetLocal* teeStackLocal = builder.makeTeeLocal(1, maskedSub);
+ LocalSet* teeStackLocal = builder.makeLocalTee(1, maskedSub);
Expression* storeStack = generateStoreStackPointer(teeStackLocal);
Block* block = builder.makeBlock();
block->list.push_back(storeStack);
- GetLocal* getStackLocal2 = builder.makeGetLocal(1, i32);
+ LocalGet* getStackLocal2 = builder.makeLocalGet(1, i32);
block->list.push_back(getStackLocal2);
block->type = i32;
function->body = block;
@@ -148,7 +148,7 @@ void EmscriptenGlueGenerator::generateStackRestoreFunction() {
std::vector<NameType> params{{"0", i32}};
Function* function =
builder.makeFunction(STACK_RESTORE, std::move(params), none, {});
- GetLocal* getArg = builder.makeGetLocal(0, i32);
+ LocalGet* getArg = builder.makeLocalGet(0, i32);
Expression* store = generateStoreStackPointer(getArg);
function->body = store;
@@ -224,8 +224,8 @@ Function* EmscriptenGlueGenerator::generateAssignGOTEntriesFunction() {
Name getter(std::string("g$") + g->base.c_str());
ensureFunctionImport(&wasm, getter, "i");
Expression* call = builder.makeCall(getter, {}, i32);
- SetGlobal* setGlobal = builder.makeSetGlobal(g->name, call);
- block->list.push_back(setGlobal);
+ GlobalSet* globalSet = builder.makeGlobalSet(g->name, call);
+ block->list.push_back(globalSet);
}
for (Global* g : gotFuncEntries) {
@@ -250,8 +250,8 @@ Function* EmscriptenGlueGenerator::generateAssignGOTEntriesFunction() {
.c_str());
ensureFunctionImport(&wasm, getter, "i");
Expression* call = builder.makeCall(getter, {}, i32);
- SetGlobal* setGlobal = builder.makeSetGlobal(g->name, call);
- block->list.push_back(setGlobal);
+ GlobalSet* globalSet = builder.makeGlobalSet(g->name, call);
+ block->list.push_back(globalSet);
}
wasm.addFunction(assignFunc);
@@ -304,7 +304,7 @@ Function* EmscriptenGlueGenerator::generateMemoryGrowthFunction() {
Function* growFunction =
builder.makeFunction(name, std::move(params), i32, {});
growFunction->body =
- builder.makeHost(GrowMemory, Name(), {builder.makeGetLocal(0, i32)});
+ builder.makeHost(MemoryGrow, Name(), {builder.makeLocalGet(0, i32)});
addExportedFunction(wasm, growFunction);
@@ -351,10 +351,10 @@ void EmscriptenGlueGenerator::generateDynCallThunk(std::string sig) {
}
Function* f =
builder.makeFunction(name, std::move(params), funcType->result, {});
- Expression* fptr = builder.makeGetLocal(0, i32);
+ Expression* fptr = builder.makeLocalGet(0, i32);
std::vector<Expression*> args;
for (unsigned i = 0; i < funcType->params.size(); ++i) {
- args.push_back(builder.makeGetLocal(i + 1, funcType->params[i]));
+ args.push_back(builder.makeLocalGet(i + 1, funcType->params[i]));
}
Expression* call = builder.makeCallIndirect(funcType, fptr, args);
f->body = call;
@@ -378,7 +378,7 @@ void EmscriptenGlueGenerator::generateDynCallThunks() {
struct RemoveStackPointer : public PostWalker<RemoveStackPointer> {
RemoveStackPointer(Global* stackPointer) : stackPointer(stackPointer) {}
- void visitGetGlobal(GetGlobal* curr) {
+ void visitGlobalGet(GlobalGet* curr) {
if (getModule()->getGlobalOrNull(curr->name) == stackPointer) {
needStackSave = true;
if (!builder) {
@@ -388,7 +388,7 @@ struct RemoveStackPointer : public PostWalker<RemoveStackPointer> {
}
}
- void visitSetGlobal(SetGlobal* curr) {
+ void visitGlobalSet(GlobalSet* curr) {
if (getModule()->getGlobalOrNull(curr->name) == stackPointer) {
needStackRestore = true;
if (!builder) {
@@ -505,14 +505,14 @@ struct AsmConstWalker : public LinearExecutionWalker<AsmConstWalker> {
std::map<std::string, Address> ids;
std::set<std::string> allSigs;
// last sets in the current basic block, per index
- std::map<Index, SetLocal*> sets;
+ std::map<Index, LocalSet*> sets;
AsmConstWalker(Module& _wasm)
: wasm(_wasm), segmentOffsets(getSegmentOffsets(wasm)) {}
void noteNonLinear(Expression* curr);
- void visitSetLocal(SetLocal* curr);
+ void visitLocalSet(LocalSet* curr);
void visitCall(Call* curr);
void visitTable(Table* curr);
@@ -534,7 +534,7 @@ void AsmConstWalker::noteNonLinear(Expression* curr) {
sets.clear();
}
-void AsmConstWalker::visitSetLocal(SetLocal* curr) { sets[curr->index] = curr; }
+void AsmConstWalker::visitLocalSet(LocalSet* curr) { sets[curr->index] = curr; }
void AsmConstWalker::visitCall(Call* curr) {
auto* import = wasm.getFunction(curr->target);
@@ -545,7 +545,7 @@ void AsmConstWalker::visitCall(Call* curr) {
auto sig = fixupNameWithSig(curr->target, baseSig);
auto* arg = curr->operands[0];
while (!arg->dynCast<Const>()) {
- if (auto* get = arg->dynCast<GetLocal>()) {
+ if (auto* get = arg->dynCast<LocalGet>()) {
// The argument may be a local.get, in which case, the last set in this
// basic block has the value.
auto* set = sets[get->index];
@@ -697,7 +697,7 @@ struct EmJsWalker : public PostWalker<EmJsWalker> {
if (block && block->list.size() > 0) {
value = block->list[0];
// first item may be a set of a local that we get later
- auto* set = value->dynCast<SetLocal>();
+ auto* set = value->dynCast<LocalSet>();
if (set) {
value = block->list[1];
}
@@ -706,7 +706,7 @@ struct EmJsWalker : public PostWalker<EmJsWalker> {
value = ret->value;
}
// if it's a get of that set, use that value
- if (auto* get = value->dynCast<GetLocal>()) {
+ if (auto* get = value->dynCast<LocalGet>()) {
if (set && get->index == set->index) {
value = set->value;
}
diff --git a/src/wasm/wasm-s-parser.cpp b/src/wasm/wasm-s-parser.cpp
index 6e9986bb1..b93165716 100644
--- a/src/wasm/wasm-s-parser.cpp
+++ b/src/wasm/wasm-s-parser.cpp
@@ -917,9 +917,9 @@ Expression* SExpressionWasmBuilder::makeHost(Element& s, HostOp op) {
auto ret = allocator.alloc<Host>();
ret->op = op;
parseCallOperands(s, 1, s.size(), ret);
- if (ret->op == HostOp::GrowMemory) {
+ if (ret->op == HostOp::MemoryGrow) {
if (ret->operands.size() != 1) {
- throw ParseException("grow_memory needs one operand");
+ throw ParseException("memory.grow needs one operand");
}
} else {
if (ret->operands.size() != 0) {
@@ -949,15 +949,15 @@ Index SExpressionWasmBuilder::getLocalIndex(Element& s) {
return ret;
}
-Expression* SExpressionWasmBuilder::makeGetLocal(Element& s) {
- auto ret = allocator.alloc<GetLocal>();
+Expression* SExpressionWasmBuilder::makeLocalGet(Element& s) {
+ auto ret = allocator.alloc<LocalGet>();
ret->index = getLocalIndex(*s[1]);
ret->type = currFunction->getLocalType(ret->index);
return ret;
}
-Expression* SExpressionWasmBuilder::makeTeeLocal(Element& s) {
- auto ret = allocator.alloc<SetLocal>();
+Expression* SExpressionWasmBuilder::makeLocalTee(Element& s) {
+ auto ret = allocator.alloc<LocalSet>();
ret->index = getLocalIndex(*s[1]);
ret->value = parseExpression(s[2]);
ret->setTee(true);
@@ -965,8 +965,8 @@ Expression* SExpressionWasmBuilder::makeTeeLocal(Element& s) {
return ret;
}
-Expression* SExpressionWasmBuilder::makeSetLocal(Element& s) {
- auto ret = allocator.alloc<SetLocal>();
+Expression* SExpressionWasmBuilder::makeLocalSet(Element& s) {
+ auto ret = allocator.alloc<LocalSet>();
ret->index = getLocalIndex(*s[1]);
ret->value = parseExpression(s[2]);
ret->setTee(false);
@@ -974,8 +974,8 @@ Expression* SExpressionWasmBuilder::makeSetLocal(Element& s) {
return ret;
}
-Expression* SExpressionWasmBuilder::makeGetGlobal(Element& s) {
- auto ret = allocator.alloc<GetGlobal>();
+Expression* SExpressionWasmBuilder::makeGlobalGet(Element& s) {
+ auto ret = allocator.alloc<GlobalGet>();
ret->name = getGlobalName(*s[1]);
auto* global = wasm.getGlobalOrNull(ret->name);
if (!global) {
@@ -985,8 +985,8 @@ Expression* SExpressionWasmBuilder::makeGetGlobal(Element& s) {
return ret;
}
-Expression* SExpressionWasmBuilder::makeSetGlobal(Element& s) {
- auto ret = allocator.alloc<SetGlobal>();
+Expression* SExpressionWasmBuilder::makeGlobalSet(Element& s) {
+ auto ret = allocator.alloc<GlobalSet>();
ret->name = getGlobalName(*s[1]);
if (wasm.getGlobalOrNull(ret->name) &&
!wasm.getGlobalOrNull(ret->name)->mutable_) {
diff --git a/src/wasm/wasm-validator.cpp b/src/wasm/wasm-validator.cpp
index 7467f1f15..01fe7e976 100644
--- a/src/wasm/wasm-validator.cpp
+++ b/src/wasm/wasm-validator.cpp
@@ -259,10 +259,10 @@ public:
void visitCall(Call* curr);
void visitCallIndirect(CallIndirect* curr);
void visitConst(Const* curr);
- void visitGetLocal(GetLocal* curr);
- void visitSetLocal(SetLocal* curr);
- void visitGetGlobal(GetGlobal* curr);
- void visitSetGlobal(SetGlobal* curr);
+ void visitLocalGet(LocalGet* curr);
+ void visitLocalSet(LocalSet* curr);
+ void visitGlobalGet(GlobalGet* curr);
+ void visitGlobalSet(GlobalSet* curr);
void visitLoad(Load* curr);
void visitStore(Store* curr);
void visitAtomicRMW(AtomicRMW* curr);
@@ -624,7 +624,7 @@ void FunctionValidator::visitConst(Const* curr) {
"all used features should be allowed");
}
-void FunctionValidator::visitGetLocal(GetLocal* curr) {
+void FunctionValidator::visitLocalGet(LocalGet* curr) {
shouldBeTrue(curr->index < getFunction()->getNumLocals(),
curr,
"local.get index must be small enough");
@@ -637,7 +637,7 @@ void FunctionValidator::visitGetLocal(GetLocal* curr) {
"local.get must have proper type");
}
-void FunctionValidator::visitSetLocal(SetLocal* curr) {
+void FunctionValidator::visitLocalSet(LocalSet* curr) {
shouldBeTrue(curr->index < getFunction()->getNumLocals(),
curr,
"local.set index must be small enough");
@@ -653,7 +653,7 @@ void FunctionValidator::visitSetLocal(SetLocal* curr) {
}
}
-void FunctionValidator::visitGetGlobal(GetGlobal* curr) {
+void FunctionValidator::visitGlobalGet(GlobalGet* curr) {
if (!info.validateGlobally) {
return;
}
@@ -662,7 +662,7 @@ void FunctionValidator::visitGetGlobal(GetGlobal* curr) {
"global.get name must be valid");
}
-void FunctionValidator::visitSetGlobal(SetGlobal* curr) {
+void FunctionValidator::visitGlobalSet(GlobalSet* curr) {
if (!info.validateGlobally) {
return;
}
@@ -1490,19 +1490,21 @@ void FunctionValidator::visitReturn(Return* curr) {
}
void FunctionValidator::visitHost(Host* curr) {
+ shouldBeTrue(
+ getModule()->memory.exists, curr, "Memory operations require a memory");
switch (curr->op) {
- case GrowMemory: {
+ case MemoryGrow: {
shouldBeEqual(curr->operands.size(),
size_t(1),
curr,
- "grow_memory must have 1 operand");
+ "memory.grow must have 1 operand");
shouldBeEqualOrFirstIsUnreachable(curr->operands[0]->type,
i32,
curr,
- "grow_memory must have i32 operand");
+ "memory.grow must have i32 operand");
break;
}
- case CurrentMemory:
+ case MemorySize:
break;
}
}
@@ -1563,7 +1565,7 @@ void FunctionValidator::visitFunction(Function* curr) {
}
static bool checkOffset(Expression* curr, Address add, Address max) {
- if (curr->is<GetGlobal>()) {
+ if (curr->is<GlobalGet>()) {
return true;
}
auto* c = curr->dynCast<Const>();
@@ -1761,7 +1763,8 @@ static void validateGlobals(Module& module, ValidationInfo& info) {
"all used types should be allowed");
info.shouldBeTrue(
curr->init != nullptr, curr->name, "global init must be non-null");
- info.shouldBeTrue(curr->init->is<Const>() || curr->init->is<GetGlobal>(),
+ assert(curr->init);
+ info.shouldBeTrue(curr->init->is<Const>() || curr->init->is<GlobalGet>(),
curr->name,
"global init must be valid");
if (!info.shouldBeEqual(curr->type,
diff --git a/src/wasm/wasm.cpp b/src/wasm/wasm.cpp
index bf12c22d4..6afc22309 100644
--- a/src/wasm/wasm.cpp
+++ b/src/wasm/wasm.cpp
@@ -102,13 +102,13 @@ const char* getExpressionName(Expression* curr) {
return "call";
case Expression::Id::CallIndirectId:
return "call_indirect";
- case Expression::Id::GetLocalId:
+ case Expression::Id::LocalGetId:
return "local.get";
- case Expression::Id::SetLocalId:
+ case Expression::Id::LocalSetId:
return "local.set";
- case Expression::Id::GetGlobalId:
+ case Expression::Id::GlobalGetId:
return "global.get";
- case Expression::Id::SetGlobalId:
+ case Expression::Id::GlobalSetId:
return "global.set";
case Expression::Id::LoadId:
return "load";
@@ -427,9 +427,9 @@ bool FunctionType::operator==(FunctionType& b) {
}
bool FunctionType::operator!=(FunctionType& b) { return !(*this == b); }
-bool SetLocal::isTee() { return type != none; }
+bool LocalSet::isTee() { return type != none; }
-void SetLocal::setTee(bool is) {
+void LocalSet::setTee(bool is) {
if (is) {
type = value->type;
} else {
@@ -438,7 +438,7 @@ void SetLocal::setTee(bool is) {
finalize(); // type may need to be unreachable
}
-void SetLocal::finalize() {
+void LocalSet::finalize() {
if (value->type == unreachable) {
type = unreachable;
} else if (isTee()) {
@@ -448,7 +448,7 @@ void SetLocal::finalize() {
}
}
-void SetGlobal::finalize() {
+void GlobalSet::finalize() {
if (value->type == unreachable) {
type = unreachable;
}
@@ -797,11 +797,11 @@ void Drop::finalize() {
void Host::finalize() {
switch (op) {
- case CurrentMemory: {
+ case MemorySize: {
type = i32;
break;
}
- case GrowMemory: {
+ case MemoryGrow: {
// if the single operand is not reachable, so are we
if (operands[0]->type == unreachable) {
type = unreachable;