Skip to content

wasm-smith: add support for generating instructions from the threads proposal #2384

@fitzgen

Description

@fitzgen

Right now, wasm_smith::Config::threads_enabled only configures whether we will generate shared memories or not. We should also emit atomic instructions and wait/notify instructions.

The instructions we should support: https://webassembly.github.io/threads/core/syntax/instructions.html#syntax-instr-atomic-memory

The place we need to add that support:

// The static set of options of instruction to generate that could be valid at
// some given time. One entry per Wasm instruction.
//
// Each entry is made up of up to three parts:
//
// 1. A predicate for whether this is a valid choice, if any. `None` means that
// the choice is always applicable.
//
// 2. The function to generate the instruction, given that we've made this
// choice.
//
// 3. The `InstructionKind` the instruction belongs to; this allows filtering
// out instructions by category.
//
// 4. An optional number used to weight how often this instruction is chosen.
// Higher numbers are less likely to be chosen, and number specified must be
// less than 1000.
instructions! {

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueGood for newcomerswasm-smithRelated to the wasm-smith crate and creating wasm modules for fuzzing

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions