Skip to content

Commit c4ded27

Browse files
committed
Cut down on serde requirements in wasmtime crate
Remove `derive(Deserialize, Serialize)` for some configuration-based enums to ideally give us more flexibility in the future as to what these are exactly called. I'm not sure of any internal users of these except for one use due to bytecodealliance#9811 which can be switched to using an option-based parser to ensure the same syntax is accepted via `--config` and on the CLI with a flag.
1 parent 2a5c141 commit c4ded27

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

crates/cli-flags/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ wasmtime_option_group! {
9595

9696
/// Enable memory protection keys for the pooling allocator; this can
9797
/// optimize the size of memory slots.
98+
#[serde(deserialize_with = "crate::opt::cli_parse_wrapper")]
9899
pub pooling_memory_protection_keys: Option<wasmtime::MpkEnabled>,
99100

100101
/// Sets an upper limit on how many memory protection keys (MPK) Wasmtime

crates/wasmtime/src/config.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2607,7 +2607,7 @@ impl fmt::Debug for Config {
26072607
///
26082608
/// This is used as an argument to the [`Config::strategy`] method.
26092609
#[non_exhaustive]
2610-
#[derive(PartialEq, Eq, Clone, Debug, Copy, Deserialize)]
2610+
#[derive(PartialEq, Eq, Clone, Debug, Copy)]
26112611
pub enum Strategy {
26122612
/// An indicator that the compilation strategy should be automatically
26132613
/// selected.
@@ -2677,7 +2677,7 @@ impl Strategy {
26772677
/// additional objects. Reference counts are larger than mark bits and
26782678
/// free lists are larger than bump pointers, for example.
26792679
#[non_exhaustive]
2680-
#[derive(PartialEq, Eq, Clone, Debug, Copy, Deserialize)]
2680+
#[derive(PartialEq, Eq, Clone, Debug, Copy)]
26812681
pub enum Collector {
26822682
/// An indicator that the garbage collector should be automatically
26832683
/// selected.
@@ -2777,7 +2777,7 @@ impl Collector {
27772777

27782778
/// Possible optimization levels for the Cranelift codegen backend.
27792779
#[non_exhaustive]
2780-
#[derive(Copy, Clone, Debug, Serialize, Deserialize, Eq, PartialEq)]
2780+
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
27812781
pub enum OptLevel {
27822782
/// No optimizations performed, minimizes compilation time by disabling most
27832783
/// optimizations.
@@ -2791,7 +2791,7 @@ pub enum OptLevel {
27912791

27922792
/// Possible register allocator algorithms for the Cranelift codegen backend.
27932793
#[non_exhaustive]
2794-
#[derive(Copy, Clone, Debug, Serialize, Deserialize, Eq, PartialEq)]
2794+
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
27952795
pub enum RegallocAlgorithm {
27962796
/// Generates the fastest possible code, but may take longer.
27972797
///
@@ -2851,7 +2851,7 @@ pub enum WasmBacktraceDetails {
28512851
}
28522852

28532853
/// Describe the tri-state configuration of memory protection keys (MPK).
2854-
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash, Deserialize)]
2854+
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)]
28552855
pub enum MpkEnabled {
28562856
/// Use MPK if supported by the current system; fall back to guard regions
28572857
/// otherwise.

0 commit comments

Comments
 (0)