Coverage Report

Created: 2021-03-22 08:29

/rust/registry/src/github.com-1ecc6299db9ec823/wasm-smith-0.4.0/src/encode.rs
Line
Count
Source (jump to first uncovered line)
1
use super::*;
2
use std::convert::TryFrom;
3
4
impl Module {
5
    /// Encode this Wasm module into bytes.
6
10.4k
    pub fn to_bytes(&self) -> Vec<u8> {
7
10.4k
        self.inner.to_bytes()
8
10.4k
    }
9
}
10
11
impl<C> ConfiguredModule<C>
12
where
13
    C: Config,
14
{
15
    /// Encode this Wasm module into bytes.
16
40.4k
    pub fn to_bytes(&self) -> Vec<u8> {
17
40.4k
        self.encoded().finish()
18
40.4k
    }
<wasm_smith::ConfiguredModule<wasmtime_fuzzing::oracles::DifferentialWasmiModuleConfig>>::to_bytes
Line
Count
Source
16
30.0k
    pub fn to_bytes(&self) -> Vec<u8> {
17
30.0k
        self.encoded().finish()
18
30.0k
    }
<wasm_smith::ConfiguredModule<wasm_smith::config::DefaultConfig>>::to_bytes
Line
Count
Source
16
10.4k
    pub fn to_bytes(&self) -> Vec<u8> {
17
10.4k
        self.encoded().finish()
18
10.4k
    }
19
20
40.4k
    fn encoded(&self) -> wasm_encoder::Module {
21
40.4k
        let mut module = wasm_encoder::Module::new();
22
40.4k
23
40.4k
        self.encode_initializers(&mut module);
24
40.4k
        self.encode_funcs(&mut module);
25
40.4k
        self.encode_tables(&mut module);
26
40.4k
        self.encode_memories(&mut module);
27
40.4k
        self.encode_globals(&mut module);
28
40.4k
        self.encode_exports(&mut module);
29
40.4k
        self.encode_start(&mut module);
30
40.4k
        self.encode_elems(&mut module);
31
40.4k
        self.encode_data_count(&mut module);
32
40.4k
        self.encode_code(&mut module);
33
40.4k
        self.encode_data(&mut module);
34
40.4k
35
40.4k
        module
36
40.4k
    }
<wasm_smith::ConfiguredModule<wasmtime_fuzzing::oracles::DifferentialWasmiModuleConfig>>::encoded
Line
Count
Source
20
30.0k
    fn encoded(&self) -> wasm_encoder::Module {
21
30.0k
        let mut module = wasm_encoder::Module::new();
22
30.0k
23
30.0k
        self.encode_initializers(&mut module);
24
30.0k
        self.encode_funcs(&mut module);
25
30.0k
        self.encode_tables(&mut module);
26
30.0k
        self.encode_memories(&mut module);
27
30.0k
        self.encode_globals(&mut module);
28
30.0k
        self.encode_exports(&mut module);
29
30.0k
        self.encode_start(&mut module);
30
30.0k
        self.encode_elems(&mut module);
31
30.0k
        self.encode_data_count(&mut module);
32
30.0k
        self.encode_code(&mut module);
33
30.0k
        self.encode_data(&mut module);
34
30.0k
35
30.0k
        module
36
30.0k
    }
<wasm_smith::ConfiguredModule<wasm_smith::config::DefaultConfig>>::encoded
Line
Count
Source
20
10.4k
    fn encoded(&self) -> wasm_encoder::Module {
21
10.4k
        let mut module = wasm_encoder::Module::new();
22
10.4k
23
10.4k
        self.encode_initializers(&mut module);
24
10.4k
        self.encode_funcs(&mut module);
25
10.4k
        self.encode_tables(&mut module);
26
10.4k
        self.encode_memories(&mut module);
27
10.4k
        self.encode_globals(&mut module);
28
10.4k
        self.encode_exports(&mut module);
29
10.4k
        self.encode_start(&mut module);
30
10.4k
        self.encode_elems(&mut module);
31
10.4k
        self.encode_data_count(&mut module);
32
10.4k
        self.encode_code(&mut module);
33
10.4k
        self.encode_data(&mut module);
34
10.4k
35
10.4k
        module
36
10.4k
    }
37
38
40.4k
    fn encode_initializers(&self, module: &mut wasm_encoder::Module) {
39
57.5k
        for init in self.initial_sections.iter() {
40
57.5k
            match init {
41
39.2k
                InitialSection::Type(types) => self.encode_types(module, types),
42
18.2k
                InitialSection::Import(imports) => self.encode_imports(module, imports),
43
0
                InitialSection::Alias(aliases) => self.encode_aliases(module, aliases),
44
0
                InitialSection::Instance(list) => self.encode_instances(module, list),
45
0
                InitialSection::Module(list) => self.encode_modules(module, list),
46
            }
47
        }
48
40.4k
    }
<wasm_smith::ConfiguredModule<wasmtime_fuzzing::oracles::DifferentialWasmiModuleConfig>>::encode_initializers
Line
Count
Source
38
30.0k
    fn encode_initializers(&self, module: &mut wasm_encoder::Module) {
39
39.4k
        for init in self.initial_sections.iter() {
40
39.4k
            match init {
41
29.0k
                InitialSection::Type(types) => self.encode_types(module, types),
42
10.3k
                InitialSection::Import(imports) => self.encode_imports(module, imports),
43
0
                InitialSection::Alias(aliases) => self.encode_aliases(module, aliases),
44
0
                InitialSection::Instance(list) => self.encode_instances(module, list),
45
0
                InitialSection::Module(list) => self.encode_modules(module, list),
46
            }
47
        }
48
30.0k
    }
<wasm_smith::ConfiguredModule<wasm_smith::config::DefaultConfig>>::encode_initializers
Line
Count
Source
38
10.4k
    fn encode_initializers(&self, module: &mut wasm_encoder::Module) {
39
18.0k
        for init in self.initial_sections.iter() {
40
18.0k
            match init {
41
10.1k
                InitialSection::Type(types) => self.encode_types(module, types),
42
7.89k
                InitialSection::Import(imports) => self.encode_imports(module, imports),
43
0
                InitialSection::Alias(aliases) => self.encode_aliases(module, aliases),
44
0
                InitialSection::Instance(list) => self.encode_instances(module, list),
45
0
                InitialSection::Module(list) => self.encode_modules(module, list),
46
            }
47
        }
48
10.4k
    }
Unexecuted instantiation: <wasm_smith::ConfiguredModule<wasm_smith::config::SwarmConfig>>::encode_initializers
49
50
39.2k
    fn encode_types(&self, module: &mut wasm_encoder::Module, types: &[Type]) {
51
39.2k
        let mut section = wasm_encoder::TypeSection::new();
52
132k
        for ty in types {
53
132k
            match ty {
54
132k
                Type::Func(ty) => {
55
132k
                    section.function(
56
465k
                        ty.params.iter().map(|t| translate_val_type(*t)),
<wasm_smith::ConfiguredModule<wasmtime_fuzzing::oracles::DifferentialWasmiModuleConfig>>::encode_types::{closure#0}
Line
Count
Source
56
228k
                        ty.params.iter().map(|t| translate_val_type(*t)),
<wasm_smith::ConfiguredModule<wasm_smith::config::DefaultConfig>>::encode_types::{closure#0}
Line
Count
Source
56
237k
                        ty.params.iter().map(|t| translate_val_type(*t)),
57
344k
                        ty.results.iter().map(|t| translate_val_type(*t)),
<wasm_smith::ConfiguredModule<wasmtime_fuzzing::oracles::DifferentialWasmiModuleConfig>>::encode_types::{closure#1}
Line
Count
Source
57
90.8k
                        ty.results.iter().map(|t| translate_val_type(*t)),
<wasm_smith::ConfiguredModule<wasm_smith::config::DefaultConfig>>::encode_types::{closure#1}
Line
Count
Source
57
253k
                        ty.results.iter().map(|t| translate_val_type(*t)),
58
132k
                    );
59
132k
                }
60
0
                Type::Module(ty) => {
61
0
                    section.module(
62
0
                        ty.imports.iter().map(|(module, name, ty)| {
63
                            (module.as_str(), name.as_deref(), translate_entity_type(ty))
64
0
                        }),
65
0
                        ty.exports
66
0
                            .exports
67
0
                            .iter()
68
0
                            .map(|(name, ty)| (name.as_str(), translate_entity_type(ty))),
69
0
                    );
70
0
                }
71
0
                Type::Instance(ty) => {
72
0
                    section.instance(
73
0
                        ty.exports
74
0
                            .iter()
75
0
                            .map(|(name, ty)| (name.as_str(), translate_entity_type(ty))),
76
0
                    );
77
0
                }
78
            }
79
        }
80
39.2k
        module.section(&section);
81
39.2k
    }
<wasm_smith::ConfiguredModule<wasmtime_fuzzing::oracles::DifferentialWasmiModuleConfig>>::encode_types
Line
Count
Source
50
29.0k
    fn encode_types(&self, module: &mut wasm_encoder::Module, types: &[Type]) {
51
29.0k
        let mut section = wasm_encoder::TypeSection::new();
52
98.3k
        for ty in types {
53
98.3k
            match ty {
54
98.3k
                Type::Func(ty) => {
55
98.3k
                    section.function(
56
98.3k
                        ty.params.iter().map(|t| translate_val_type(*t)),
57
98.3k
                        ty.results.iter().map(|t| translate_val_type(*t)),
58
98.3k
                    );
59
98.3k
                }
60
0
                Type::Module(ty) => {
61
0
                    section.module(
62
0
                        ty.imports.iter().map(|(module, name, ty)| {
63
                            (module.as_str(), name.as_deref(), translate_entity_type(ty))
64
0
                        }),
65
0
                        ty.exports
66
0
                            .exports
67
0
                            .iter()
68
0
                            .map(|(name, ty)| (name.as_str(), translate_entity_type(ty))),
69
0
                    );
70
0
                }
71
0
                Type::Instance(ty) => {
72
0
                    section.instance(
73
0
                        ty.exports
74
0
                            .iter()
75
0
                            .map(|(name, ty)| (name.as_str(), translate_entity_type(ty))),
76
0
                    );
77
0
                }
78
            }
79
        }
80
29.0k
        module.section(&section);
81
29.0k
    }
<wasm_smith::ConfiguredModule<wasm_smith::config::DefaultConfig>>::encode_types
Line
Count
Source
50
10.1k
    fn encode_types(&self, module: &mut wasm_encoder::Module, types: &[Type]) {
51
10.1k
        let mut section = wasm_encoder::TypeSection::new();
52
34.3k
        for ty in types {
53
34.3k
            match ty {
54
34.3k
                Type::Func(ty) => {
55
34.3k
                    section.function(
56
34.3k
                        ty.params.iter().map(|t| translate_val_type(*t)),
57
34.3k
                        ty.results.iter().map(|t| translate_val_type(*t)),
58
34.3k
                    );
59
34.3k
                }
60
0
                Type::Module(ty) => {
61
0
                    section.module(
62
0
                        ty.imports.iter().map(|(module, name, ty)| {
63
                            (module.as_str(), name.as_deref(), translate_entity_type(ty))
64
0
                        }),
65
0
                        ty.exports
66
0
                            .exports
67
0
                            .iter()
68
0
                            .map(|(name, ty)| (name.as_str(), translate_entity_type(ty))),
69
0
                    );
70
0
                }
71
0
                Type::Instance(ty) => {
72
0
                    section.instance(
73
0
                        ty.exports
74
0
                            .iter()
75
0
                            .map(|(name, ty)| (name.as_str(), translate_entity_type(ty))),
76
0
                    );
77
0
                }
78
            }
79
        }
80
10.1k
        module.section(&section);
81
10.1k
    }
Unexecuted instantiation: <wasm_smith::ConfiguredModule<wasm_smith::config::SwarmConfig>>::encode_types
82
83
18.2k
    fn encode_imports(
84
18.2k
        &self,
85
18.2k
        module: &mut wasm_encoder::Module,
86
18.2k
        imports: &[(String, Option<String>, EntityType)],
87
18.2k
    ) {
88
18.2k
        let mut section = wasm_encoder::ImportSection::new();
89
71.8k
        for (module, name, ty) in imports {
90
53.5k
            section.import(module, name.as_deref(), translate_entity_type(ty));
91
53.5k
        }
92
18.2k
        module.section(&section);
93
18.2k
    }
<wasm_smith::ConfiguredModule<wasmtime_fuzzing::oracles::DifferentialWasmiModuleConfig>>::encode_imports
Line
Count
Source
83
10.3k
    fn encode_imports(
84
10.3k
        &self,
85
10.3k
        module: &mut wasm_encoder::Module,
86
10.3k
        imports: &[(String, Option<String>, EntityType)],
87
10.3k
    ) {
88
10.3k
        let mut section = wasm_encoder::ImportSection::new();
89
10.3k
        for (module, name, ty) in imports {
90
0
            section.import(module, name.as_deref(), translate_entity_type(ty));
91
0
        }
92
10.3k
        module.section(&section);
93
10.3k
    }
<wasm_smith::ConfiguredModule<wasm_smith::config::DefaultConfig>>::encode_imports
Line
Count
Source
83
7.89k
    fn encode_imports(
84
7.89k
        &self,
85
7.89k
        module: &mut wasm_encoder::Module,
86
7.89k
        imports: &[(String, Option<String>, EntityType)],
87
7.89k
    ) {
88
7.89k
        let mut section = wasm_encoder::ImportSection::new();
89
61.4k
        for (module, name, ty) in imports {
90
53.5k
            section.import(module, name.as_deref(), translate_entity_type(ty));
91
53.5k
        }
92
7.89k
        module.section(&section);
93
7.89k
    }
Unexecuted instantiation: <wasm_smith::ConfiguredModule<wasm_smith::config::SwarmConfig>>::encode_imports
94
95
0
    fn encode_aliases(&self, module: &mut wasm_encoder::Module, imports: &[Alias]) {
96
0
        let mut section = wasm_encoder::AliasSection::new();
97
0
        for alias in imports {
98
0
            match alias {
99
                Alias::InstanceExport {
100
0
                    instance,
101
0
                    kind,
102
0
                    name,
103
0
                } => {
104
0
                    section.instance_export(*instance, translate_item_kind(kind), name);
105
0
                }
106
0
                Alias::OuterType { depth, index } => {
107
0
                    section.outer_type(*depth, *index);
108
0
                }
109
0
                Alias::OuterModule { depth, index } => {
110
0
                    section.outer_module(*depth, *index);
111
0
                }
112
            }
113
        }
114
0
        module.section(&section);
115
0
    }
Unexecuted instantiation: <wasm_smith::ConfiguredModule<wasmtime_fuzzing::oracles::DifferentialWasmiModuleConfig>>::encode_aliases
Unexecuted instantiation: <wasm_smith::ConfiguredModule<wasm_smith::config::DefaultConfig>>::encode_aliases
Unexecuted instantiation: <wasm_smith::ConfiguredModule<wasm_smith::config::SwarmConfig>>::encode_aliases
116
117
0
    fn encode_instances(&self, module: &mut wasm_encoder::Module, list: &[Instance]) {
118
0
        let mut section = wasm_encoder::InstanceSection::new();
119
0
        for instance in list {
120
0
            section.instantiate(
121
0
                instance.module,
122
0
                instance
123
0
                    .args
124
0
                    .iter()
125
0
                    .map(|(name, export)| (name.as_str(), translate_export(export))),
126
0
            );
127
0
        }
128
0
        module.section(&section);
129
0
    }
Unexecuted instantiation: <wasm_smith::ConfiguredModule<wasmtime_fuzzing::oracles::DifferentialWasmiModuleConfig>>::encode_instances
Unexecuted instantiation: <wasm_smith::ConfiguredModule<wasm_smith::config::DefaultConfig>>::encode_instances
Unexecuted instantiation: <wasm_smith::ConfiguredModule<wasm_smith::config::SwarmConfig>>::encode_instances
130
131
0
    fn encode_modules(&self, module: &mut wasm_encoder::Module, list: &[Self]) {
132
0
        let mut section = wasm_encoder::ModuleSection::new();
133
0
        for module in list {
134
0
            let encoded = module.encoded();
135
0
            section.module(&encoded);
136
0
        }
137
0
        module.section(&section);
138
0
    }
Unexecuted instantiation: <wasm_smith::ConfiguredModule<wasmtime_fuzzing::oracles::DifferentialWasmiModuleConfig>>::encode_modules
Unexecuted instantiation: <wasm_smith::ConfiguredModule<wasm_smith::config::DefaultConfig>>::encode_modules
Unexecuted instantiation: <wasm_smith::ConfiguredModule<wasm_smith::config::SwarmConfig>>::encode_modules
139
140
40.4k
    fn encode_funcs(&self, module: &mut wasm_encoder::Module) {
141
40.4k
        if self.num_defined_funcs == 0 {
142
3.12k
            return;
143
37.3k
        }
144
37.3k
        let mut funcs = wasm_encoder::FunctionSection::new();
145
167k
        for (ty, _) in self.funcs[self.funcs.len() - self.num_defined_funcs..].iter() {
146
167k
            funcs.function(ty.unwrap());
147
167k
        }
148
37.3k
        module.section(&funcs);
149
40.4k
    }
<wasm_smith::ConfiguredModule<wasmtime_fuzzing::oracles::DifferentialWasmiModuleConfig>>::encode_funcs
Line
Count
Source
140
30.0k
    fn encode_funcs(&self, module: &mut wasm_encoder::Module) {
141
30.0k
        if self.num_defined_funcs == 0 {
142
1.52k
            return;
143
28.4k
        }
144
28.4k
        let mut funcs = wasm_encoder::FunctionSection::new();
145
28.4k
        for (ty, _) in self.funcs[self.funcs.len() - self.num_defined_funcs..].iter() {
146
28.4k
            funcs.function(ty.unwrap());
147
28.4k
        }
148
28.4k
        module.section(&funcs);
149
30.0k
    }
<wasm_smith::ConfiguredModule<wasm_smith::config::DefaultConfig>>::encode_funcs
Line
Count
Source
140
10.4k
    fn encode_funcs(&self, module: &mut wasm_encoder::Module) {
141
10.4k
        if self.num_defined_funcs == 0 {
142
1.59k
            return;
143
8.86k
        }
144
8.86k
        let mut funcs = wasm_encoder::FunctionSection::new();
145
138k
        for (ty, _) in self.funcs[self.funcs.len() - self.num_defined_funcs..].iter() {
146
138k
            funcs.function(ty.unwrap());
147
138k
        }
148
8.86k
        module.section(&funcs);
149
10.4k
    }
Unexecuted instantiation: <wasm_smith::ConfiguredModule<wasm_smith::config::SwarmConfig>>::encode_funcs
150
151
40.4k
    fn encode_tables(&self, module: &mut wasm_encoder::Module) {
152
40.4k
        if self.num_defined_tables == 0 {
153
34.6k
            return;
154
5.86k
        }
155
5.86k
        let mut tables = wasm_encoder::TableSection::new();
156
5.86k
        for t in self.tables[self.tables.len() - self.num_defined_tables..].iter() {
157
5.86k
            tables.table(translate_table_type(t));
158
5.86k
        }
159
5.86k
        module.section(&tables);
160
40.4k
    }
<wasm_smith::ConfiguredModule<wasmtime_fuzzing::oracles::DifferentialWasmiModuleConfig>>::encode_tables
Line
Count
Source
151
30.0k
    fn encode_tables(&self, module: &mut wasm_encoder::Module) {
152
30.0k
        if self.num_defined_tables == 0 {
153
26.8k
            return;
154
3.12k
        }
155
3.12k
        let mut tables = wasm_encoder::TableSection::new();
156
3.12k
        for t in self.tables[self.tables.len() - self.num_defined_tables..].iter() {
157
3.12k
            tables.table(translate_table_type(t));
158
3.12k
        }
159
3.12k
        module.section(&tables);
160
30.0k
    }
<wasm_smith::ConfiguredModule<wasm_smith::config::DefaultConfig>>::encode_tables
Line
Count
Source
151
10.4k
    fn encode_tables(&self, module: &mut wasm_encoder::Module) {
152
10.4k
        if self.num_defined_tables == 0 {
153
7.72k
            return;
154
2.73k
        }
155
2.73k
        let mut tables = wasm_encoder::TableSection::new();
156
2.73k
        for t in self.tables[self.tables.len() - self.num_defined_tables..].iter() {
157
2.73k
            tables.table(translate_table_type(t));
158
2.73k
        }
159
2.73k
        module.section(&tables);
160
10.4k
    }
Unexecuted instantiation: <wasm_smith::ConfiguredModule<wasm_smith::config::SwarmConfig>>::encode_tables
161
162
40.4k
    fn encode_memories(&self, module: &mut wasm_encoder::Module) {
163
40.4k
        if self.num_defined_memories == 0 {
164
6.30k
            return;
165
34.1k
        }
166
34.1k
        let mut mems = wasm_encoder::MemorySection::new();
167
34.1k
        for m in self.memories[self.memories.len() - self.num_defined_memories..].iter() {
168
34.1k
            mems.memory(translate_memory_type(m));
169
34.1k
        }
170
34.1k
        module.section(&mems);
171
40.4k
    }
<wasm_smith::ConfiguredModule<wasmtime_fuzzing::oracles::DifferentialWasmiModuleConfig>>::encode_memories
Line
Count
Source
162
30.0k
    fn encode_memories(&self, module: &mut wasm_encoder::Module) {
163
30.0k
        if self.num_defined_memories == 0 {
164
0
            return;
165
30.0k
        }
166
30.0k
        let mut mems = wasm_encoder::MemorySection::new();
167
30.0k
        for m in self.memories[self.memories.len() - self.num_defined_memories..].iter() {
168
30.0k
            mems.memory(translate_memory_type(m));
169
30.0k
        }
170
30.0k
        module.section(&mems);
171
30.0k
    }
<wasm_smith::ConfiguredModule<wasm_smith::config::DefaultConfig>>::encode_memories
Line
Count
Source
162
10.4k
    fn encode_memories(&self, module: &mut wasm_encoder::Module) {
163
10.4k
        if self.num_defined_memories == 0 {
164
6.30k
            return;
165
4.15k
        }
166
4.15k
        let mut mems = wasm_encoder::MemorySection::new();
167
4.15k
        for m in self.memories[self.memories.len() - self.num_defined_memories..].iter() {
168
4.15k
            mems.memory(translate_memory_type(m));
169
4.15k
        }
170
4.15k
        module.section(&mems);
171
10.4k
    }
Unexecuted instantiation: <wasm_smith::ConfiguredModule<wasm_smith::config::SwarmConfig>>::encode_memories
172
173
40.4k
    fn encode_globals(&self, module: &mut wasm_encoder::Module) {
174
40.4k
        if self.globals.is_empty() {
175
6.38k
            return;
176
34.0k
        }
177
34.0k
        let mut globals = wasm_encoder::GlobalSection::new();
178
129k
        for (idx, expr) in &self.defined_globals {
179
94.9k
            let ty = &self.globals[*idx as usize];
180
94.9k
            globals.global(translate_global_type(ty), translate_instruction(expr));
181
94.9k
        }
182
34.0k
        module.section(&globals);
183
40.4k
    }
<wasm_smith::ConfiguredModule<wasmtime_fuzzing::oracles::DifferentialWasmiModuleConfig>>::encode_globals
Line
Count
Source
173
30.0k
    fn encode_globals(&self, module: &mut wasm_encoder::Module) {
174
30.0k
        if self.globals.is_empty() {
175
0
            return;
176
30.0k
        }
177
30.0k
        let mut globals = wasm_encoder::GlobalSection::new();
178
93.9k
        for (idx, expr) in &self.defined_globals {
179
63.9k
            let ty = &self.globals[*idx as usize];
180
63.9k
            globals.global(translate_global_type(ty), translate_instruction(expr));
181
63.9k
        }
182
30.0k
        module.section(&globals);
183
30.0k
    }
<wasm_smith::ConfiguredModule<wasm_smith::config::DefaultConfig>>::encode_globals
Line
Count
Source
173
10.4k
    fn encode_globals(&self, module: &mut wasm_encoder::Module) {
174
10.4k
        if self.globals.is_empty() {
175
6.38k
            return;
176
4.07k
        }
177
4.07k
        let mut globals = wasm_encoder::GlobalSection::new();
178
35.1k
        for (idx, expr) in &self.defined_globals {
179
31.0k
            let ty = &self.globals[*idx as usize];
180
31.0k
            globals.global(translate_global_type(ty), translate_instruction(expr));
181
31.0k
        }
182
4.07k
        module.section(&globals);
183
10.4k
    }
Unexecuted instantiation: <wasm_smith::ConfiguredModule<wasm_smith::config::SwarmConfig>>::encode_globals
184
185
40.4k
    fn encode_exports(&self, module: &mut wasm_encoder::Module) {
186
40.4k
        if self.exports.is_empty() {
187
40.4k
            return;
188
41
        }
189
41
        let mut exports = wasm_encoder::ExportSection::new();
190
82
        for (name, export) in &self.exports {
191
41
            exports.export(name, translate_export(export));
192
41
        }
193
41
        module.section(&exports);
194
40.4k
    }
<wasm_smith::ConfiguredModule<wasmtime_fuzzing::oracles::DifferentialWasmiModuleConfig>>::encode_exports
Line
Count
Source
185
30.0k
    fn encode_exports(&self, module: &mut wasm_encoder::Module) {
186
30.0k
        if self.exports.is_empty() {
187
30.0k
            return;
188
0
        }
189
0
        let mut exports = wasm_encoder::ExportSection::new();
190
0
        for (name, export) in &self.exports {
191
0
            exports.export(name, translate_export(export));
192
0
        }
193
0
        module.section(&exports);
194
30.0k
    }
<wasm_smith::ConfiguredModule<wasm_smith::config::DefaultConfig>>::encode_exports
Line
Count
Source
185
10.4k
    fn encode_exports(&self, module: &mut wasm_encoder::Module) {
186
10.4k
        if self.exports.is_empty() {
187
10.4k
            return;
188
41
        }
189
41
        let mut exports = wasm_encoder::ExportSection::new();
190
82
        for (name, export) in &self.exports {
191
41
            exports.export(name, translate_export(export));
192
41
        }
193
41
        module.section(&exports);
194
10.4k
    }
Unexecuted instantiation: <wasm_smith::ConfiguredModule<wasm_smith::config::SwarmConfig>>::encode_exports
195
196
    fn encode_start(&self, module: &mut wasm_encoder::Module) {
197
40.4k
        if let Some(f) = self.start {
198
1.75k
            module.section(&wasm_encoder::StartSection { function_index: f });
199
38.7k
        }
200
40.4k
    }
Unexecuted instantiation: <wasm_smith::ConfiguredModule<wasmtime_fuzzing::oracles::DifferentialWasmiModuleConfig>>::encode_start
<wasm_smith::ConfiguredModule<wasm_smith::config::DefaultConfig>>::encode_start
Line
Count
Source
197
10.4k
        if let Some(f) = self.start {
198
1.75k
            module.section(&wasm_encoder::StartSection { function_index: f });
199
8.69k
        }
200
10.4k
    }
Unexecuted instantiation: <wasm_smith::ConfiguredModule<wasm_smith::config::SwarmConfig>>::encode_start
201
202
40.4k
    fn encode_elems(&self, module: &mut wasm_encoder::Module) {
203
40.4k
        if self.elems.is_empty() {
204
37.9k
            return;
205
2.47k
        }
206
2.47k
        let mut elems = wasm_encoder::ElementSection::new();
207
2.47k
        let mut exps = vec![];
208
35.3k
        for el in &self.elems {
209
35.3k
            let elem_ty = translate_val_type(el.ty);
210
35.3k
            let elements = match &el.items {
211
0
                Elements::Expressions(es) => {
212
0
                    exps.clear();
213
0
                    exps.extend(es.iter().map(|e| match e {
214
0
                        Some(i) => wasm_encoder::Element::Func(*i),
215
0
                        None => wasm_encoder::Element::Null,
216
0
                    }));
Unexecuted instantiation: <wasm_smith::ConfiguredModule<wasmtime_fuzzing::oracles::DifferentialWasmiModuleConfig>>::encode_elems::{closure#0}
Unexecuted instantiation: <wasm_smith::ConfiguredModule<wasm_smith::config::DefaultConfig>>::encode_elems::{closure#0}
Unexecuted instantiation: <wasm_smith::ConfiguredModule<wasm_smith::config::SwarmConfig>>::encode_elems::{closure#0}
217
0
                    wasm_encoder::Elements::Expressions(&exps)
218
                }
219
35.3k
                Elements::Functions(fs) => wasm_encoder::Elements::Functions(fs),
220
            };
221
35.3k
            match &el.kind {
222
35.3k
                ElementKind::Active { table, offset } => {
223
35.3k
                    elems.active(*table, translate_instruction(offset), elem_ty, elements);
224
35.3k
                }
225
0
                ElementKind::Passive => {
226
0
                    elems.passive(elem_ty, elements);
227
0
                }
228
0
                ElementKind::Declared => {
229
0
                    elems.declared(elem_ty, elements);
230
0
                }
231
            }
232
        }
233
2.47k
        module.section(&elems);
234
40.4k
    }
<wasm_smith::ConfiguredModule<wasmtime_fuzzing::oracles::DifferentialWasmiModuleConfig>>::encode_elems
Line
Count
Source
202
30.0k
    fn encode_elems(&self, module: &mut wasm_encoder::Module) {
203
30.0k
        if self.elems.is_empty() {
204
28.9k
            return;
205
1.05k
        }
206
1.05k
        let mut elems = wasm_encoder::ElementSection::new();
207
1.05k
        let mut exps = vec![];
208
27.6k
        for el in &self.elems {
209
27.6k
            let elem_ty = translate_val_type(el.ty);
210
27.6k
            let elements = match &el.items {
211
0
                Elements::Expressions(es) => {
212
0
                    exps.clear();
213
0
                    exps.extend(es.iter().map(|e| match e {
214
                        Some(i) => wasm_encoder::Element::Func(*i),
215
                        None => wasm_encoder::Element::Null,
216
0
                    }));
217
0
                    wasm_encoder::Elements::Expressions(&exps)
218
                }
219
27.6k
                Elements::Functions(fs) => wasm_encoder::Elements::Functions(fs),
220
            };
221
27.6k
            match &el.kind {
222
27.6k
                ElementKind::Active { table, offset } => {
223
27.6k
                    elems.active(*table, translate_instruction(offset), elem_ty, elements);
224
27.6k
                }
225
0
                ElementKind::Passive => {
226
0
                    elems.passive(elem_ty, elements);
227
0
                }
228
0
                ElementKind::Declared => {
229
0
                    elems.declared(elem_ty, elements);
230
0
                }
231
            }
232
        }
233
1.05k
        module.section(&elems);
234
30.0k
    }
<wasm_smith::ConfiguredModule<wasm_smith::config::DefaultConfig>>::encode_elems
Line
Count
Source
202
10.4k
    fn encode_elems(&self, module: &mut wasm_encoder::Module) {
203
10.4k
        if self.elems.is_empty() {
204
9.03k
            return;
205
1.42k
        }
206
1.42k
        let mut elems = wasm_encoder::ElementSection::new();
207
1.42k
        let mut exps = vec![];
208
7.72k
        for el in &self.elems {
209
7.72k
            let elem_ty = translate_val_type(el.ty);
210
7.72k
            let elements = match &el.items {
211
0
                Elements::Expressions(es) => {
212
0
                    exps.clear();
213
0
                    exps.extend(es.iter().map(|e| match e {
214
                        Some(i) => wasm_encoder::Element::Func(*i),
215
                        None => wasm_encoder::Element::Null,
216
0
                    }));
217
0
                    wasm_encoder::Elements::Expressions(&exps)
218
                }
219
7.72k
                Elements::Functions(fs) => wasm_encoder::Elements::Functions(fs),
220
            };
221
7.72k
            match &el.kind {
222
7.72k
                ElementKind::Active { table, offset } => {
223
7.72k
                    elems.active(*table, translate_instruction(offset), elem_ty, elements);
224
7.72k
                }
225
0
                ElementKind::Passive => {
226
0
                    elems.passive(elem_ty, elements);
227
0
                }
228
0
                ElementKind::Declared => {
229
0
                    elems.declared(elem_ty, elements);
230
0
                }
231
            }
232
        }
233
1.42k
        module.section(&elems);
234
10.4k
    }
Unexecuted instantiation: <wasm_smith::ConfiguredModule<wasm_smith::config::SwarmConfig>>::encode_elems
235
236
40.4k
    fn encode_data_count(&self, module: &mut wasm_encoder::Module) {
237
        // Without bulk memory there's no need for a data count section,
238
40.4k
        if !self.config.bulk_memory_enabled() {
239
40.4k
            return;
240
0
        }
241
0
        // ... and also if there's no data no need for a data count section.
242
0
        if self.data.is_empty() {
243
0
            return;
244
0
        }
245
0
        module.section(&wasm_encoder::DataCountSection {
246
0
            count: u32::try_from(self.data.len()).unwrap(),
247
0
        });
248
40.4k
    }
<wasm_smith::ConfiguredModule<wasmtime_fuzzing::oracles::DifferentialWasmiModuleConfig>>::encode_data_count
Line
Count
Source
236
30.0k
    fn encode_data_count(&self, module: &mut wasm_encoder::Module) {
237
        // Without bulk memory there's no need for a data count section,
238
30.0k
        if !self.config.bulk_memory_enabled() {
239
30.0k
            return;
240
0
        }
241
0
        // ... and also if there's no data no need for a data count section.
242
0
        if self.data.is_empty() {
243
0
            return;
244
0
        }
245
0
        module.section(&wasm_encoder::DataCountSection {
246
0
            count: u32::try_from(self.data.len()).unwrap(),
247
0
        });
248
30.0k
    }
<wasm_smith::ConfiguredModule<wasm_smith::config::DefaultConfig>>::encode_data_count
Line
Count
Source
236
10.4k
    fn encode_data_count(&self, module: &mut wasm_encoder::Module) {
237
        // Without bulk memory there's no need for a data count section,
238
10.4k
        if !self.config.bulk_memory_enabled() {
239
10.4k
            return;
240
0
        }
241
0
        // ... and also if there's no data no need for a data count section.
242
0
        if self.data.is_empty() {
243
0
            return;
244
0
        }
245
0
        module.section(&wasm_encoder::DataCountSection {
246
0
            count: u32::try_from(self.data.len()).unwrap(),
247
0
        });
248
10.4k
    }
Unexecuted instantiation: <wasm_smith::ConfiguredModule<wasm_smith::config::SwarmConfig>>::encode_data_count
249
250
40.4k
    fn encode_code(&self, module: &mut wasm_encoder::Module) {
251
40.4k
        if self.code.is_empty() {
252
3.12k
            return;
253
37.3k
        }
254
37.3k
        let mut code = wasm_encoder::CodeSection::new();
255
167k
        for c in &self.code {
256
            // Skip the run-length encoding because it is a little
257
            // annoying to compute; use a length of one for every local.
258
167k
            let mut func =
259
591k
                wasm_encoder::Function::new(c.locals.iter().map(|l| (1, translate_val_type(*l))));
<wasm_smith::ConfiguredModule<wasmtime_fuzzing::oracles::DifferentialWasmiModuleConfig>>::encode_code::{closure#0}
Line
Count
Source
259
75.6k
                wasm_encoder::Function::new(c.locals.iter().map(|l| (1, translate_val_type(*l))));
<wasm_smith::ConfiguredModule<wasm_smith::config::DefaultConfig>>::encode_code::{closure#0}
Line
Count
Source
259
515k
                wasm_encoder::Function::new(c.locals.iter().map(|l| (1, translate_val_type(*l))));
260
167k
            match &c.instructions {
261
155k
                Instructions::Generated(instrs) => {
262
4.05M
                    for instr in instrs {
263
4.05M
                        func.instruction(translate_instruction(instr));
264
4.05M
                    }
265
155k
                    func.instruction(wasm_encoder::Instruction::End);
266
                }
267
12.2k
                Instructions::Arbitrary(body) => {
268
12.2k
                    func.raw(body.iter().copied());
269
12.2k
                }
270
            }
271
167k
            code.function(&func);
272
        }
273
37.3k
        module.section(&code);
274
40.4k
    }
<wasm_smith::ConfiguredModule<wasmtime_fuzzing::oracles::DifferentialWasmiModuleConfig>>::encode_code
Line
Count
Source
250
30.0k
    fn encode_code(&self, module: &mut wasm_encoder::Module) {
251
30.0k
        if self.code.is_empty() {
252
1.52k
            return;
253
28.4k
        }
254
28.4k
        let mut code = wasm_encoder::CodeSection::new();
255
28.4k
        for c in &self.code {
256
            // Skip the run-length encoding because it is a little
257
            // annoying to compute; use a length of one for every local.
258
28.4k
            let mut func =
259
28.4k
                wasm_encoder::Function::new(c.locals.iter().map(|l| (1, translate_val_type(*l))));
260
28.4k
            match &c.instructions {
261
28.4k
                Instructions::Generated(instrs) => {
262
3.13M
                    for instr in instrs {
263
3.13M
                        func.instruction(translate_instruction(instr));
264
3.13M
                    }
265
28.4k
                    func.instruction(wasm_encoder::Instruction::End);
266
                }
267
0
                Instructions::Arbitrary(body) => {
268
0
                    func.raw(body.iter().copied());
269
0
                }
270
            }
271
28.4k
            code.function(&func);
272
        }
273
28.4k
        module.section(&code);
274
30.0k
    }
<wasm_smith::ConfiguredModule<wasm_smith::config::DefaultConfig>>::encode_code
Line
Count
Source
250
10.4k
    fn encode_code(&self, module: &mut wasm_encoder::Module) {
251
10.4k
        if self.code.is_empty() {
252
1.59k
            return;
253
8.86k
        }
254
8.86k
        let mut code = wasm_encoder::CodeSection::new();
255
138k
        for c in &self.code {
256
            // Skip the run-length encoding because it is a little
257
            // annoying to compute; use a length of one for every local.
258
138k
            let mut func =
259
138k
                wasm_encoder::Function::new(c.locals.iter().map(|l| (1, translate_val_type(*l))));
260
138k
            match &c.instructions {
261
126k
                Instructions::Generated(instrs) => {
262
916k
                    for instr in instrs {
263
916k
                        func.instruction(translate_instruction(instr));
264
916k
                    }
265
126k
                    func.instruction(wasm_encoder::Instruction::End);
266
                }
267
12.2k
                Instructions::Arbitrary(body) => {
268
12.2k
                    func.raw(body.iter().copied());
269
12.2k
                }
270
            }
271
138k
            code.function(&func);
272
        }
273
8.86k
        module.section(&code);
274
10.4k
    }
Unexecuted instantiation: <wasm_smith::ConfiguredModule<wasm_smith::config::SwarmConfig>>::encode_code
275
276
40.4k
    fn encode_data(&self, module: &mut wasm_encoder::Module) {
277
40.4k
        if self.data.is_empty() {
278
37.6k
            return;
279
2.79k
        }
280
2.79k
        let mut data = wasm_encoder::DataSection::new();
281
14.1k
        for seg in &self.data {
282
14.1k
            match &seg.kind {
283
                DataSegmentKind::Active {
284
14.1k
                    memory_index,
285
14.1k
                    offset,
286
14.1k
                } => {
287
14.1k
                    data.active(
288
14.1k
                        *memory_index,
289
14.1k
                        translate_instruction(offset),
290
14.1k
                        seg.init.iter().copied(),
291
14.1k
                    );
292
14.1k
                }
293
0
                DataSegmentKind::Passive => {
294
0
                    data.passive(seg.init.iter().copied());
295
0
                }
296
            }
297
        }
298
2.79k
        module.section(&data);
299
40.4k
    }
<wasm_smith::ConfiguredModule<wasmtime_fuzzing::oracles::DifferentialWasmiModuleConfig>>::encode_data
Line
Count
Source
276
30.0k
    fn encode_data(&self, module: &mut wasm_encoder::Module) {
277
30.0k
        if self.data.is_empty() {
278
28.4k
            return;
279
1.59k
        }
280
1.59k
        let mut data = wasm_encoder::DataSection::new();
281
9.54k
        for seg in &self.data {
282
9.54k
            match &seg.kind {
283
                DataSegmentKind::Active {
284
9.54k
                    memory_index,
285
9.54k
                    offset,
286
9.54k
                } => {
287
9.54k
                    data.active(
288
9.54k
                        *memory_index,
289
9.54k
                        translate_instruction(offset),
290
9.54k
                        seg.init.iter().copied(),
291
9.54k
                    );
292
9.54k
                }
293
0
                DataSegmentKind::Passive => {
294
0
                    data.passive(seg.init.iter().copied());
295
0
                }
296
            }
297
        }
298
1.59k
        module.section(&data);
299
30.0k
    }
<wasm_smith::ConfiguredModule<wasm_smith::config::DefaultConfig>>::encode_data
Line
Count
Source
276
10.4k
    fn encode_data(&self, module: &mut wasm_encoder::Module) {
277
10.4k
        if self.data.is_empty() {
278
9.25k
            return;
279
1.20k
        }
280
1.20k
        let mut data = wasm_encoder::DataSection::new();
281
4.59k
        for seg in &self.data {
282
4.59k
            match &seg.kind {
283
                DataSegmentKind::Active {
284
4.59k
                    memory_index,
285
4.59k
                    offset,
286
4.59k
                } => {
287
4.59k
                    data.active(
288
4.59k
                        *memory_index,
289
4.59k
                        translate_instruction(offset),
290
4.59k
                        seg.init.iter().copied(),
291
4.59k
                    );
292
4.59k
                }
293
0
                DataSegmentKind::Passive => {
294
0
                    data.passive(seg.init.iter().copied());
295
0
                }
296
            }
297
        }
298
1.20k
        module.section(&data);
299
10.4k
    }
Unexecuted instantiation: <wasm_smith::ConfiguredModule<wasm_smith::config::SwarmConfig>>::encode_data
300
}
301
302
1.68M
fn translate_val_type(ty: ValType) -> wasm_encoder::ValType {
303
1.68M
    match ty {
304
140k
        ValType::I32 => wasm_encoder::ValType::I32,
305
913k
        ValType::I64 => wasm_encoder::ValType::I64,
306
34.3k
        ValType::F32 => wasm_encoder::ValType::F32,
307
549k
        ValType::F64 => wasm_encoder::ValType::F64,
308
43.6k
        ValType::FuncRef => wasm_encoder::ValType::FuncRef,
309
0
        ValType::ExternRef => wasm_encoder::ValType::ExternRef,
310
    }
311
1.68M
}
312
313
53.5k
fn translate_entity_type(ty: &EntityType) -> wasm_encoder::EntityType {
314
53.5k
    match ty {
315
18.9k
        EntityType::Func(f, _) => wasm_encoder::EntityType::Function(*f),
316
0
        EntityType::Instance(i, _) => wasm_encoder::EntityType::Instance(*i),
317
0
        EntityType::Module(i, _) => wasm_encoder::EntityType::Module(*i),
318
2.38k
        EntityType::Table(ty) => translate_table_type(ty).into(),
319
1.20k
        EntityType::Memory(m) => translate_memory_type(m).into(),
320
31.0k
        EntityType::Global(g) => translate_global_type(g).into(),
321
    }
322
53.5k
}
323
324
43.6k
fn translate_limits(limits: &Limits) -> wasm_encoder::Limits {
325
43.6k
    wasm_encoder::Limits {
326
43.6k
        min: limits.min,
327
43.6k
        max: limits.max,
328
43.6k
    }
329
43.6k
}
330
331
8.25k
fn translate_table_type(ty: &TableType) -> wasm_encoder::TableType {
332
8.25k
    wasm_encoder::TableType {
333
8.25k
        element_type: translate_val_type(ty.elem_ty),
334
8.25k
        limits: translate_limits(&ty.limits),
335
8.25k
    }
336
8.25k
}
337
338
35.3k
fn translate_memory_type(ty: &MemoryType) -> wasm_encoder::MemoryType {
339
35.3k
    wasm_encoder::MemoryType {
340
35.3k
        limits: translate_limits(&ty.limits),
341
35.3k
    }
342
35.3k
}
343
344
126k
fn translate_global_type(ty: &GlobalType) -> wasm_encoder::GlobalType {
345
126k
    wasm_encoder::GlobalType {
346
126k
        val_type: translate_val_type(ty.val_type),
347
126k
        mutable: ty.mutable,
348
126k
    }
349
126k
}
350
351
546k
fn translate_block_type(ty: BlockType) -> wasm_encoder::BlockType {
352
546k
    match ty {
353
410k
        BlockType::Empty => wasm_encoder::BlockType::Empty,
354
110k
        BlockType::Result(ty) => wasm_encoder::BlockType::Result(translate_val_type(ty)),
355
25.2k
        BlockType::FuncType(f) => wasm_encoder::BlockType::FunctionType(f),
356
    }
357
546k
}
358
359
77.2k
fn translate_mem_arg(m: MemArg) -> wasm_encoder::MemArg {
360
77.2k
    wasm_encoder::MemArg {
361
77.2k
        offset: m.offset,
362
77.2k
        align: m.align,
363
77.2k
        memory_index: m.memory_index,
364
77.2k
    }
365
77.2k
}
366
367
0
fn translate_item_kind(kind: &ItemKind) -> wasm_encoder::ItemKind {
368
0
    match kind {
369
0
        ItemKind::Func => wasm_encoder::ItemKind::Function,
370
0
        ItemKind::Table => wasm_encoder::ItemKind::Table,
371
0
        ItemKind::Memory => wasm_encoder::ItemKind::Memory,
372
0
        ItemKind::Global => wasm_encoder::ItemKind::Global,
373
0
        ItemKind::Instance => wasm_encoder::ItemKind::Instance,
374
0
        ItemKind::Module => wasm_encoder::ItemKind::Module,
375
    }
376
0
}
377
378
41
fn translate_export(export: &Export) -> wasm_encoder::Export {
379
41
    match export {
380
3
        Export::Func(idx) => wasm_encoder::Export::Function(*idx),
381
16
        Export::Table(idx) => wasm_encoder::Export::Table(*idx),
382
6
        Export::Memory(idx) => wasm_encoder::Export::Memory(*idx),
383
16
        Export::Global(idx) => wasm_encoder::Export::Global(*idx),
384
0
        Export::Instance(idx) => wasm_encoder::Export::Instance(*idx),
385
0
        Export::Module(idx) => wasm_encoder::Export::Module(*idx),
386
    }
387
41
}
388
389
4.19M
fn translate_instruction(inst: &Instruction) -> wasm_encoder::Instruction {
390
4.19M
    use Instruction::*;
391
4.19M
    match *inst {
392
4.19M
        // Control instructions.
393
451k
        Unreachable => wasm_encoder::Instruction::Unreachable,
394
54.7k
        Nop => wasm_encoder::Instruction::Nop,
395
31.7k
        Block(bt) => wasm_encoder::Instruction::Block(translate_block_type(bt)),
396
262k
        Loop(bt) => wasm_encoder::Instruction::Loop(translate_block_type(bt)),
397
252k
        If(bt) => wasm_encoder::Instruction::If(translate_block_type(bt)),
398
7.34k
        Else => wasm_encoder::Instruction::Else,
399
546k
        End => wasm_encoder::Instruction::End,
400
12.3k
        Br(x) => wasm_encoder::Instruction::Br(x),
401
30.1k
        BrIf(x) => wasm_encoder::Instruction::BrIf(x),
402
11.2k
        BrTable(ref ls, l) => wasm_encoder::Instruction::BrTable(ls, l),
403
11.2k
        Return => wasm_encoder::Instruction::Return,
404
63.6k
        Call(x) => wasm_encoder::Instruction::Call(x),
405
12.2k
        CallIndirect { ty, table } => wasm_encoder::Instruction::CallIndirect { ty, table },
406
407
        // Parametric instructions.
408
15.9k
        Drop => wasm_encoder::Instruction::Drop,
409
2.67k
        Select => wasm_encoder::Instruction::Select,
410
411
        // Variable instructions.
412
66.4k
        LocalGet(x) => wasm_encoder::Instruction::LocalGet(x),
413
5.72k
        LocalSet(x) => wasm_encoder::Instruction::LocalSet(x),
414
21.1k
        LocalTee(x) => wasm_encoder::Instruction::LocalTee(x),
415
528k
        GlobalGet(x) => wasm_encoder::Instruction::GlobalGet(x),
416
250k
        GlobalSet(x) => wasm_encoder::Instruction::GlobalSet(x),
417
418
        // Memory instructions.
419
10.8k
        I32Load(m) => wasm_encoder::Instruction::I32Load(translate_mem_arg(m)),
420
2.87k
        I64Load(m) => wasm_encoder::Instruction::I64Load(translate_mem_arg(m)),
421
3.14k
        F32Load(m) => wasm_encoder::Instruction::F32Load(translate_mem_arg(m)),
422
1.27k
        F64Load(m) => wasm_encoder::Instruction::F64Load(translate_mem_arg(m)),
423
12.3k
        I32Load8_S(m) => wasm_encoder::Instruction::I32Load8_S(translate_mem_arg(m)),
424
5.40k
        I32Load8_U(m) => wasm_encoder::Instruction::I32Load8_U(translate_mem_arg(m)),
425
5.38k
        I32Load16_S(m) => wasm_encoder::Instruction::I32Load16_S(translate_mem_arg(m)),
426
3.73k
        I32Load16_U(m) => wasm_encoder::Instruction::I32Load16_U(translate_mem_arg(m)),
427
3.37k
        I64Load8_S(m) => wasm_encoder::Instruction::I64Load8_S(translate_mem_arg(m)),
428
2.14k
        I64Load8_U(m) => wasm_encoder::Instruction::I64Load8_U(translate_mem_arg(m)),
429
2.21k
        I64Load16_S(m) => wasm_encoder::Instruction::I64Load16_S(translate_mem_arg(m)),
430
10.5k
        I64Load16_U(m) => wasm_encoder::Instruction::I64Load16_U(translate_mem_arg(m)),
431
4.97k
        I64Load32_S(m) => wasm_encoder::Instruction::I64Load32_S(translate_mem_arg(m)),
432
1.80k
        I64Load32_U(m) => wasm_encoder::Instruction::I64Load32_U(translate_mem_arg(m)),
433
438
        I32Store(m) => wasm_encoder::Instruction::I32Store(translate_mem_arg(m)),
434
396
        I64Store(m) => wasm_encoder::Instruction::I64Store(translate_mem_arg(m)),
435
370
        F32Store(m) => wasm_encoder::Instruction::F32Store(translate_mem_arg(m)),
436
354
        F64Store(m) => wasm_encoder::Instruction::F64Store(translate_mem_arg(m)),
437
549
        I32Store8(m) => wasm_encoder::Instruction::I32Store8(translate_mem_arg(m)),
438
1.10k
        I32Store16(m) => wasm_encoder::Instruction::I32Store16(translate_mem_arg(m)),
439
1.27k
        I64Store8(m) => wasm_encoder::Instruction::I64Store8(translate_mem_arg(m)),
440
239
        I64Store16(m) => wasm_encoder::Instruction::I64Store16(translate_mem_arg(m)),
441
2.41k
        I64Store32(m) => wasm_encoder::Instruction::I64Store32(translate_mem_arg(m)),
442
66.1k
        MemorySize(x) => wasm_encoder::Instruction::MemorySize(x),
443
10.5k
        MemoryGrow(x) => wasm_encoder::Instruction::MemoryGrow(x),
444
0
        MemoryInit { mem, data } => wasm_encoder::Instruction::MemoryInit { mem, data },
445
0
        DataDrop(x) => wasm_encoder::Instruction::DataDrop(x),
446
0
        MemoryCopy { src, dst } => wasm_encoder::Instruction::MemoryCopy { src, dst },
447
0
        MemoryFill(x) => wasm_encoder::Instruction::MemoryFill(x),
448
449
        // Numeric instructions.
450
354k
        I32Const(x) => wasm_encoder::Instruction::I32Const(x),
451
64.4k
        I64Const(x) => wasm_encoder::Instruction::I64Const(x),
452
28.3k
        F32Const(x) => wasm_encoder::Instruction::F32Const(x),
453
40.6k
        F64Const(x) => wasm_encoder::Instruction::F64Const(x),
454
258k
        I32Eqz => wasm_encoder::Instruction::I32Eqz,
455
1.19k
        I32Eq => wasm_encoder::Instruction::I32Eq,
456
1.04k
        I32Neq => wasm_encoder::Instruction::I32Neq,
457
1.20k
        I32LtS => wasm_encoder::Instruction::I32LtS,
458
297
        I32LtU => wasm_encoder::Instruction::I32LtU,
459
1.75k
        I32GtS => wasm_encoder::Instruction::I32GtS,
460
762
        I32GtU => wasm_encoder::Instruction::I32GtU,
461
694
        I32LeS => wasm_encoder::Instruction::I32LeS,
462
733
        I32LeU => wasm_encoder::Instruction::I32LeU,
463
1.82k
        I32GeS => wasm_encoder::Instruction::I32GeS,
464
509
        I32GeU => wasm_encoder::Instruction::I32GeU,
465
11.7k
        I64Eqz => wasm_encoder::Instruction::I64Eqz,
466
535
        I64Eq => wasm_encoder::Instruction::I64Eq,
467
829
        I64Neq => wasm_encoder::Instruction::I64Neq,
468
943
        I64LtS => wasm_encoder::Instruction::I64LtS,
469
433
        I64LtU => wasm_encoder::Instruction::I64LtU,
470
1.25k
        I64GtS => wasm_encoder::Instruction::I64GtS,
471
320
        I64GtU => wasm_encoder::Instruction::I64GtU,
472
1.28k
        I64LeS => wasm_encoder::Instruction::I64LeS,
473
1.00k
        I64LeU => wasm_encoder::Instruction::I64LeU,
474
1.68k
        I64GeS => wasm_encoder::Instruction::I64GeS,
475
493
        I64GeU => wasm_encoder::Instruction::I64GeU,
476
330
        F32Eq => wasm_encoder::Instruction::F32Eq,
477
715
        F32Neq => wasm_encoder::Instruction::F32Neq,
478
174
        F32Lt => wasm_encoder::Instruction::F32Lt,
479
203
        F32Gt => wasm_encoder::Instruction::F32Gt,
480
2.33k
        F32Le => wasm_encoder::Instruction::F32Le,
481
189
        F32Ge => wasm_encoder::Instruction::F32Ge,
482
911
        F64Eq => wasm_encoder::Instruction::F64Eq,
483
1.38k
        F64Neq => wasm_encoder::Instruction::F64Neq,
484
274
        F64Lt => wasm_encoder::Instruction::F64Lt,
485
482
        F64Gt => wasm_encoder::Instruction::F64Gt,
486
485
        F64Le => wasm_encoder::Instruction::F64Le,
487
338
        F64Ge => wasm_encoder::Instruction::F64Ge,
488
4.11k
        I32Clz => wasm_encoder::Instruction::I32Clz,
489
8.22k
        I32Ctz => wasm_encoder::Instruction::I32Ctz,
490
5.02k
        I32Popcnt => wasm_encoder::Instruction::I32Popcnt,
491
585
        I32Add => wasm_encoder::Instruction::I32Add,
492
243k
        I32Sub => wasm_encoder::Instruction::I32Sub,
493
677
        I32Mul => wasm_encoder::Instruction::I32Mul,
494
2.19k
        I32DivS => wasm_encoder::Instruction::I32DivS,
495
3.29k
        I32DivU => wasm_encoder::Instruction::I32DivU,
496
2.50k
        I32RemS => wasm_encoder::Instruction::I32RemS,
497
5.88k
        I32RemU => wasm_encoder::Instruction::I32RemU,
498
1.61k
        I32And => wasm_encoder::Instruction::I32And,
499
670
        I32Or => wasm_encoder::Instruction::I32Or,
500
1.55k
        I32Xor => wasm_encoder::Instruction::I32Xor,
501
413
        I32Shl => wasm_encoder::Instruction::I32Shl,
502
1.74k
        I32ShrS => wasm_encoder::Instruction::I32ShrS,
503
1.23k
        I32ShrU => wasm_encoder::Instruction::I32ShrU,
504
1.13k
        I32Rotl => wasm_encoder::Instruction::I32Rotl,
505
773
        I32Rotr => wasm_encoder::Instruction::I32Rotr,
506
7.13k
        I64Clz => wasm_encoder::Instruction::I64Clz,
507
9.34k
        I64Ctz => wasm_encoder::Instruction::I64Ctz,
508
8.50k
        I64Popcnt => wasm_encoder::Instruction::I64Popcnt,
509
776
        I64Add => wasm_encoder::Instruction::I64Add,
510
858
        I64Sub => wasm_encoder::Instruction::I64Sub,
511
932
        I64Mul => wasm_encoder::Instruction::I64Mul,
512
10.9k
        I64DivS => wasm_encoder::Instruction::I64DivS,
513
4.75k
        I64DivU => wasm_encoder::Instruction::I64DivU,
514
4.37k
        I64RemS => wasm_encoder::Instruction::I64RemS,
515
1.18k
        I64RemU => wasm_encoder::Instruction::I64RemU,
516
1.40k
        I64And => wasm_encoder::Instruction::I64And,
517
925
        I64Or => wasm_encoder::Instruction::I64Or,
518
2.61k
        I64Xor => wasm_encoder::Instruction::I64Xor,
519
1.09k
        I64Shl => wasm_encoder::Instruction::I64Shl,
520
4.19k
        I64ShrS => wasm_encoder::Instruction::I64ShrS,
521
1.21k
        I64ShrU => wasm_encoder::Instruction::I64ShrU,
522
1.18k
        I64Rotl => wasm_encoder::Instruction::I64Rotl,
523
1.24k
        I64Rotr => wasm_encoder::Instruction::I64Rotr,
524
2.52k
        F32Abs => wasm_encoder::Instruction::F32Abs,
525
4.13k
        F32Neg => wasm_encoder::Instruction::F32Neg,
526
7.33k
        F32Ceil => wasm_encoder::Instruction::F32Ceil,
527
7.06k
        F32Floor => wasm_encoder::Instruction::F32Floor,
528
6.35k
        F32Trunc => wasm_encoder::Instruction::F32Trunc,
529
2.78k
        F32Nearest => wasm_encoder::Instruction::F32Nearest,
530
8.03k
        F32Sqrt => wasm_encoder::Instruction::F32Sqrt,
531
363
        F32Add => wasm_encoder::Instruction::F32Add,
532
871
        F32Sub => wasm_encoder::Instruction::F32Sub,
533
272
        F32Mul => wasm_encoder::Instruction::F32Mul,
534
346
        F32Div => wasm_encoder::Instruction::F32Div,
535
645
        F32Min => wasm_encoder::Instruction::F32Min,
536
406
        F32Max => wasm_encoder::Instruction::F32Max,
537
526
        F32Copysign => wasm_encoder::Instruction::F32Copysign,
538
5.71k
        F64Abs => wasm_encoder::Instruction::F64Abs,
539
2.34k
        F64Neg => wasm_encoder::Instruction::F64Neg,
540
5.76k
        F64Ceil => wasm_encoder::Instruction::F64Ceil,
541
7.47k
        F64Floor => wasm_encoder::Instruction::F64Floor,
542
7.16k
        F64Trunc => wasm_encoder::Instruction::F64Trunc,
543
2.67k
        F64Nearest => wasm_encoder::Instruction::F64Nearest,
544
9.89k
        F64Sqrt => wasm_encoder::Instruction::F64Sqrt,
545
1.01k
        F64Add => wasm_encoder::Instruction::F64Add,
546
1.03k
        F64Sub => wasm_encoder::Instruction::F64Sub,
547
593
        F64Mul => wasm_encoder::Instruction::F64Mul,
548
372
        F64Div => wasm_encoder::Instruction::F64Div,
549
768
        F64Min => wasm_encoder::Instruction::F64Min,
550
413
        F64Max => wasm_encoder::Instruction::F64Max,
551
698
        F64Copysign => wasm_encoder::Instruction::F64Copysign,
552
9.66k
        I32WrapI64 => wasm_encoder::Instruction::I32WrapI64,
553
7.94k
        I32TruncF32S => wasm_encoder::Instruction::I32TruncF32S,
554
3.86k
        I32TruncF32U => wasm_encoder::Instruction::I32TruncF32U,
555
6.01k
        I32TruncF64S => wasm_encoder::Instruction::I32TruncF64S,
556
3.52k
        I32TruncF64U => wasm_encoder::Instruction::I32TruncF64U,
557
9.60k
        I64ExtendI32S => wasm_encoder::Instruction::I64ExtendI32S,
558
2.13k
        I64ExtendI32U => wasm_encoder::Instruction::I64ExtendI32U,
559
1.02k
        I64TruncF32S => wasm_encoder::Instruction::I64TruncF32S,
560
1.98k
        I64TruncF32U => wasm_encoder::Instruction::I64TruncF32U,
561
1.13k
        I64TruncF64S => wasm_encoder::Instruction::I64TruncF64S,
562
2.06k
        I64TruncF64U => wasm_encoder::Instruction::I64TruncF64U,
563
8.40k
        F32ConvertI32S => wasm_encoder::Instruction::F32ConvertI32S,
564
4.33k
        F32ConvertI32U => wasm_encoder::Instruction::F32ConvertI32U,
565
1.56k
        F32ConvertI64S => wasm_encoder::Instruction::F32ConvertI64S,
566
6.90k
        F32ConvertI64U => wasm_encoder::Instruction::F32ConvertI64U,
567
2.17k
        F32DemoteF64 => wasm_encoder::Instruction::F32DemoteF64,
568
6.81k
        F64ConvertI32S => wasm_encoder::Instruction::F64ConvertI32S,
569
2.94k
        F64ConvertI32U => wasm_encoder::Instruction::F64ConvertI32U,
570
3.89k
        F64ConvertI64S => wasm_encoder::Instruction::F64ConvertI64S,
571
14.9k
        F64ConvertI64U => wasm_encoder::Instruction::F64ConvertI64U,
572
1.54k
        F64PromoteF32 => wasm_encoder::Instruction::F64PromoteF32,
573
5.22k
        I32ReinterpretF32 => wasm_encoder::Instruction::I32ReinterpretF32,
574
9.17k
        I64ReinterpretF64 => wasm_encoder::Instruction::I64ReinterpretF64,
575
4.99k
        F32ReinterpretI32 => wasm_encoder::Instruction::F32ReinterpretI32,
576
2.60k
        F64ReinterpretI64 => wasm_encoder::Instruction::F64ReinterpretI64,
577
1.67k
        I32Extend8S => wasm_encoder::Instruction::I32Extend8S,
578
5.79k
        I32Extend16S => wasm_encoder::Instruction::I32Extend16S,
579
6.91k
        I64Extend8S => wasm_encoder::Instruction::I64Extend8S,
580
1.76k
        I64Extend16S => wasm_encoder::Instruction::I64Extend16S,
581
10.7k
        I64Extend32S => wasm_encoder::Instruction::I64Extend32S,
582
1.60k
        I32TruncSatF32S => wasm_encoder::Instruction::I32TruncSatF32S,
583
2.60k
        I32TruncSatF32U => wasm_encoder::Instruction::I32TruncSatF32U,
584
3.77k
        I32TruncSatF64S => wasm_encoder::Instruction::I32TruncSatF64S,
585
9.83k
        I32TruncSatF64U => wasm_encoder::Instruction::I32TruncSatF64U,
586
1.30k
        I64TruncSatF32S => wasm_encoder::Instruction::I64TruncSatF32S,
587
7.93k
        I64TruncSatF32U => wasm_encoder::Instruction::I64TruncSatF32U,
588
1.35k
        I64TruncSatF64S => wasm_encoder::Instruction::I64TruncSatF64S,
589
5.77k
        I64TruncSatF64U => wasm_encoder::Instruction::I64TruncSatF64U,
590
0
        TypedSelect(ty) => wasm_encoder::Instruction::TypedSelect(translate_val_type(ty)),
591
0
        RefNull(ty) => wasm_encoder::Instruction::RefNull(translate_val_type(ty)),
592
0
        RefIsNull => wasm_encoder::Instruction::RefIsNull,
593
0
        RefFunc(x) => wasm_encoder::Instruction::RefFunc(x),
594
0
        TableInit { segment, table } => wasm_encoder::Instruction::TableInit { segment, table },
595
0
        ElemDrop { segment } => wasm_encoder::Instruction::ElemDrop { segment },
596
0
        TableFill { table } => wasm_encoder::Instruction::TableFill { table },
597
0
        TableSet { table } => wasm_encoder::Instruction::TableSet { table },
598
0
        TableGet { table } => wasm_encoder::Instruction::TableGet { table },
599
0
        TableGrow { table } => wasm_encoder::Instruction::TableGrow { table },
600
0
        TableSize { table } => wasm_encoder::Instruction::TableSize { table },
601
0
        TableCopy { src, dst } => wasm_encoder::Instruction::TableCopy { src, dst },
602
    }
603
4.19M
}