diff options
Diffstat (limited to 'src/wasm/wasm-binary.cpp')
-rw-r--r-- | src/wasm/wasm-binary.cpp | 66 |
1 files changed, 33 insertions, 33 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; |