Skip to content

Add Config::without_compiler#12089

Merged
alexcrichton merged 3 commits into
bytecodealliance:mainfrom
fitzgen:config-without-compiler
Dec 3, 2025
Merged

Add Config::without_compiler#12089
alexcrichton merged 3 commits into
bytecodealliance:mainfrom
fitzgen:config-without-compiler

Conversation

@fitzgen

@fitzgen fitzgen commented Nov 25, 2025

Copy link
Copy Markdown
Member

This provides us an allocation-free path for constructing a Config.

Why not rely on builds when cfg(not(any(feature = "cranelift", feature = "winch")))? Because we need to test our various OOM-handling and allocation-free code paths in this workspace, and without some way to create a config without a compiler otherwise, cargo's feature resolver will enable those features in the workspace, enabling the compiler in the config, but we don't intend to make compiler configurations handle OOM.

This provides us an allocation-free path for constructing a `Config`.

Why not rely on builds when `cfg(not(any(feature = "cranelift", feature =
"winch")))`? Because we need to test our various OOM-handling and
allocation-free code paths in this workspace, and without some way to create a
config without a compiler otherwise, cargo's feature resolver will enable those
features in the workspace, enabling the compiler in the config, but we don't
intend to make compiler configurations handle OOM.
@fitzgen
fitzgen requested review from a team as code owners November 25, 2025 19:22
@fitzgen
fitzgen requested review from alexcrichton and removed request for a team November 25, 2025 19:22

@alexcrichton alexcrichton left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bikeshed on this: WDYT about:

  • Leave Config::new as the only constructor
  • Add a Config::enable_compiler(&mut self, bool) method
  • Defer the default Cranelift configuration to happening in build_compiler

That way we keep just a single constructor and this, in theory, would still compose well with other options. (and try_compiler would still remain)

@github-actions github-actions Bot added fuzzing Issues related to our fuzzing infrastructure wasmtime:api Related to the API of the `wasmtime` crate itself wasmtime:config Issues related to the configuration of Wasmtime labels Nov 25, 2025
@github-actions

Copy link
Copy Markdown

Subscribe to Label Action

cc @fitzgen

Details This issue or pull request has been labeled: "fuzzing", "wasmtime:api", "wasmtime:config"

Thus the following users have been cc'd because of the following labels:

  • fitzgen: fuzzing

To subscribe or unsubscribe from this label, edit the .github/subscribe-to-label.json configuration file.

Learn more.

@github-actions

Copy link
Copy Markdown

Label Messager: wasmtime:config

It looks like you are changing Wasmtime's configuration options. Make sure to
complete this check list:

  • If you added a new Config method, you wrote extensive documentation for
    it.

    Details

    Our documentation should be of the following form:

    Short, simple summary sentence.
    
    More details. These details can be multiple paragraphs. There should be
    information about not just the method, but its parameters and results as
    well.
    
    Is this method fallible? If so, when can it return an error?
    
    Can this method panic? If so, when does it panic?
    
    # Example
    
    Optional example here.
    
  • If you added a new Config method, or modified an existing one, you
    ensured that this configuration is exercised by the fuzz targets.

    Details

    For example, if you expose a new strategy for allocating the next instance
    slot inside the pooling allocator, you should ensure that at least one of our
    fuzz targets exercises that new strategy.

    Often, all that is required of you is to ensure that there is a knob for this
    configuration option in wasmtime_fuzzing::Config (or one
    of its nested structs).

    Rarely, this may require authoring a new fuzz target to specifically test this
    configuration. See our docs on fuzzing for more details.

  • If you are enabling a configuration option by default, make sure that it
    has been fuzzed for at least two weeks before turning it on by default.


Details

To modify this label's message, edit the .github/label-messager/wasmtime-config.md file.

To add new label messages or remove existing label messages, edit the
.github/label-messager.json configuration file.

Learn more.

@fitzgen

fitzgen commented Dec 1, 2025

Copy link
Copy Markdown
Member Author

Defer the default Cranelift configuration to happening in build_compiler

This seems kind of difficult since we don't really know if our defaults were overridden with other Config::cranelift_flag_{enable,set} calls or whatever unless we start doing more introspection on the given flags and duplicating state between Config and the compiler, which feels pretty nasty.

@alexcrichton

alexcrichton commented Dec 1, 2025

Copy link
Copy Markdown
Member

Could the defaults be pushed into the Cranelift/Winch compiler builder then? Adding a new constructor is a really heavy hammer I'd prefer to avoid, so I'd ideally like to push pretty hard on solving the problems of using the existing constructor

@fitzgen
fitzgen requested a review from a team as a code owner December 2, 2025 19:26
@fitzgen
fitzgen requested review from cfallin and removed request for a team December 2, 2025 19:26
@fitzgen

fitzgen commented Dec 2, 2025

Copy link
Copy Markdown
Member Author

Could the defaults be pushed into the Cranelift/Winch compiler builder then? Adding a new constructor is a really heavy hammer I'd prefer to avoid, so I'd ideally like to push pretty hard on solving the problems of using the existing constructor

Done, want to take another look?

@alexcrichton

Copy link
Copy Markdown
Member

Thanks!

@fitzgen
fitzgen added this pull request to the merge queue Dec 2, 2025
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Dec 2, 2025
@alexcrichton
alexcrichton added this pull request to the merge queue Dec 2, 2025
Merged via the queue into bytecodealliance:main with commit 9bb96d5 Dec 3, 2025
45 checks passed
@fitzgen
fitzgen deleted the config-without-compiler branch December 3, 2025 21:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fuzzing Issues related to our fuzzing infrastructure wasmtime:api Related to the API of the `wasmtime` crate itself wasmtime:config Issues related to the configuration of Wasmtime

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants