Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 6 additions & 23 deletions src/tools/fuzzing.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,12 @@ class TranslateToFuzzReader {
static constexpr size_t Important = 2;

public:
TranslateToFuzzReader(Module& wasm,
TranslateToFuzzReader(FuzzParams fuzzParams_,
Module& wasm,
std::vector<char>&& input,
WorldMode worldMode = WorldMode::Open);
TranslateToFuzzReader(Module& wasm,
TranslateToFuzzReader(FuzzParams fuzzParams_,
Module& wasm,
std::string& filename,
WorldMode worldMode = WorldMode::Open);

Expand All @@ -138,6 +140,8 @@ class TranslateToFuzzReader {

void build();

FuzzParams fuzzParams;

Module& wasm;

private:
Expand Down Expand Up @@ -276,27 +280,6 @@ class TranslateToFuzzReader {

FunctionCreationContext* funcContext = nullptr;

// The fuzzing parameters we use. This may change from function to function or
// even in a more refined manner, so we use an RAII context to manage it.
struct FuzzParamsContext : public FuzzParams {
TranslateToFuzzReader& parent;

FuzzParamsContext* old;

FuzzParamsContext(TranslateToFuzzReader& parent)
: parent(parent), old(parent.fuzzParams) {
parent.fuzzParams = this;
}

~FuzzParamsContext() { parent.fuzzParams = old; }
};

FuzzParamsContext* fuzzParams = nullptr;

// The default global context we use throughout the process (unless it is
// overridden using another context in an RAII manner).
std::unique_ptr<FuzzParamsContext> globalParams;

const std::vector<MemoryOrder> atomicMemoryOrders;

public:
Expand Down
Loading
Loading