diff options
Diffstat (limited to 'src/tools/fuzzing.h')
-rw-r--r-- | src/tools/fuzzing.h | 41 |
1 files changed, 18 insertions, 23 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); } |