diff options
Diffstat (limited to 'src/tools')
-rw-r--r-- | src/tools/fuzzing.h | 41 | ||||
-rw-r--r-- | src/tools/wasm-ctor-eval.cpp | 2 | ||||
-rw-r--r-- | src/tools/wasm-reduce.cpp | 4 | ||||
-rw-r--r-- | src/tools/wasm2js.cpp | 3 |
4 files changed, 22 insertions, 28 deletions
diff --git a/src/tools/fuzzing.h b/src/tools/fuzzing.h index 63f4b5a85..52a524e29 100644 --- a/src/tools/fuzzing.h +++ b/src/tools/fuzzing.h @@ -348,14 +348,14 @@ private: segment.data[j] = upTo(512); } if (!segment.isPassive) { - segment.offset = builder.makeConst(Literal(int32_t(memCovered))); + segment.offset = builder.makeConst(int32_t(memCovered)); memCovered += segSize; } wasm.memory.segments.push_back(segment); } } else { // init some data - wasm.memory.segments.emplace_back(builder.makeConst(Literal(int32_t(0)))); + wasm.memory.segments.emplace_back(builder.makeConst(int32_t(0))); auto num = upTo(USABLE_MEMORY * 2); for (size_t i = 0; i < num; i++) { auto value = upTo(512); @@ -374,7 +374,7 @@ private: // } std::vector<Expression*> contents; contents.push_back( - builder.makeLocalSet(0, builder.makeConst(Literal(uint32_t(5381))))); + builder.makeLocalSet(0, builder.makeConst(uint32_t(5381)))); for (Index i = 0; i < USABLE_MEMORY; i++) { contents.push_back(builder.makeLocalSet( 0, @@ -384,14 +384,10 @@ private: AddInt32, builder.makeBinary(ShlInt32, builder.makeLocalGet(0, Type::i32), - builder.makeConst(Literal(uint32_t(5)))), + builder.makeConst(uint32_t(5))), builder.makeLocalGet(0, Type::i32)), - builder.makeLoad(1, - false, - i, - 1, - builder.makeConst(Literal(uint32_t(0))), - Type::i32)))); + builder.makeLoad( + 1, false, i, 1, builder.makeConst(uint32_t(0)), Type::i32)))); } contents.push_back(builder.makeLocalGet(0, Type::i32)); auto* body = builder.makeBlock(contents); @@ -405,7 +401,7 @@ private: void setupTable() { wasm.table.exists = true; - wasm.table.segments.emplace_back(builder.makeConst(Literal(int32_t(0)))); + wasm.table.segments.emplace_back(builder.makeConst(int32_t(0))); } std::map<Type, std::vector<Name>> globalsByType; @@ -443,18 +439,17 @@ private: const Name HANG_LIMIT_GLOBAL = "hangLimit"; void addHangLimitSupport() { - auto* glob = - builder.makeGlobal(HANG_LIMIT_GLOBAL, - Type::i32, - builder.makeConst(Literal(int32_t(HANG_LIMIT))), - Builder::Mutable); + auto* glob = builder.makeGlobal(HANG_LIMIT_GLOBAL, + Type::i32, + builder.makeConst(int32_t(HANG_LIMIT)), + Builder::Mutable); wasm.addGlobal(glob); auto* func = new Function; func->name = "hangLimitInitializer"; func->sig = Signature(Type::none, Type::none); - func->body = builder.makeGlobalSet( - glob->name, builder.makeConst(Literal(int32_t(HANG_LIMIT)))); + func->body = + builder.makeGlobalSet(glob->name, builder.makeConst(int32_t(HANG_LIMIT))); wasm.addFunction(func); auto* export_ = new Export; @@ -486,7 +481,7 @@ private: HANG_LIMIT_GLOBAL, builder.makeBinary(BinaryOp::SubInt32, builder.makeGlobalGet(HANG_LIMIT_GLOBAL, Type::i32), - builder.makeConst(Literal(int32_t(1)))))); + builder.makeConst(int32_t(1))))); } // function generation state @@ -1209,7 +1204,7 @@ private: // going to trap Expression* target; if (!allowOOB || !oneIn(10)) { - target = builder.makeConst(Literal(int32_t(i))); + target = builder.makeConst(int32_t(i)); } else { target = make(Type::i32); } @@ -1312,7 +1307,7 @@ private: // most memory ops will just trap if (!allowOOB || !oneIn(10)) { ret = builder.makeBinary( - AndInt32, ret, builder.makeConst(Literal(int32_t(USABLE_MEMORY - 1)))); + AndInt32, ret, builder.makeConst(int32_t(USABLE_MEMORY - 1))); } return ret; } @@ -2605,8 +2600,8 @@ private: size_t offsetVal = upTo(totalSize); size_t sizeVal = upTo(totalSize - offsetVal); Expression* dest = makePointer(); - Expression* offset = builder.makeConst(Literal(int32_t(offsetVal))); - Expression* size = builder.makeConst(Literal(int32_t(sizeVal))); + Expression* offset = builder.makeConst(int32_t(offsetVal)); + Expression* size = builder.makeConst(int32_t(sizeVal)); return builder.makeMemoryInit(segment, dest, offset, size); } diff --git a/src/tools/wasm-ctor-eval.cpp b/src/tools/wasm-ctor-eval.cpp index 7ef52dd5f..c6734fdc1 100644 --- a/src/tools/wasm-ctor-eval.cpp +++ b/src/tools/wasm-ctor-eval.cpp @@ -316,7 +316,7 @@ private: std::vector<char> temp; Builder builder(*wasm); wasm->memory.segments.push_back( - Memory::Segment(builder.makeConst(Literal(int32_t(0))), temp)); + Memory::Segment(builder.makeConst(int32_t(0)), temp)); } // memory should already have been flattened assert(wasm->memory.segments[0].offset->cast<Const>()->value.getInteger() == diff --git a/src/tools/wasm-reduce.cpp b/src/tools/wasm-reduce.cpp index ab593c76c..029b9092d 100644 --- a/src/tools/wasm-reduce.cpp +++ b/src/tools/wasm-reduce.cpp @@ -982,7 +982,7 @@ struct Reducer if (condition->is<Const>()) { return; } - auto* c = builder->makeConst(Literal(int32_t(0))); + auto* c = builder->makeConst(int32_t(0)); if (!tryToReplaceChild(condition, c)) { c->value = Literal(int32_t(1)); tryToReplaceChild(condition, c); @@ -1019,7 +1019,7 @@ struct Reducer builder->makeConstantExpression(Literal::makeZero(curr->type)); return tryToReplaceCurrent(n); } - Const* c = builder->makeConst(Literal(int32_t(0))); + Const* c = builder->makeConst(int32_t(0)); if (tryToReplaceCurrent(c)) { return true; } diff --git a/src/tools/wasm2js.cpp b/src/tools/wasm2js.cpp index f12d5189d..fb63627a3 100644 --- a/src/tools/wasm2js.cpp +++ b/src/tools/wasm2js.cpp @@ -591,8 +591,7 @@ Ref AssertionEmitter::emitAssertReturnFunc(Builder& wasmBuilder, Expression* body = nullptr; if (e.size() == 2) { if (actual->type == Type::none) { - body = wasmBuilder.blockify(actual, - wasmBuilder.makeConst(Literal(uint32_t(1)))); + body = wasmBuilder.blockify(actual, wasmBuilder.makeConst(uint32_t(1))); } else { body = actual; } |