Coverage Report

Created: 2024-10-16 07:58

/rust/registry/src/index.crates.io-6f17d22bba15001f/wasm-smith-0.4.5/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
0
    pub fn to_bytes(&self) -> Vec<u8> {
7
0
        self.inner.to_bytes()
8
0
    }
9
}
10
11
impl<C> ConfiguredModule<C>
12
where
13
    C: Config,
14
{
15
    /// Encode this Wasm module into bytes.
16
17.8k
    pub fn to_bytes(&self) -> Vec<u8> {
17
17.8k
        self.encoded().finish()
18
17.8k
    }
<wasm_smith::ConfiguredModule<universal_llvm::NoImportsConfig>>::to_bytes
Line
Count
Source
16
214
    pub fn to_bytes(&self) -> Vec<u8> {
17
214
        self.encoded().finish()
18
214
    }
Unexecuted instantiation: <wasm_smith::ConfiguredModule<wasm_smith::config::DefaultConfig>>::to_bytes
<wasm_smith::ConfiguredModule<universal_singlepass::NoImportsConfig>>::to_bytes
Line
Count
Source
16
12.6k
    pub fn to_bytes(&self) -> Vec<u8> {
17
12.6k
        self.encoded().finish()
18
12.6k
    }
<wasm_smith::ConfiguredModule<deterministic::NoImportsConfig>>::to_bytes
Line
Count
Source
16
5.00k
    pub fn to_bytes(&self) -> Vec<u8> {
17
5.00k
        self.encoded().finish()
18
5.00k
    }
Unexecuted instantiation: <wasm_smith::ConfiguredModule<metering::NoImportsConfig>>::to_bytes
Unexecuted instantiation: <wasm_smith::ConfiguredModule<universal_cranelift::NoImportsConfig>>::to_bytes
19
20
17.8k
    fn encoded(&self) -> wasm_encoder::Module {
21
17.8k
        let mut module = wasm_encoder::Module::new();
22
17.8k
23
17.8k
        self.encode_initializers(&mut module);
24
17.8k
        self.encode_funcs(&mut module);
25
17.8k
        self.encode_tables(&mut module);
26
17.8k
        self.encode_memories(&mut module);
27
17.8k
        self.encode_globals(&mut module);
28
17.8k
        self.encode_exports(&mut module);
29
17.8k
        self.encode_start(&mut module);
30
17.8k
        self.encode_elems(&mut module);
31
17.8k
        self.encode_data_count(&mut module);
32
17.8k
        self.encode_code(&mut module);
33
17.8k
        self.encode_data(&mut module);
34
17.8k
35
17.8k
        module
36
17.8k
    }
<wasm_smith::ConfiguredModule<universal_llvm::NoImportsConfig>>::encoded
Line
Count
Source
20
214
    fn encoded(&self) -> wasm_encoder::Module {
21
214
        let mut module = wasm_encoder::Module::new();
22
214
23
214
        self.encode_initializers(&mut module);
24
214
        self.encode_funcs(&mut module);
25
214
        self.encode_tables(&mut module);
26
214
        self.encode_memories(&mut module);
27
214
        self.encode_globals(&mut module);
28
214
        self.encode_exports(&mut module);
29
214
        self.encode_start(&mut module);
30
214
        self.encode_elems(&mut module);
31
214
        self.encode_data_count(&mut module);
32
214
        self.encode_code(&mut module);
33
214
        self.encode_data(&mut module);
34
214
35
214
        module
36
214
    }
Unexecuted instantiation: <wasm_smith::ConfiguredModule<wasm_smith::config::DefaultConfig>>::encoded
<wasm_smith::ConfiguredModule<universal_singlepass::NoImportsConfig>>::encoded
Line
Count
Source
20
12.6k
    fn encoded(&self) -> wasm_encoder::Module {
21
12.6k
        let mut module = wasm_encoder::Module::new();
22
12.6k
23
12.6k
        self.encode_initializers(&mut module);
24
12.6k
        self.encode_funcs(&mut module);
25
12.6k
        self.encode_tables(&mut module);
26
12.6k
        self.encode_memories(&mut module);
27
12.6k
        self.encode_globals(&mut module);
28
12.6k
        self.encode_exports(&mut module);
29
12.6k
        self.encode_start(&mut module);
30
12.6k
        self.encode_elems(&mut module);
31
12.6k
        self.encode_data_count(&mut module);
32
12.6k
        self.encode_code(&mut module);
33
12.6k
        self.encode_data(&mut module);
34
12.6k
35
12.6k
        module
36
12.6k
    }
<wasm_smith::ConfiguredModule<deterministic::NoImportsConfig>>::encoded
Line
Count
Source
20
5.00k
    fn encoded(&self) -> wasm_encoder::Module {
21
5.00k
        let mut module = wasm_encoder::Module::new();
22
5.00k
23
5.00k
        self.encode_initializers(&mut module);
24
5.00k
        self.encode_funcs(&mut module);
25
5.00k
        self.encode_tables(&mut module);
26
5.00k
        self.encode_memories(&mut module);
27
5.00k
        self.encode_globals(&mut module);
28
5.00k
        self.encode_exports(&mut module);
29
5.00k
        self.encode_start(&mut module);
30
5.00k
        self.encode_elems(&mut module);
31
5.00k
        self.encode_data_count(&mut module);
32
5.00k
        self.encode_code(&mut module);
33
5.00k
        self.encode_data(&mut module);
34
5.00k
35
5.00k
        module
36
5.00k
    }
Unexecuted instantiation: <wasm_smith::ConfiguredModule<metering::NoImportsConfig>>::encoded
Unexecuted instantiation: <wasm_smith::ConfiguredModule<universal_cranelift::NoImportsConfig>>::encoded
37
38
17.8k
    fn encode_initializers(&self, module: &mut wasm_encoder::Module) {
39
26.7k
        for init in self.initial_sections.iter() {
40
26.7k
            match init {
41
17.3k
                InitialSection::Type(types) => self.encode_types(module, types),
42
9.45k
                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
17.8k
    }
<wasm_smith::ConfiguredModule<universal_llvm::NoImportsConfig>>::encode_initializers
Line
Count
Source
38
214
    fn encode_initializers(&self, module: &mut wasm_encoder::Module) {
39
305
        for init in self.initial_sections.iter() {
40
305
            match init {
41
192
                InitialSection::Type(types) => self.encode_types(module, types),
42
113
                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
214
    }
Unexecuted instantiation: <wasm_smith::ConfiguredModule<wasm_smith::config::DefaultConfig>>::encode_initializers
<wasm_smith::ConfiguredModule<universal_singlepass::NoImportsConfig>>::encode_initializers
Line
Count
Source
38
12.6k
    fn encode_initializers(&self, module: &mut wasm_encoder::Module) {
39
19.2k
        for init in self.initial_sections.iter() {
40
19.2k
            match init {
41
12.2k
                InitialSection::Type(types) => self.encode_types(module, types),
42
6.92k
                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
12.6k
    }
<wasm_smith::ConfiguredModule<deterministic::NoImportsConfig>>::encode_initializers
Line
Count
Source
38
5.00k
    fn encode_initializers(&self, module: &mut wasm_encoder::Module) {
39
7.25k
        for init in self.initial_sections.iter() {
40
7.25k
            match init {
41
4.83k
                InitialSection::Type(types) => self.encode_types(module, types),
42
2.41k
                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
5.00k
    }
Unexecuted instantiation: <wasm_smith::ConfiguredModule<metering::NoImportsConfig>>::encode_initializers
Unexecuted instantiation: <wasm_smith::ConfiguredModule<universal_cranelift::NoImportsConfig>>::encode_initializers
49
50
17.3k
    fn encode_types(&self, module: &mut wasm_encoder::Module, types: &[Type]) {
51
17.3k
        let mut section = wasm_encoder::TypeSection::new();
52
69.7k
        for ty in types {
53
52.3k
            match ty {
54
52.3k
                Type::Func(ty) => {
55
52.3k
                    section.function(
56
164k
                        ty.params.iter().map(|t| translate_val_type(*t)),
<wasm_smith::ConfiguredModule<universal_llvm::NoImportsConfig>>::encode_types::{closure#0}
Line
Count
Source
56
95.2k
                        ty.params.iter().map(|t| translate_val_type(*t)),
Unexecuted instantiation: <wasm_smith::ConfiguredModule<wasm_smith::config::DefaultConfig>>::encode_types::{closure#0}
<wasm_smith::ConfiguredModule<universal_singlepass::NoImportsConfig>>::encode_types::{closure#0}
Line
Count
Source
56
30.7k
                        ty.params.iter().map(|t| translate_val_type(*t)),
<wasm_smith::ConfiguredModule<deterministic::NoImportsConfig>>::encode_types::{closure#0}
Line
Count
Source
56
38.9k
                        ty.params.iter().map(|t| translate_val_type(*t)),
Unexecuted instantiation: <wasm_smith::ConfiguredModule<metering::NoImportsConfig>>::encode_types::{closure#0}
Unexecuted instantiation: <wasm_smith::ConfiguredModule<universal_cranelift::NoImportsConfig>>::encode_types::{closure#0}
57
116k
                        ty.results.iter().map(|t| translate_val_type(*t)),
<wasm_smith::ConfiguredModule<universal_llvm::NoImportsConfig>>::encode_types::{closure#1}
Line
Count
Source
57
96.5k
                        ty.results.iter().map(|t| translate_val_type(*t)),
Unexecuted instantiation: <wasm_smith::ConfiguredModule<wasm_smith::config::DefaultConfig>>::encode_types::{closure#1}
<wasm_smith::ConfiguredModule<universal_singlepass::NoImportsConfig>>::encode_types::{closure#1}
Line
Count
Source
57
8.88k
                        ty.results.iter().map(|t| translate_val_type(*t)),
<wasm_smith::ConfiguredModule<deterministic::NoImportsConfig>>::encode_types::{closure#1}
Line
Count
Source
57
11.3k
                        ty.results.iter().map(|t| translate_val_type(*t)),
Unexecuted instantiation: <wasm_smith::ConfiguredModule<metering::NoImportsConfig>>::encode_types::{closure#1}
Unexecuted instantiation: <wasm_smith::ConfiguredModule<universal_cranelift::NoImportsConfig>>::encode_types::{closure#1}
58
52.3k
                    );
59
52.3k
                }
60
0
                Type::Module(ty) => {
61
0
                    section.module(
62
0
                        ty.imports.iter().map(|(module, name, ty)| {
63
0
                            (module.as_str(), name.as_deref(), translate_entity_type(ty))
64
0
                        }),
Unexecuted instantiation: <wasm_smith::ConfiguredModule<universal_llvm::NoImportsConfig>>::encode_types::{closure#2}
Unexecuted instantiation: <wasm_smith::ConfiguredModule<wasm_smith::config::DefaultConfig>>::encode_types::{closure#2}
Unexecuted instantiation: <wasm_smith::ConfiguredModule<universal_singlepass::NoImportsConfig>>::encode_types::{closure#2}
Unexecuted instantiation: <wasm_smith::ConfiguredModule<deterministic::NoImportsConfig>>::encode_types::{closure#2}
Unexecuted instantiation: <wasm_smith::ConfiguredModule<metering::NoImportsConfig>>::encode_types::{closure#2}
Unexecuted instantiation: <wasm_smith::ConfiguredModule<universal_cranelift::NoImportsConfig>>::encode_types::{closure#2}
65
0
                        ty.exports
66
0
                            .exports
67
0
                            .iter()
68
0
                            .map(|(name, ty)| (name.as_str(), translate_entity_type(ty))),
Unexecuted instantiation: <wasm_smith::ConfiguredModule<universal_llvm::NoImportsConfig>>::encode_types::{closure#3}
Unexecuted instantiation: <wasm_smith::ConfiguredModule<wasm_smith::config::DefaultConfig>>::encode_types::{closure#3}
Unexecuted instantiation: <wasm_smith::ConfiguredModule<universal_singlepass::NoImportsConfig>>::encode_types::{closure#3}
Unexecuted instantiation: <wasm_smith::ConfiguredModule<deterministic::NoImportsConfig>>::encode_types::{closure#3}
Unexecuted instantiation: <wasm_smith::ConfiguredModule<metering::NoImportsConfig>>::encode_types::{closure#3}
Unexecuted instantiation: <wasm_smith::ConfiguredModule<universal_cranelift::NoImportsConfig>>::encode_types::{closure#3}
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))),
Unexecuted instantiation: <wasm_smith::ConfiguredModule<universal_llvm::NoImportsConfig>>::encode_types::{closure#4}
Unexecuted instantiation: <wasm_smith::ConfiguredModule<wasm_smith::config::DefaultConfig>>::encode_types::{closure#4}
Unexecuted instantiation: <wasm_smith::ConfiguredModule<universal_singlepass::NoImportsConfig>>::encode_types::{closure#4}
Unexecuted instantiation: <wasm_smith::ConfiguredModule<deterministic::NoImportsConfig>>::encode_types::{closure#4}
Unexecuted instantiation: <wasm_smith::ConfiguredModule<metering::NoImportsConfig>>::encode_types::{closure#4}
Unexecuted instantiation: <wasm_smith::ConfiguredModule<universal_cranelift::NoImportsConfig>>::encode_types::{closure#4}
76
0
                    );
77
0
                }
78
            }
79
        }
80
17.3k
        module.section(&section);
81
17.3k
    }
<wasm_smith::ConfiguredModule<universal_llvm::NoImportsConfig>>::encode_types
Line
Count
Source
50
192
    fn encode_types(&self, module: &mut wasm_encoder::Module, types: &[Type]) {
51
192
        let mut section = wasm_encoder::TypeSection::new();
52
5.87k
        for ty in types {
53
5.68k
            match ty {
54
5.68k
                Type::Func(ty) => {
55
5.68k
                    section.function(
56
5.68k
                        ty.params.iter().map(|t| translate_val_type(*t)),
57
5.68k
                        ty.results.iter().map(|t| translate_val_type(*t)),
58
5.68k
                    );
59
5.68k
                }
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
192
        module.section(&section);
81
192
    }
Unexecuted instantiation: <wasm_smith::ConfiguredModule<wasm_smith::config::DefaultConfig>>::encode_types
<wasm_smith::ConfiguredModule<universal_singlepass::NoImportsConfig>>::encode_types
Line
Count
Source
50
12.2k
    fn encode_types(&self, module: &mut wasm_encoder::Module, types: &[Type]) {
51
12.2k
        let mut section = wasm_encoder::TypeSection::new();
52
33.1k
        for ty in types {
53
20.9k
            match ty {
54
20.9k
                Type::Func(ty) => {
55
20.9k
                    section.function(
56
20.9k
                        ty.params.iter().map(|t| translate_val_type(*t)),
57
20.9k
                        ty.results.iter().map(|t| translate_val_type(*t)),
58
20.9k
                    );
59
20.9k
                }
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
12.2k
        module.section(&section);
81
12.2k
    }
<wasm_smith::ConfiguredModule<deterministic::NoImportsConfig>>::encode_types
Line
Count
Source
50
4.83k
    fn encode_types(&self, module: &mut wasm_encoder::Module, types: &[Type]) {
51
4.83k
        let mut section = wasm_encoder::TypeSection::new();
52
30.6k
        for ty in types {
53
25.7k
            match ty {
54
25.7k
                Type::Func(ty) => {
55
25.7k
                    section.function(
56
25.7k
                        ty.params.iter().map(|t| translate_val_type(*t)),
57
25.7k
                        ty.results.iter().map(|t| translate_val_type(*t)),
58
25.7k
                    );
59
25.7k
                }
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
4.83k
        module.section(&section);
81
4.83k
    }
Unexecuted instantiation: <wasm_smith::ConfiguredModule<metering::NoImportsConfig>>::encode_types
Unexecuted instantiation: <wasm_smith::ConfiguredModule<universal_cranelift::NoImportsConfig>>::encode_types
82
83
9.45k
    fn encode_imports(
84
9.45k
        &self,
85
9.45k
        module: &mut wasm_encoder::Module,
86
9.45k
        imports: &[(String, Option<String>, EntityType)],
87
9.45k
    ) {
88
9.45k
        let mut section = wasm_encoder::ImportSection::new();
89
9.45k
        for (module, name, ty) in imports {
90
0
            section.import(module, name.as_deref(), translate_entity_type(ty));
91
0
        }
92
9.45k
        module.section(&section);
93
9.45k
    }
<wasm_smith::ConfiguredModule<universal_llvm::NoImportsConfig>>::encode_imports
Line
Count
Source
83
113
    fn encode_imports(
84
113
        &self,
85
113
        module: &mut wasm_encoder::Module,
86
113
        imports: &[(String, Option<String>, EntityType)],
87
113
    ) {
88
113
        let mut section = wasm_encoder::ImportSection::new();
89
113
        for (module, name, ty) in imports {
90
0
            section.import(module, name.as_deref(), translate_entity_type(ty));
91
0
        }
92
113
        module.section(&section);
93
113
    }
Unexecuted instantiation: <wasm_smith::ConfiguredModule<wasm_smith::config::DefaultConfig>>::encode_imports
<wasm_smith::ConfiguredModule<universal_singlepass::NoImportsConfig>>::encode_imports
Line
Count
Source
83
6.92k
    fn encode_imports(
84
6.92k
        &self,
85
6.92k
        module: &mut wasm_encoder::Module,
86
6.92k
        imports: &[(String, Option<String>, EntityType)],
87
6.92k
    ) {
88
6.92k
        let mut section = wasm_encoder::ImportSection::new();
89
6.92k
        for (module, name, ty) in imports {
90
0
            section.import(module, name.as_deref(), translate_entity_type(ty));
91
0
        }
92
6.92k
        module.section(&section);
93
6.92k
    }
<wasm_smith::ConfiguredModule<deterministic::NoImportsConfig>>::encode_imports
Line
Count
Source
83
2.41k
    fn encode_imports(
84
2.41k
        &self,
85
2.41k
        module: &mut wasm_encoder::Module,
86
2.41k
        imports: &[(String, Option<String>, EntityType)],
87
2.41k
    ) {
88
2.41k
        let mut section = wasm_encoder::ImportSection::new();
89
2.41k
        for (module, name, ty) in imports {
90
0
            section.import(module, name.as_deref(), translate_entity_type(ty));
91
0
        }
92
2.41k
        module.section(&section);
93
2.41k
    }
Unexecuted instantiation: <wasm_smith::ConfiguredModule<metering::NoImportsConfig>>::encode_imports
Unexecuted instantiation: <wasm_smith::ConfiguredModule<universal_cranelift::NoImportsConfig>>::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<universal_llvm::NoImportsConfig>>::encode_aliases
Unexecuted instantiation: <wasm_smith::ConfiguredModule<wasm_smith::config::DefaultConfig>>::encode_aliases
Unexecuted instantiation: <wasm_smith::ConfiguredModule<universal_singlepass::NoImportsConfig>>::encode_aliases
Unexecuted instantiation: <wasm_smith::ConfiguredModule<deterministic::NoImportsConfig>>::encode_aliases
Unexecuted instantiation: <wasm_smith::ConfiguredModule<metering::NoImportsConfig>>::encode_aliases
Unexecuted instantiation: <wasm_smith::ConfiguredModule<universal_cranelift::NoImportsConfig>>::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))),
Unexecuted instantiation: <wasm_smith::ConfiguredModule<universal_llvm::NoImportsConfig>>::encode_instances::{closure#0}
Unexecuted instantiation: <wasm_smith::ConfiguredModule<wasm_smith::config::DefaultConfig>>::encode_instances::{closure#0}
Unexecuted instantiation: <wasm_smith::ConfiguredModule<universal_singlepass::NoImportsConfig>>::encode_instances::{closure#0}
Unexecuted instantiation: <wasm_smith::ConfiguredModule<deterministic::NoImportsConfig>>::encode_instances::{closure#0}
Unexecuted instantiation: <wasm_smith::ConfiguredModule<metering::NoImportsConfig>>::encode_instances::{closure#0}
Unexecuted instantiation: <wasm_smith::ConfiguredModule<universal_cranelift::NoImportsConfig>>::encode_instances::{closure#0}
126
0
            );
127
0
        }
128
0
        module.section(&section);
129
0
    }
Unexecuted instantiation: <wasm_smith::ConfiguredModule<universal_llvm::NoImportsConfig>>::encode_instances
Unexecuted instantiation: <wasm_smith::ConfiguredModule<wasm_smith::config::DefaultConfig>>::encode_instances
Unexecuted instantiation: <wasm_smith::ConfiguredModule<universal_singlepass::NoImportsConfig>>::encode_instances
Unexecuted instantiation: <wasm_smith::ConfiguredModule<deterministic::NoImportsConfig>>::encode_instances
Unexecuted instantiation: <wasm_smith::ConfiguredModule<metering::NoImportsConfig>>::encode_instances
Unexecuted instantiation: <wasm_smith::ConfiguredModule<universal_cranelift::NoImportsConfig>>::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<universal_llvm::NoImportsConfig>>::encode_modules
Unexecuted instantiation: <wasm_smith::ConfiguredModule<wasm_smith::config::DefaultConfig>>::encode_modules
Unexecuted instantiation: <wasm_smith::ConfiguredModule<universal_singlepass::NoImportsConfig>>::encode_modules
Unexecuted instantiation: <wasm_smith::ConfiguredModule<deterministic::NoImportsConfig>>::encode_modules
Unexecuted instantiation: <wasm_smith::ConfiguredModule<metering::NoImportsConfig>>::encode_modules
Unexecuted instantiation: <wasm_smith::ConfiguredModule<universal_cranelift::NoImportsConfig>>::encode_modules
139
140
17.8k
    fn encode_funcs(&self, module: &mut wasm_encoder::Module) {
141
17.8k
        if self.num_defined_funcs == 0 {
142
1.65k
            return;
143
16.2k
        }
144
16.2k
        let mut funcs = wasm_encoder::FunctionSection::new();
145
255k
        for (ty, _) in self.funcs[self.funcs.len() - self.num_defined_funcs..].iter() {
146
255k
            funcs.function(ty.unwrap());
147
255k
        }
148
16.2k
        module.section(&funcs);
149
17.8k
    }
<wasm_smith::ConfiguredModule<universal_llvm::NoImportsConfig>>::encode_funcs
Line
Count
Source
140
214
    fn encode_funcs(&self, module: &mut wasm_encoder::Module) {
141
214
        if self.num_defined_funcs == 0 {
142
45
            return;
143
169
        }
144
169
        let mut funcs = wasm_encoder::FunctionSection::new();
145
14.1k
        for (ty, _) in self.funcs[self.funcs.len() - self.num_defined_funcs..].iter() {
146
14.1k
            funcs.function(ty.unwrap());
147
14.1k
        }
148
169
        module.section(&funcs);
149
214
    }
Unexecuted instantiation: <wasm_smith::ConfiguredModule<wasm_smith::config::DefaultConfig>>::encode_funcs
<wasm_smith::ConfiguredModule<universal_singlepass::NoImportsConfig>>::encode_funcs
Line
Count
Source
140
12.6k
    fn encode_funcs(&self, module: &mut wasm_encoder::Module) {
141
12.6k
        if self.num_defined_funcs == 0 {
142
872
            return;
143
11.8k
        }
144
11.8k
        let mut funcs = wasm_encoder::FunctionSection::new();
145
197k
        for (ty, _) in self.funcs[self.funcs.len() - self.num_defined_funcs..].iter() {
146
197k
            funcs.function(ty.unwrap());
147
197k
        }
148
11.8k
        module.section(&funcs);
149
12.6k
    }
<wasm_smith::ConfiguredModule<deterministic::NoImportsConfig>>::encode_funcs
Line
Count
Source
140
5.00k
    fn encode_funcs(&self, module: &mut wasm_encoder::Module) {
141
5.00k
        if self.num_defined_funcs == 0 {
142
735
            return;
143
4.27k
        }
144
4.27k
        let mut funcs = wasm_encoder::FunctionSection::new();
145
43.9k
        for (ty, _) in self.funcs[self.funcs.len() - self.num_defined_funcs..].iter() {
146
43.9k
            funcs.function(ty.unwrap());
147
43.9k
        }
148
4.27k
        module.section(&funcs);
149
5.00k
    }
Unexecuted instantiation: <wasm_smith::ConfiguredModule<metering::NoImportsConfig>>::encode_funcs
Unexecuted instantiation: <wasm_smith::ConfiguredModule<universal_cranelift::NoImportsConfig>>::encode_funcs
150
151
17.8k
    fn encode_tables(&self, module: &mut wasm_encoder::Module) {
152
17.8k
        if self.num_defined_tables == 0 {
153
12.0k
            return;
154
5.84k
        }
155
5.84k
        let mut tables = wasm_encoder::TableSection::new();
156
5.84k
        for t in self.tables[self.tables.len() - self.num_defined_tables..].iter() {
157
5.84k
            tables.table(translate_table_type(t));
158
5.84k
        }
159
5.84k
        module.section(&tables);
160
17.8k
    }
<wasm_smith::ConfiguredModule<universal_llvm::NoImportsConfig>>::encode_tables
Line
Count
Source
151
214
    fn encode_tables(&self, module: &mut wasm_encoder::Module) {
152
214
        if self.num_defined_tables == 0 {
153
42
            return;
154
172
        }
155
172
        let mut tables = wasm_encoder::TableSection::new();
156
172
        for t in self.tables[self.tables.len() - self.num_defined_tables..].iter() {
157
172
            tables.table(translate_table_type(t));
158
172
        }
159
172
        module.section(&tables);
160
214
    }
Unexecuted instantiation: <wasm_smith::ConfiguredModule<wasm_smith::config::DefaultConfig>>::encode_tables
<wasm_smith::ConfiguredModule<universal_singlepass::NoImportsConfig>>::encode_tables
Line
Count
Source
151
12.6k
    fn encode_tables(&self, module: &mut wasm_encoder::Module) {
152
12.6k
        if self.num_defined_tables == 0 {
153
9.21k
            return;
154
3.45k
        }
155
3.45k
        let mut tables = wasm_encoder::TableSection::new();
156
3.45k
        for t in self.tables[self.tables.len() - self.num_defined_tables..].iter() {
157
3.45k
            tables.table(translate_table_type(t));
158
3.45k
        }
159
3.45k
        module.section(&tables);
160
12.6k
    }
<wasm_smith::ConfiguredModule<deterministic::NoImportsConfig>>::encode_tables
Line
Count
Source
151
5.00k
    fn encode_tables(&self, module: &mut wasm_encoder::Module) {
152
5.00k
        if self.num_defined_tables == 0 {
153
2.78k
            return;
154
2.21k
        }
155
2.21k
        let mut tables = wasm_encoder::TableSection::new();
156
2.21k
        for t in self.tables[self.tables.len() - self.num_defined_tables..].iter() {
157
2.21k
            tables.table(translate_table_type(t));
158
2.21k
        }
159
2.21k
        module.section(&tables);
160
5.00k
    }
Unexecuted instantiation: <wasm_smith::ConfiguredModule<metering::NoImportsConfig>>::encode_tables
Unexecuted instantiation: <wasm_smith::ConfiguredModule<universal_cranelift::NoImportsConfig>>::encode_tables
161
162
17.8k
    fn encode_memories(&self, module: &mut wasm_encoder::Module) {
163
17.8k
        if self.num_defined_memories == 0 {
164
10.8k
            return;
165
7.07k
        }
166
7.07k
        let mut mems = wasm_encoder::MemorySection::new();
167
7.07k
        for m in self.memories[self.memories.len() - self.num_defined_memories..].iter() {
168
7.07k
            mems.memory(translate_memory_type(m));
169
7.07k
        }
170
7.07k
        module.section(&mems);
171
17.8k
    }
<wasm_smith::ConfiguredModule<universal_llvm::NoImportsConfig>>::encode_memories
Line
Count
Source
162
214
    fn encode_memories(&self, module: &mut wasm_encoder::Module) {
163
214
        if self.num_defined_memories == 0 {
164
40
            return;
165
174
        }
166
174
        let mut mems = wasm_encoder::MemorySection::new();
167
174
        for m in self.memories[self.memories.len() - self.num_defined_memories..].iter() {
168
174
            mems.memory(translate_memory_type(m));
169
174
        }
170
174
        module.section(&mems);
171
214
    }
Unexecuted instantiation: <wasm_smith::ConfiguredModule<wasm_smith::config::DefaultConfig>>::encode_memories
<wasm_smith::ConfiguredModule<universal_singlepass::NoImportsConfig>>::encode_memories
Line
Count
Source
162
12.6k
    fn encode_memories(&self, module: &mut wasm_encoder::Module) {
163
12.6k
        if self.num_defined_memories == 0 {
164
8.27k
            return;
165
4.39k
        }
166
4.39k
        let mut mems = wasm_encoder::MemorySection::new();
167
4.39k
        for m in self.memories[self.memories.len() - self.num_defined_memories..].iter() {
168
4.39k
            mems.memory(translate_memory_type(m));
169
4.39k
        }
170
4.39k
        module.section(&mems);
171
12.6k
    }
<wasm_smith::ConfiguredModule<deterministic::NoImportsConfig>>::encode_memories
Line
Count
Source
162
5.00k
    fn encode_memories(&self, module: &mut wasm_encoder::Module) {
163
5.00k
        if self.num_defined_memories == 0 {
164
2.49k
            return;
165
2.50k
        }
166
2.50k
        let mut mems = wasm_encoder::MemorySection::new();
167
2.50k
        for m in self.memories[self.memories.len() - self.num_defined_memories..].iter() {
168
2.50k
            mems.memory(translate_memory_type(m));
169
2.50k
        }
170
2.50k
        module.section(&mems);
171
5.00k
    }
Unexecuted instantiation: <wasm_smith::ConfiguredModule<metering::NoImportsConfig>>::encode_memories
Unexecuted instantiation: <wasm_smith::ConfiguredModule<universal_cranelift::NoImportsConfig>>::encode_memories
172
173
17.8k
    fn encode_globals(&self, module: &mut wasm_encoder::Module) {
174
17.8k
        if self.globals.is_empty() {
175
11.8k
            return;
176
6.05k
        }
177
6.05k
        let mut globals = wasm_encoder::GlobalSection::new();
178
53.7k
        for (idx, expr) in &self.defined_globals {
179
47.7k
            let ty = &self.globals[*idx as usize];
180
47.7k
            globals.global(translate_global_type(ty), translate_instruction(expr));
181
47.7k
        }
182
6.05k
        module.section(&globals);
183
17.8k
    }
<wasm_smith::ConfiguredModule<universal_llvm::NoImportsConfig>>::encode_globals
Line
Count
Source
173
214
    fn encode_globals(&self, module: &mut wasm_encoder::Module) {
174
214
        if self.globals.is_empty() {
175
47
            return;
176
167
        }
177
167
        let mut globals = wasm_encoder::GlobalSection::new();
178
7.61k
        for (idx, expr) in &self.defined_globals {
179
7.45k
            let ty = &self.globals[*idx as usize];
180
7.45k
            globals.global(translate_global_type(ty), translate_instruction(expr));
181
7.45k
        }
182
167
        module.section(&globals);
183
214
    }
Unexecuted instantiation: <wasm_smith::ConfiguredModule<wasm_smith::config::DefaultConfig>>::encode_globals
<wasm_smith::ConfiguredModule<universal_singlepass::NoImportsConfig>>::encode_globals
Line
Count
Source
173
12.6k
    fn encode_globals(&self, module: &mut wasm_encoder::Module) {
174
12.6k
        if self.globals.is_empty() {
175
8.99k
            return;
176
3.67k
        }
177
3.67k
        let mut globals = wasm_encoder::GlobalSection::new();
178
23.6k
        for (idx, expr) in &self.defined_globals {
179
19.9k
            let ty = &self.globals[*idx as usize];
180
19.9k
            globals.global(translate_global_type(ty), translate_instruction(expr));
181
19.9k
        }
182
3.67k
        module.section(&globals);
183
12.6k
    }
<wasm_smith::ConfiguredModule<deterministic::NoImportsConfig>>::encode_globals
Line
Count
Source
173
5.00k
    fn encode_globals(&self, module: &mut wasm_encoder::Module) {
174
5.00k
        if self.globals.is_empty() {
175
2.79k
            return;
176
2.21k
        }
177
2.21k
        let mut globals = wasm_encoder::GlobalSection::new();
178
22.5k
        for (idx, expr) in &self.defined_globals {
179
20.3k
            let ty = &self.globals[*idx as usize];
180
20.3k
            globals.global(translate_global_type(ty), translate_instruction(expr));
181
20.3k
        }
182
2.21k
        module.section(&globals);
183
5.00k
    }
Unexecuted instantiation: <wasm_smith::ConfiguredModule<metering::NoImportsConfig>>::encode_globals
Unexecuted instantiation: <wasm_smith::ConfiguredModule<universal_cranelift::NoImportsConfig>>::encode_globals
184
185
17.8k
    fn encode_exports(&self, module: &mut wasm_encoder::Module) {
186
17.8k
        if self.exports.is_empty() {
187
13.3k
            return;
188
4.56k
        }
189
4.56k
        let mut exports = wasm_encoder::ExportSection::new();
190
71.8k
        for (name, export) in &self.exports {
191
67.3k
            exports.export(name, translate_export(export));
192
67.3k
        }
193
4.56k
        module.section(&exports);
194
17.8k
    }
<wasm_smith::ConfiguredModule<universal_llvm::NoImportsConfig>>::encode_exports
Line
Count
Source
185
214
    fn encode_exports(&self, module: &mut wasm_encoder::Module) {
186
214
        if self.exports.is_empty() {
187
67
            return;
188
147
        }
189
147
        let mut exports = wasm_encoder::ExportSection::new();
190
4.40k
        for (name, export) in &self.exports {
191
4.25k
            exports.export(name, translate_export(export));
192
4.25k
        }
193
147
        module.section(&exports);
194
214
    }
Unexecuted instantiation: <wasm_smith::ConfiguredModule<wasm_smith::config::DefaultConfig>>::encode_exports
<wasm_smith::ConfiguredModule<universal_singlepass::NoImportsConfig>>::encode_exports
Line
Count
Source
185
12.6k
    fn encode_exports(&self, module: &mut wasm_encoder::Module) {
186
12.6k
        if self.exports.is_empty() {
187
10.3k
            return;
188
2.32k
        }
189
2.32k
        let mut exports = wasm_encoder::ExportSection::new();
190
33.5k
        for (name, export) in &self.exports {
191
31.1k
            exports.export(name, translate_export(export));
192
31.1k
        }
193
2.32k
        module.section(&exports);
194
12.6k
    }
<wasm_smith::ConfiguredModule<deterministic::NoImportsConfig>>::encode_exports
Line
Count
Source
185
5.00k
    fn encode_exports(&self, module: &mut wasm_encoder::Module) {
186
5.00k
        if self.exports.is_empty() {
187
2.90k
            return;
188
2.09k
        }
189
2.09k
        let mut exports = wasm_encoder::ExportSection::new();
190
33.9k
        for (name, export) in &self.exports {
191
31.8k
            exports.export(name, translate_export(export));
192
31.8k
        }
193
2.09k
        module.section(&exports);
194
5.00k
    }
Unexecuted instantiation: <wasm_smith::ConfiguredModule<metering::NoImportsConfig>>::encode_exports
Unexecuted instantiation: <wasm_smith::ConfiguredModule<universal_cranelift::NoImportsConfig>>::encode_exports
195
196
17.8k
    fn encode_start(&self, module: &mut wasm_encoder::Module) {
197
17.8k
        if let Some(f) = self.start {
198
0
            module.section(&wasm_encoder::StartSection { function_index: f });
199
17.8k
        }
200
17.8k
    }
<wasm_smith::ConfiguredModule<universal_llvm::NoImportsConfig>>::encode_start
Line
Count
Source
196
214
    fn encode_start(&self, module: &mut wasm_encoder::Module) {
197
214
        if let Some(f) = self.start {
198
0
            module.section(&wasm_encoder::StartSection { function_index: f });
199
214
        }
200
214
    }
Unexecuted instantiation: <wasm_smith::ConfiguredModule<wasm_smith::config::DefaultConfig>>::encode_start
<wasm_smith::ConfiguredModule<universal_singlepass::NoImportsConfig>>::encode_start
Line
Count
Source
196
12.6k
    fn encode_start(&self, module: &mut wasm_encoder::Module) {
197
12.6k
        if let Some(f) = self.start {
198
0
            module.section(&wasm_encoder::StartSection { function_index: f });
199
12.6k
        }
200
12.6k
    }
<wasm_smith::ConfiguredModule<deterministic::NoImportsConfig>>::encode_start
Line
Count
Source
196
5.00k
    fn encode_start(&self, module: &mut wasm_encoder::Module) {
197
5.00k
        if let Some(f) = self.start {
198
0
            module.section(&wasm_encoder::StartSection { function_index: f });
199
5.00k
        }
200
5.00k
    }
Unexecuted instantiation: <wasm_smith::ConfiguredModule<metering::NoImportsConfig>>::encode_start
Unexecuted instantiation: <wasm_smith::ConfiguredModule<universal_cranelift::NoImportsConfig>>::encode_start
201
202
17.8k
    fn encode_elems(&self, module: &mut wasm_encoder::Module) {
203
17.8k
        if self.elems.is_empty() {
204
16.0k
            return;
205
1.87k
        }
206
1.87k
        let mut elems = wasm_encoder::ElementSection::new();
207
1.87k
        let mut exps = vec![];
208
27.2k
        for el in &self.elems {
209
25.3k
            let elem_ty = translate_val_type(el.ty);
210
25.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<universal_llvm::NoImportsConfig>>::encode_elems::{closure#0}
Unexecuted instantiation: <wasm_smith::ConfiguredModule<wasm_smith::config::DefaultConfig>>::encode_elems::{closure#0}
Unexecuted instantiation: <wasm_smith::ConfiguredModule<universal_singlepass::NoImportsConfig>>::encode_elems::{closure#0}
Unexecuted instantiation: <wasm_smith::ConfiguredModule<deterministic::NoImportsConfig>>::encode_elems::{closure#0}
Unexecuted instantiation: <wasm_smith::ConfiguredModule<metering::NoImportsConfig>>::encode_elems::{closure#0}
Unexecuted instantiation: <wasm_smith::ConfiguredModule<universal_cranelift::NoImportsConfig>>::encode_elems::{closure#0}
217
0
                    wasm_encoder::Elements::Expressions(&exps)
218
                }
219
25.3k
                Elements::Functions(fs) => wasm_encoder::Elements::Functions(fs),
220
            };
221
25.3k
            match &el.kind {
222
25.3k
                ElementKind::Active { table, offset } => {
223
25.3k
                    elems.active(*table, translate_instruction(offset), elem_ty, elements);
224
25.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
1.87k
        module.section(&elems);
234
17.8k
    }
<wasm_smith::ConfiguredModule<universal_llvm::NoImportsConfig>>::encode_elems
Line
Count
Source
202
214
    fn encode_elems(&self, module: &mut wasm_encoder::Module) {
203
214
        if self.elems.is_empty() {
204
129
            return;
205
85
        }
206
85
        let mut elems = wasm_encoder::ElementSection::new();
207
85
        let mut exps = vec![];
208
2.24k
        for el in &self.elems {
209
2.15k
            let elem_ty = translate_val_type(el.ty);
210
2.15k
            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
2.15k
                Elements::Functions(fs) => wasm_encoder::Elements::Functions(fs),
220
            };
221
2.15k
            match &el.kind {
222
2.15k
                ElementKind::Active { table, offset } => {
223
2.15k
                    elems.active(*table, translate_instruction(offset), elem_ty, elements);
224
2.15k
                }
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
85
        module.section(&elems);
234
214
    }
Unexecuted instantiation: <wasm_smith::ConfiguredModule<wasm_smith::config::DefaultConfig>>::encode_elems
<wasm_smith::ConfiguredModule<universal_singlepass::NoImportsConfig>>::encode_elems
Line
Count
Source
202
12.6k
    fn encode_elems(&self, module: &mut wasm_encoder::Module) {
203
12.6k
        if self.elems.is_empty() {
204
11.7k
            return;
205
912
        }
206
912
        let mut elems = wasm_encoder::ElementSection::new();
207
912
        let mut exps = vec![];
208
9.99k
        for el in &self.elems {
209
9.08k
            let elem_ty = translate_val_type(el.ty);
210
9.08k
            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
9.08k
                Elements::Functions(fs) => wasm_encoder::Elements::Functions(fs),
220
            };
221
9.08k
            match &el.kind {
222
9.08k
                ElementKind::Active { table, offset } => {
223
9.08k
                    elems.active(*table, translate_instruction(offset), elem_ty, elements);
224
9.08k
                }
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
912
        module.section(&elems);
234
12.6k
    }
<wasm_smith::ConfiguredModule<deterministic::NoImportsConfig>>::encode_elems
Line
Count
Source
202
5.00k
    fn encode_elems(&self, module: &mut wasm_encoder::Module) {
203
5.00k
        if self.elems.is_empty() {
204
4.12k
            return;
205
880
        }
206
880
        let mut elems = wasm_encoder::ElementSection::new();
207
880
        let mut exps = vec![];
208
14.9k
        for el in &self.elems {
209
14.0k
            let elem_ty = translate_val_type(el.ty);
210
14.0k
            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
14.0k
                Elements::Functions(fs) => wasm_encoder::Elements::Functions(fs),
220
            };
221
14.0k
            match &el.kind {
222
14.0k
                ElementKind::Active { table, offset } => {
223
14.0k
                    elems.active(*table, translate_instruction(offset), elem_ty, elements);
224
14.0k
                }
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
880
        module.section(&elems);
234
5.00k
    }
Unexecuted instantiation: <wasm_smith::ConfiguredModule<metering::NoImportsConfig>>::encode_elems
Unexecuted instantiation: <wasm_smith::ConfiguredModule<universal_cranelift::NoImportsConfig>>::encode_elems
235
236
17.8k
    fn encode_data_count(&self, module: &mut wasm_encoder::Module) {
237
17.8k
        // Without bulk memory there's no need for a data count section,
238
17.8k
        if !self.config.bulk_memory_enabled() {
239
17.8k
            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
17.8k
    }
<wasm_smith::ConfiguredModule<universal_llvm::NoImportsConfig>>::encode_data_count
Line
Count
Source
236
214
    fn encode_data_count(&self, module: &mut wasm_encoder::Module) {
237
214
        // Without bulk memory there's no need for a data count section,
238
214
        if !self.config.bulk_memory_enabled() {
239
214
            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
214
    }
Unexecuted instantiation: <wasm_smith::ConfiguredModule<wasm_smith::config::DefaultConfig>>::encode_data_count
<wasm_smith::ConfiguredModule<universal_singlepass::NoImportsConfig>>::encode_data_count
Line
Count
Source
236
12.6k
    fn encode_data_count(&self, module: &mut wasm_encoder::Module) {
237
12.6k
        // Without bulk memory there's no need for a data count section,
238
12.6k
        if !self.config.bulk_memory_enabled() {
239
12.6k
            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
12.6k
    }
<wasm_smith::ConfiguredModule<deterministic::NoImportsConfig>>::encode_data_count
Line
Count
Source
236
5.00k
    fn encode_data_count(&self, module: &mut wasm_encoder::Module) {
237
5.00k
        // Without bulk memory there's no need for a data count section,
238
5.00k
        if !self.config.bulk_memory_enabled() {
239
5.00k
            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
5.00k
    }
Unexecuted instantiation: <wasm_smith::ConfiguredModule<metering::NoImportsConfig>>::encode_data_count
Unexecuted instantiation: <wasm_smith::ConfiguredModule<universal_cranelift::NoImportsConfig>>::encode_data_count
249
250
17.8k
    fn encode_code(&self, module: &mut wasm_encoder::Module) {
251
17.8k
        if self.code.is_empty() {
252
1.65k
            return;
253
16.2k
        }
254
16.2k
        let mut code = wasm_encoder::CodeSection::new();
255
271k
        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
255k
            let mut func =
259
1.06M
                wasm_encoder::Function::new(c.locals.iter().map(|l| (1, translate_val_type(*l))));
<wasm_smith::ConfiguredModule<universal_llvm::NoImportsConfig>>::encode_code::{closure#0}
Line
Count
Source
259
94.7k
                wasm_encoder::Function::new(c.locals.iter().map(|l| (1, translate_val_type(*l))));
Unexecuted instantiation: <wasm_smith::ConfiguredModule<wasm_smith::config::DefaultConfig>>::encode_code::{closure#0}
<wasm_smith::ConfiguredModule<universal_singlepass::NoImportsConfig>>::encode_code::{closure#0}
Line
Count
Source
259
593k
                wasm_encoder::Function::new(c.locals.iter().map(|l| (1, translate_val_type(*l))));
<wasm_smith::ConfiguredModule<deterministic::NoImportsConfig>>::encode_code::{closure#0}
Line
Count
Source
259
378k
                wasm_encoder::Function::new(c.locals.iter().map(|l| (1, translate_val_type(*l))));
Unexecuted instantiation: <wasm_smith::ConfiguredModule<metering::NoImportsConfig>>::encode_code::{closure#0}
Unexecuted instantiation: <wasm_smith::ConfiguredModule<universal_cranelift::NoImportsConfig>>::encode_code::{closure#0}
260
255k
            match &c.instructions {
261
255k
                Instructions::Generated(instrs) => {
262
9.31M
                    for instr in instrs {
263
9.05M
                        func.instruction(translate_instruction(instr));
264
9.05M
                    }
265
255k
                    func.instruction(wasm_encoder::Instruction::End);
266
                }
267
0
                Instructions::Arbitrary(body) => {
268
0
                    func.raw(body.iter().copied());
269
0
                }
270
            }
271
255k
            code.function(&func);
272
        }
273
16.2k
        module.section(&code);
274
17.8k
    }
<wasm_smith::ConfiguredModule<universal_llvm::NoImportsConfig>>::encode_code
Line
Count
Source
250
214
    fn encode_code(&self, module: &mut wasm_encoder::Module) {
251
214
        if self.code.is_empty() {
252
45
            return;
253
169
        }
254
169
        let mut code = wasm_encoder::CodeSection::new();
255
14.2k
        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
14.1k
            let mut func =
259
14.1k
                wasm_encoder::Function::new(c.locals.iter().map(|l| (1, translate_val_type(*l))));
260
14.1k
            match &c.instructions {
261
14.1k
                Instructions::Generated(instrs) => {
262
1.01M
                    for instr in instrs {
263
1.00M
                        func.instruction(translate_instruction(instr));
264
1.00M
                    }
265
14.1k
                    func.instruction(wasm_encoder::Instruction::End);
266
                }
267
0
                Instructions::Arbitrary(body) => {
268
0
                    func.raw(body.iter().copied());
269
0
                }
270
            }
271
14.1k
            code.function(&func);
272
        }
273
169
        module.section(&code);
274
214
    }
Unexecuted instantiation: <wasm_smith::ConfiguredModule<wasm_smith::config::DefaultConfig>>::encode_code
<wasm_smith::ConfiguredModule<universal_singlepass::NoImportsConfig>>::encode_code
Line
Count
Source
250
12.6k
    fn encode_code(&self, module: &mut wasm_encoder::Module) {
251
12.6k
        if self.code.is_empty() {
252
872
            return;
253
11.8k
        }
254
11.8k
        let mut code = wasm_encoder::CodeSection::new();
255
208k
        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
197k
            let mut func =
259
197k
                wasm_encoder::Function::new(c.locals.iter().map(|l| (1, translate_val_type(*l))));
260
197k
            match &c.instructions {
261
197k
                Instructions::Generated(instrs) => {
262
7.06M
                    for instr in instrs {
263
6.86M
                        func.instruction(translate_instruction(instr));
264
6.86M
                    }
265
197k
                    func.instruction(wasm_encoder::Instruction::End);
266
                }
267
0
                Instructions::Arbitrary(body) => {
268
0
                    func.raw(body.iter().copied());
269
0
                }
270
            }
271
197k
            code.function(&func);
272
        }
273
11.8k
        module.section(&code);
274
12.6k
    }
<wasm_smith::ConfiguredModule<deterministic::NoImportsConfig>>::encode_code
Line
Count
Source
250
5.00k
    fn encode_code(&self, module: &mut wasm_encoder::Module) {
251
5.00k
        if self.code.is_empty() {
252
735
            return;
253
4.27k
        }
254
4.27k
        let mut code = wasm_encoder::CodeSection::new();
255
48.2k
        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
43.9k
            let mut func =
259
43.9k
                wasm_encoder::Function::new(c.locals.iter().map(|l| (1, translate_val_type(*l))));
260
43.9k
            match &c.instructions {
261
43.9k
                Instructions::Generated(instrs) => {
262
1.23M
                    for instr in instrs {
263
1.18M
                        func.instruction(translate_instruction(instr));
264
1.18M
                    }
265
43.9k
                    func.instruction(wasm_encoder::Instruction::End);
266
                }
267
0
                Instructions::Arbitrary(body) => {
268
0
                    func.raw(body.iter().copied());
269
0
                }
270
            }
271
43.9k
            code.function(&func);
272
        }
273
4.27k
        module.section(&code);
274
5.00k
    }
Unexecuted instantiation: <wasm_smith::ConfiguredModule<metering::NoImportsConfig>>::encode_code
Unexecuted instantiation: <wasm_smith::ConfiguredModule<universal_cranelift::NoImportsConfig>>::encode_code
275
276
17.8k
    fn encode_data(&self, module: &mut wasm_encoder::Module) {
277
17.8k
        if self.data.is_empty() {
278
15.8k
            return;
279
2.03k
        }
280
2.03k
        let mut data = wasm_encoder::DataSection::new();
281
20.6k
        for seg in &self.data {
282
18.6k
            match &seg.kind {
283
                DataSegmentKind::Active {
284
18.6k
                    memory_index,
285
18.6k
                    offset,
286
18.6k
                } => {
287
18.6k
                    data.active(
288
18.6k
                        *memory_index,
289
18.6k
                        translate_instruction(offset),
290
18.6k
                        seg.init.iter().copied(),
291
18.6k
                    );
292
18.6k
                }
293
0
                DataSegmentKind::Passive => {
294
0
                    data.passive(seg.init.iter().copied());
295
0
                }
296
            }
297
        }
298
2.03k
        module.section(&data);
299
17.8k
    }
<wasm_smith::ConfiguredModule<universal_llvm::NoImportsConfig>>::encode_data
Line
Count
Source
276
214
    fn encode_data(&self, module: &mut wasm_encoder::Module) {
277
214
        if self.data.is_empty() {
278
120
            return;
279
94
        }
280
94
        let mut data = wasm_encoder::DataSection::new();
281
1.63k
        for seg in &self.data {
282
1.54k
            match &seg.kind {
283
                DataSegmentKind::Active {
284
1.54k
                    memory_index,
285
1.54k
                    offset,
286
1.54k
                } => {
287
1.54k
                    data.active(
288
1.54k
                        *memory_index,
289
1.54k
                        translate_instruction(offset),
290
1.54k
                        seg.init.iter().copied(),
291
1.54k
                    );
292
1.54k
                }
293
0
                DataSegmentKind::Passive => {
294
0
                    data.passive(seg.init.iter().copied());
295
0
                }
296
            }
297
        }
298
94
        module.section(&data);
299
214
    }
Unexecuted instantiation: <wasm_smith::ConfiguredModule<wasm_smith::config::DefaultConfig>>::encode_data
<wasm_smith::ConfiguredModule<universal_singlepass::NoImportsConfig>>::encode_data
Line
Count
Source
276
12.6k
    fn encode_data(&self, module: &mut wasm_encoder::Module) {
277
12.6k
        if self.data.is_empty() {
278
11.7k
            return;
279
948
        }
280
948
        let mut data = wasm_encoder::DataSection::new();
281
8.50k
        for seg in &self.data {
282
7.55k
            match &seg.kind {
283
                DataSegmentKind::Active {
284
7.55k
                    memory_index,
285
7.55k
                    offset,
286
7.55k
                } => {
287
7.55k
                    data.active(
288
7.55k
                        *memory_index,
289
7.55k
                        translate_instruction(offset),
290
7.55k
                        seg.init.iter().copied(),
291
7.55k
                    );
292
7.55k
                }
293
0
                DataSegmentKind::Passive => {
294
0
                    data.passive(seg.init.iter().copied());
295
0
                }
296
            }
297
        }
298
948
        module.section(&data);
299
12.6k
    }
<wasm_smith::ConfiguredModule<deterministic::NoImportsConfig>>::encode_data
Line
Count
Source
276
5.00k
    fn encode_data(&self, module: &mut wasm_encoder::Module) {
277
5.00k
        if self.data.is_empty() {
278
4.01k
            return;
279
994
        }
280
994
        let mut data = wasm_encoder::DataSection::new();
281
10.4k
        for seg in &self.data {
282
9.50k
            match &seg.kind {
283
                DataSegmentKind::Active {
284
9.50k
                    memory_index,
285
9.50k
                    offset,
286
9.50k
                } => {
287
9.50k
                    data.active(
288
9.50k
                        *memory_index,
289
9.50k
                        translate_instruction(offset),
290
9.50k
                        seg.init.iter().copied(),
291
9.50k
                    );
292
9.50k
                }
293
0
                DataSegmentKind::Passive => {
294
0
                    data.passive(seg.init.iter().copied());
295
0
                }
296
            }
297
        }
298
994
        module.section(&data);
299
5.00k
    }
Unexecuted instantiation: <wasm_smith::ConfiguredModule<metering::NoImportsConfig>>::encode_data
Unexecuted instantiation: <wasm_smith::ConfiguredModule<universal_cranelift::NoImportsConfig>>::encode_data
300
}
301
302
1.62M
fn translate_val_type(ty: ValType) -> wasm_encoder::ValType {
303
1.62M
    match ty {
304
71.7k
        ValType::I32 => wasm_encoder::ValType::I32,
305
616k
        ValType::I64 => wasm_encoder::ValType::I64,
306
59.3k
        ValType::F32 => wasm_encoder::ValType::F32,
307
844k
        ValType::F64 => wasm_encoder::ValType::F64,
308
31.1k
        ValType::FuncRef => wasm_encoder::ValType::FuncRef,
309
0
        ValType::ExternRef => wasm_encoder::ValType::ExternRef,
310
    }
311
1.62M
}
wasm_smith::encode::translate_val_type
Line
Count
Source
302
288k
fn translate_val_type(ty: ValType) -> wasm_encoder::ValType {
303
288k
    match ty {
304
3.11k
        ValType::I32 => wasm_encoder::ValType::I32,
305
150k
        ValType::I64 => wasm_encoder::ValType::I64,
306
4.73k
        ValType::F32 => wasm_encoder::ValType::F32,
307
128k
        ValType::F64 => wasm_encoder::ValType::F64,
308
2.15k
        ValType::FuncRef => wasm_encoder::ValType::FuncRef,
309
0
        ValType::ExternRef => wasm_encoder::ValType::ExternRef,
310
    }
311
288k
}
wasm_smith::encode::translate_val_type
Line
Count
Source
302
249k
fn translate_val_type(ty: ValType) -> wasm_encoder::ValType {
303
249k
    match ty {
304
23.7k
        ValType::I32 => wasm_encoder::ValType::I32,
305
57.7k
        ValType::I64 => wasm_encoder::ValType::I64,
306
20.1k
        ValType::F32 => wasm_encoder::ValType::F32,
307
141k
        ValType::F64 => wasm_encoder::ValType::F64,
308
5.84k
        ValType::FuncRef => wasm_encoder::ValType::FuncRef,
309
0
        ValType::ExternRef => wasm_encoder::ValType::ExternRef,
310
    }
311
249k
}
wasm_smith::encode::translate_val_type
Line
Count
Source
302
642k
fn translate_val_type(ty: ValType) -> wasm_encoder::ValType {
303
642k
    match ty {
304
28.3k
        ValType::I32 => wasm_encoder::ValType::I32,
305
247k
        ValType::I64 => wasm_encoder::ValType::I64,
306
22.4k
        ValType::F32 => wasm_encoder::ValType::F32,
307
335k
        ValType::F64 => wasm_encoder::ValType::F64,
308
9.08k
        ValType::FuncRef => wasm_encoder::ValType::FuncRef,
309
0
        ValType::ExternRef => wasm_encoder::ValType::ExternRef,
310
    }
311
642k
}
wasm_smith::encode::translate_val_type
Line
Count
Source
302
443k
fn translate_val_type(ty: ValType) -> wasm_encoder::ValType {
303
443k
    match ty {
304
16.6k
        ValType::I32 => wasm_encoder::ValType::I32,
305
161k
        ValType::I64 => wasm_encoder::ValType::I64,
306
12.0k
        ValType::F32 => wasm_encoder::ValType::F32,
307
239k
        ValType::F64 => wasm_encoder::ValType::F64,
308
14.0k
        ValType::FuncRef => wasm_encoder::ValType::FuncRef,
309
0
        ValType::ExternRef => wasm_encoder::ValType::ExternRef,
310
    }
311
443k
}
Unexecuted instantiation: wasm_smith::encode::translate_val_type
Unexecuted instantiation: wasm_smith::encode::translate_val_type
312
313
0
fn translate_entity_type(ty: &EntityType) -> wasm_encoder::EntityType {
314
0
    match ty {
315
0
        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
0
        EntityType::Table(ty) => translate_table_type(ty).into(),
319
0
        EntityType::Memory(m) => translate_memory_type(m).into(),
320
0
        EntityType::Global(g) => translate_global_type(g).into(),
321
    }
322
0
}
323
324
12.9k
fn translate_limits(limits: &Limits) -> wasm_encoder::Limits {
325
12.9k
    wasm_encoder::Limits {
326
12.9k
        min: limits.min,
327
12.9k
        max: limits.max,
328
12.9k
    }
329
12.9k
}
wasm_smith::encode::translate_limits
Line
Count
Source
324
174
fn translate_limits(limits: &Limits) -> wasm_encoder::Limits {
325
174
    wasm_encoder::Limits {
326
174
        min: limits.min,
327
174
        max: limits.max,
328
174
    }
329
174
}
wasm_smith::encode::translate_limits
Line
Count
Source
324
5.84k
fn translate_limits(limits: &Limits) -> wasm_encoder::Limits {
325
5.84k
    wasm_encoder::Limits {
326
5.84k
        min: limits.min,
327
5.84k
        max: limits.max,
328
5.84k
    }
329
5.84k
}
wasm_smith::encode::translate_limits
Line
Count
Source
324
4.39k
fn translate_limits(limits: &Limits) -> wasm_encoder::Limits {
325
4.39k
    wasm_encoder::Limits {
326
4.39k
        min: limits.min,
327
4.39k
        max: limits.max,
328
4.39k
    }
329
4.39k
}
wasm_smith::encode::translate_limits
Line
Count
Source
324
2.50k
fn translate_limits(limits: &Limits) -> wasm_encoder::Limits {
325
2.50k
    wasm_encoder::Limits {
326
2.50k
        min: limits.min,
327
2.50k
        max: limits.max,
328
2.50k
    }
329
2.50k
}
Unexecuted instantiation: wasm_smith::encode::translate_limits
Unexecuted instantiation: wasm_smith::encode::translate_limits
330
331
5.84k
fn translate_table_type(ty: &TableType) -> wasm_encoder::TableType {
332
5.84k
    wasm_encoder::TableType {
333
5.84k
        element_type: translate_val_type(ty.elem_ty),
334
5.84k
        limits: translate_limits(&ty.limits),
335
5.84k
    }
336
5.84k
}
337
338
7.07k
fn translate_memory_type(ty: &MemoryType) -> wasm_encoder::MemoryType {
339
7.07k
    wasm_encoder::MemoryType {
340
7.07k
        limits: translate_limits(&ty.limits),
341
7.07k
    }
342
7.07k
}
wasm_smith::encode::translate_memory_type
Line
Count
Source
338
174
fn translate_memory_type(ty: &MemoryType) -> wasm_encoder::MemoryType {
339
174
    wasm_encoder::MemoryType {
340
174
        limits: translate_limits(&ty.limits),
341
174
    }
342
174
}
Unexecuted instantiation: wasm_smith::encode::translate_memory_type
wasm_smith::encode::translate_memory_type
Line
Count
Source
338
4.39k
fn translate_memory_type(ty: &MemoryType) -> wasm_encoder::MemoryType {
339
4.39k
    wasm_encoder::MemoryType {
340
4.39k
        limits: translate_limits(&ty.limits),
341
4.39k
    }
342
4.39k
}
wasm_smith::encode::translate_memory_type
Line
Count
Source
338
2.50k
fn translate_memory_type(ty: &MemoryType) -> wasm_encoder::MemoryType {
339
2.50k
    wasm_encoder::MemoryType {
340
2.50k
        limits: translate_limits(&ty.limits),
341
2.50k
    }
342
2.50k
}
Unexecuted instantiation: wasm_smith::encode::translate_memory_type
Unexecuted instantiation: wasm_smith::encode::translate_memory_type
343
344
47.7k
fn translate_global_type(ty: &GlobalType) -> wasm_encoder::GlobalType {
345
47.7k
    wasm_encoder::GlobalType {
346
47.7k
        val_type: translate_val_type(ty.val_type),
347
47.7k
        mutable: ty.mutable,
348
47.7k
    }
349
47.7k
}
350
351
380k
fn translate_block_type(ty: BlockType) -> wasm_encoder::BlockType {
352
380k
    match ty {
353
162k
        BlockType::Empty => wasm_encoder::BlockType::Empty,
354
195k
        BlockType::Result(ty) => wasm_encoder::BlockType::Result(translate_val_type(ty)),
355
22.2k
        BlockType::FuncType(f) => wasm_encoder::BlockType::FunctionType(f),
356
    }
357
380k
}
358
359
343k
fn translate_mem_arg(m: MemArg) -> wasm_encoder::MemArg {
360
343k
    wasm_encoder::MemArg {
361
343k
        offset: m.offset,
362
343k
        align: m.align,
363
343k
        memory_index: m.memory_index,
364
343k
    }
365
343k
}
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
}
Unexecuted instantiation: wasm_smith::encode::translate_item_kind
Unexecuted instantiation: wasm_smith::encode::translate_item_kind
Unexecuted instantiation: wasm_smith::encode::translate_item_kind
Unexecuted instantiation: wasm_smith::encode::translate_item_kind
Unexecuted instantiation: wasm_smith::encode::translate_item_kind
Unexecuted instantiation: wasm_smith::encode::translate_item_kind
377
378
67.3k
fn translate_export(export: &Export) -> wasm_encoder::Export {
379
67.3k
    match export {
380
13.1k
        Export::Func(idx) => wasm_encoder::Export::Function(*idx),
381
18.5k
        Export::Table(idx) => wasm_encoder::Export::Table(*idx),
382
13.8k
        Export::Memory(idx) => wasm_encoder::Export::Memory(*idx),
383
21.8k
        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
67.3k
}
wasm_smith::encode::translate_export
Line
Count
Source
378
4.25k
fn translate_export(export: &Export) -> wasm_encoder::Export {
379
4.25k
    match export {
380
146
        Export::Func(idx) => wasm_encoder::Export::Function(*idx),
381
1.31k
        Export::Table(idx) => wasm_encoder::Export::Table(*idx),
382
519
        Export::Memory(idx) => wasm_encoder::Export::Memory(*idx),
383
2.27k
        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
4.25k
}
Unexecuted instantiation: wasm_smith::encode::translate_export
wasm_smith::encode::translate_export
Line
Count
Source
378
31.1k
fn translate_export(export: &Export) -> wasm_encoder::Export {
379
31.1k
    match export {
380
7.50k
        Export::Func(idx) => wasm_encoder::Export::Function(*idx),
381
8.51k
        Export::Table(idx) => wasm_encoder::Export::Table(*idx),
382
6.63k
        Export::Memory(idx) => wasm_encoder::Export::Memory(*idx),
383
8.53k
        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
31.1k
}
wasm_smith::encode::translate_export
Line
Count
Source
378
31.8k
fn translate_export(export: &Export) -> wasm_encoder::Export {
379
31.8k
    match export {
380
5.47k
        Export::Func(idx) => wasm_encoder::Export::Function(*idx),
381
8.71k
        Export::Table(idx) => wasm_encoder::Export::Table(*idx),
382
6.65k
        Export::Memory(idx) => wasm_encoder::Export::Memory(*idx),
383
11.0k
        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
31.8k
}
Unexecuted instantiation: wasm_smith::encode::translate_export
Unexecuted instantiation: wasm_smith::encode::translate_export
388
389
9.15M
fn translate_instruction(inst: &Instruction) -> wasm_encoder::Instruction {
390
9.15M
    use Instruction::*;
391
9.15M
    match *inst {
392
        // Control instructions.
393
554k
        Unreachable => wasm_encoder::Instruction::Unreachable,
394
213k
        Nop => wasm_encoder::Instruction::Nop,
395
162k
        Block(bt) => wasm_encoder::Instruction::Block(translate_block_type(bt)),
396
195k
        Loop(bt) => wasm_encoder::Instruction::Loop(translate_block_type(bt)),
397
21.3k
        If(bt) => wasm_encoder::Instruction::If(translate_block_type(bt)),
398
16.9k
        Else => wasm_encoder::Instruction::Else,
399
380k
        End => wasm_encoder::Instruction::End,
400
216k
        Br(x) => wasm_encoder::Instruction::Br(x),
401
41.6k
        BrIf(x) => wasm_encoder::Instruction::BrIf(x),
402
72.3k
        BrTable(ref ls, l) => wasm_encoder::Instruction::BrTable(ls, l),
403
116k
        Return => wasm_encoder::Instruction::Return,
404
161k
        Call(x) => wasm_encoder::Instruction::Call(x),
405
74.9k
        CallIndirect { ty, table } => wasm_encoder::Instruction::CallIndirect { ty, table },
406
407
        // Parametric instructions.
408
167k
        Drop => wasm_encoder::Instruction::Drop,
409
18.7k
        Select => wasm_encoder::Instruction::Select,
410
411
        // Variable instructions.
412
1.11M
        LocalGet(x) => wasm_encoder::Instruction::LocalGet(x),
413
66.2k
        LocalSet(x) => wasm_encoder::Instruction::LocalSet(x),
414
132k
        LocalTee(x) => wasm_encoder::Instruction::LocalTee(x),
415
325k
        GlobalGet(x) => wasm_encoder::Instruction::GlobalGet(x),
416
23.4k
        GlobalSet(x) => wasm_encoder::Instruction::GlobalSet(x),
417
418
        // Memory instructions.
419
37.8k
        I32Load(m) => wasm_encoder::Instruction::I32Load(translate_mem_arg(m)),
420
25.3k
        I64Load(m) => wasm_encoder::Instruction::I64Load(translate_mem_arg(m)),
421
9.20k
        F32Load(m) => wasm_encoder::Instruction::F32Load(translate_mem_arg(m)),
422
12.3k
        F64Load(m) => wasm_encoder::Instruction::F64Load(translate_mem_arg(m)),
423
25.4k
        I32Load8_S(m) => wasm_encoder::Instruction::I32Load8_S(translate_mem_arg(m)),
424
15.4k
        I32Load8_U(m) => wasm_encoder::Instruction::I32Load8_U(translate_mem_arg(m)),
425
46.6k
        I32Load16_S(m) => wasm_encoder::Instruction::I32Load16_S(translate_mem_arg(m)),
426
51.2k
        I32Load16_U(m) => wasm_encoder::Instruction::I32Load16_U(translate_mem_arg(m)),
427
6.81k
        I64Load8_S(m) => wasm_encoder::Instruction::I64Load8_S(translate_mem_arg(m)),
428
6.76k
        I64Load8_U(m) => wasm_encoder::Instruction::I64Load8_U(translate_mem_arg(m)),
429
21.0k
        I64Load16_S(m) => wasm_encoder::Instruction::I64Load16_S(translate_mem_arg(m)),
430
25.2k
        I64Load16_U(m) => wasm_encoder::Instruction::I64Load16_U(translate_mem_arg(m)),
431
26.0k
        I64Load32_S(m) => wasm_encoder::Instruction::I64Load32_S(translate_mem_arg(m)),
432
8.78k
        I64Load32_U(m) => wasm_encoder::Instruction::I64Load32_U(translate_mem_arg(m)),
433
526
        I32Store(m) => wasm_encoder::Instruction::I32Store(translate_mem_arg(m)),
434
8.35k
        I64Store(m) => wasm_encoder::Instruction::I64Store(translate_mem_arg(m)),
435
1.86k
        F32Store(m) => wasm_encoder::Instruction::F32Store(translate_mem_arg(m)),
436
1.02k
        F64Store(m) => wasm_encoder::Instruction::F64Store(translate_mem_arg(m)),
437
1.12k
        I32Store8(m) => wasm_encoder::Instruction::I32Store8(translate_mem_arg(m)),
438
2.35k
        I32Store16(m) => wasm_encoder::Instruction::I32Store16(translate_mem_arg(m)),
439
2.66k
        I64Store8(m) => wasm_encoder::Instruction::I64Store8(translate_mem_arg(m)),
440
1.33k
        I64Store16(m) => wasm_encoder::Instruction::I64Store16(translate_mem_arg(m)),
441
5.53k
        I64Store32(m) => wasm_encoder::Instruction::I64Store32(translate_mem_arg(m)),
442
149k
        MemorySize(x) => wasm_encoder::Instruction::MemorySize(x),
443
31.4k
        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
412k
        I32Const(x) => wasm_encoder::Instruction::I32Const(x),
451
239k
        I64Const(x) => wasm_encoder::Instruction::I64Const(x),
452
315k
        F32Const(x) => wasm_encoder::Instruction::F32Const(x),
453
210k
        F64Const(x) => wasm_encoder::Instruction::F64Const(x),
454
40.4k
        I32Eqz => wasm_encoder::Instruction::I32Eqz,
455
8.61k
        I32Eq => wasm_encoder::Instruction::I32Eq,
456
5.88k
        I32Neq => wasm_encoder::Instruction::I32Neq,
457
1.79k
        I32LtS => wasm_encoder::Instruction::I32LtS,
458
2.51k
        I32LtU => wasm_encoder::Instruction::I32LtU,
459
22.0k
        I32GtS => wasm_encoder::Instruction::I32GtS,
460
3.65k
        I32GtU => wasm_encoder::Instruction::I32GtU,
461
2.99k
        I32LeS => wasm_encoder::Instruction::I32LeS,
462
1.66k
        I32LeU => wasm_encoder::Instruction::I32LeU,
463
5.70k
        I32GeS => wasm_encoder::Instruction::I32GeS,
464
2.49k
        I32GeU => wasm_encoder::Instruction::I32GeU,
465
54.4k
        I64Eqz => wasm_encoder::Instruction::I64Eqz,
466
3.81k
        I64Eq => wasm_encoder::Instruction::I64Eq,
467
2.16k
        I64Neq => wasm_encoder::Instruction::I64Neq,
468
3.66k
        I64LtS => wasm_encoder::Instruction::I64LtS,
469
3.78k
        I64LtU => wasm_encoder::Instruction::I64LtU,
470
4.09k
        I64GtS => wasm_encoder::Instruction::I64GtS,
471
6.31k
        I64GtU => wasm_encoder::Instruction::I64GtU,
472
2.88k
        I64LeS => wasm_encoder::Instruction::I64LeS,
473
1.18k
        I64LeU => wasm_encoder::Instruction::I64LeU,
474
3.70k
        I64GeS => wasm_encoder::Instruction::I64GeS,
475
2.45k
        I64GeU => wasm_encoder::Instruction::I64GeU,
476
1.53k
        F32Eq => wasm_encoder::Instruction::F32Eq,
477
6.48k
        F32Neq => wasm_encoder::Instruction::F32Neq,
478
14.8k
        F32Lt => wasm_encoder::Instruction::F32Lt,
479
6.06k
        F32Gt => wasm_encoder::Instruction::F32Gt,
480
8.72k
        F32Le => wasm_encoder::Instruction::F32Le,
481
4.26k
        F32Ge => wasm_encoder::Instruction::F32Ge,
482
5.46k
        F64Eq => wasm_encoder::Instruction::F64Eq,
483
3.31k
        F64Neq => wasm_encoder::Instruction::F64Neq,
484
4.46k
        F64Lt => wasm_encoder::Instruction::F64Lt,
485
20.8k
        F64Gt => wasm_encoder::Instruction::F64Gt,
486
38.4k
        F64Le => wasm_encoder::Instruction::F64Le,
487
5.99k
        F64Ge => wasm_encoder::Instruction::F64Ge,
488
54.3k
        I32Clz => wasm_encoder::Instruction::I32Clz,
489
38.3k
        I32Ctz => wasm_encoder::Instruction::I32Ctz,
490
34.6k
        I32Popcnt => wasm_encoder::Instruction::I32Popcnt,
491
5.45k
        I32Add => wasm_encoder::Instruction::I32Add,
492
4.99k
        I32Sub => wasm_encoder::Instruction::I32Sub,
493
5.75k
        I32Mul => wasm_encoder::Instruction::I32Mul,
494
7.48k
        I32DivS => wasm_encoder::Instruction::I32DivS,
495
42.3k
        I32DivU => wasm_encoder::Instruction::I32DivU,
496
20.5k
        I32RemS => wasm_encoder::Instruction::I32RemS,
497
31.2k
        I32RemU => wasm_encoder::Instruction::I32RemU,
498
23.6k
        I32And => wasm_encoder::Instruction::I32And,
499
109k
        I32Or => wasm_encoder::Instruction::I32Or,
500
35.3k
        I32Xor => wasm_encoder::Instruction::I32Xor,
501
9.47k
        I32Shl => wasm_encoder::Instruction::I32Shl,
502
9.55k
        I32ShrS => wasm_encoder::Instruction::I32ShrS,
503
8.70k
        I32ShrU => wasm_encoder::Instruction::I32ShrU,
504
3.72k
        I32Rotl => wasm_encoder::Instruction::I32Rotl,
505
12.7k
        I32Rotr => wasm_encoder::Instruction::I32Rotr,
506
90.9k
        I64Clz => wasm_encoder::Instruction::I64Clz,
507
69.2k
        I64Ctz => wasm_encoder::Instruction::I64Ctz,
508
55.4k
        I64Popcnt => wasm_encoder::Instruction::I64Popcnt,
509
4.35k
        I64Add => wasm_encoder::Instruction::I64Add,
510
16.4k
        I64Sub => wasm_encoder::Instruction::I64Sub,
511
4.80k
        I64Mul => wasm_encoder::Instruction::I64Mul,
512
1.27k
        I64DivS => wasm_encoder::Instruction::I64DivS,
513
30.4k
        I64DivU => wasm_encoder::Instruction::I64DivU,
514
14.6k
        I64RemS => wasm_encoder::Instruction::I64RemS,
515
18.4k
        I64RemU => wasm_encoder::Instruction::I64RemU,
516
2.68k
        I64And => wasm_encoder::Instruction::I64And,
517
9.17k
        I64Or => wasm_encoder::Instruction::I64Or,
518
23.9k
        I64Xor => wasm_encoder::Instruction::I64Xor,
519
49.6k
        I64Shl => wasm_encoder::Instruction::I64Shl,
520
39.2k
        I64ShrS => wasm_encoder::Instruction::I64ShrS,
521
6.97k
        I64ShrU => wasm_encoder::Instruction::I64ShrU,
522
4.94k
        I64Rotl => wasm_encoder::Instruction::I64Rotl,
523
6.95k
        I64Rotr => wasm_encoder::Instruction::I64Rotr,
524
33.7k
        F32Abs => wasm_encoder::Instruction::F32Abs,
525
29.3k
        F32Neg => wasm_encoder::Instruction::F32Neg,
526
122k
        F32Ceil => wasm_encoder::Instruction::F32Ceil,
527
89.2k
        F32Floor => wasm_encoder::Instruction::F32Floor,
528
76.2k
        F32Trunc => wasm_encoder::Instruction::F32Trunc,
529
28.9k
        F32Nearest => wasm_encoder::Instruction::F32Nearest,
530
44.8k
        F32Sqrt => wasm_encoder::Instruction::F32Sqrt,
531
1.77k
        F32Add => wasm_encoder::Instruction::F32Add,
532
4.22k
        F32Sub => wasm_encoder::Instruction::F32Sub,
533
10.1k
        F32Mul => wasm_encoder::Instruction::F32Mul,
534
6.05k
        F32Div => wasm_encoder::Instruction::F32Div,
535
6.06k
        F32Min => wasm_encoder::Instruction::F32Min,
536
54.3k
        F32Max => wasm_encoder::Instruction::F32Max,
537
669
        F32Copysign => wasm_encoder::Instruction::F32Copysign,
538
75.4k
        F64Abs => wasm_encoder::Instruction::F64Abs,
539
89.5k
        F64Neg => wasm_encoder::Instruction::F64Neg,
540
49.9k
        F64Ceil => wasm_encoder::Instruction::F64Ceil,
541
82.7k
        F64Floor => wasm_encoder::Instruction::F64Floor,
542
100k
        F64Trunc => wasm_encoder::Instruction::F64Trunc,
543
47.0k
        F64Nearest => wasm_encoder::Instruction::F64Nearest,
544
83.2k
        F64Sqrt => wasm_encoder::Instruction::F64Sqrt,
545
3.24k
        F64Add => wasm_encoder::Instruction::F64Add,
546
8.27k
        F64Sub => wasm_encoder::Instruction::F64Sub,
547
10.7k
        F64Mul => wasm_encoder::Instruction::F64Mul,
548
5.04k
        F64Div => wasm_encoder::Instruction::F64Div,
549
17.8k
        F64Min => wasm_encoder::Instruction::F64Min,
550
12.7k
        F64Max => wasm_encoder::Instruction::F64Max,
551
4.69k
        F64Copysign => wasm_encoder::Instruction::F64Copysign,
552
30.2k
        I32WrapI64 => wasm_encoder::Instruction::I32WrapI64,
553
18.9k
        I32TruncF32S => wasm_encoder::Instruction::I32TruncF32S,
554
23.7k
        I32TruncF32U => wasm_encoder::Instruction::I32TruncF32U,
555
33.5k
        I32TruncF64S => wasm_encoder::Instruction::I32TruncF64S,
556
24.9k
        I32TruncF64U => wasm_encoder::Instruction::I32TruncF64U,
557
35.3k
        I64ExtendI32S => wasm_encoder::Instruction::I64ExtendI32S,
558
53.1k
        I64ExtendI32U => wasm_encoder::Instruction::I64ExtendI32U,
559
11.5k
        I64TruncF32S => wasm_encoder::Instruction::I64TruncF32S,
560
9.10k
        I64TruncF32U => wasm_encoder::Instruction::I64TruncF32U,
561
25.6k
        I64TruncF64S => wasm_encoder::Instruction::I64TruncF64S,
562
15.2k
        I64TruncF64U => wasm_encoder::Instruction::I64TruncF64U,
563
14.6k
        F32ConvertI32S => wasm_encoder::Instruction::F32ConvertI32S,
564
22.8k
        F32ConvertI32U => wasm_encoder::Instruction::F32ConvertI32U,
565
17.3k
        F32ConvertI64S => wasm_encoder::Instruction::F32ConvertI64S,
566
41.5k
        F32ConvertI64U => wasm_encoder::Instruction::F32ConvertI64U,
567
31.1k
        F32DemoteF64 => wasm_encoder::Instruction::F32DemoteF64,
568
21.9k
        F64ConvertI32S => wasm_encoder::Instruction::F64ConvertI32S,
569
21.6k
        F64ConvertI32U => wasm_encoder::Instruction::F64ConvertI32U,
570
32.4k
        F64ConvertI64S => wasm_encoder::Instruction::F64ConvertI64S,
571
58.1k
        F64ConvertI64U => wasm_encoder::Instruction::F64ConvertI64U,
572
27.9k
        F64PromoteF32 => wasm_encoder::Instruction::F64PromoteF32,
573
8.12k
        I32ReinterpretF32 => wasm_encoder::Instruction::I32ReinterpretF32,
574
21.3k
        I64ReinterpretF64 => wasm_encoder::Instruction::I64ReinterpretF64,
575
31.1k
        F32ReinterpretI32 => wasm_encoder::Instruction::F32ReinterpretI32,
576
25.7k
        F64ReinterpretI64 => wasm_encoder::Instruction::F64ReinterpretI64,
577
31.0k
        I32Extend8S => wasm_encoder::Instruction::I32Extend8S,
578
27.4k
        I32Extend16S => wasm_encoder::Instruction::I32Extend16S,
579
27.4k
        I64Extend8S => wasm_encoder::Instruction::I64Extend8S,
580
74.1k
        I64Extend16S => wasm_encoder::Instruction::I64Extend16S,
581
48.9k
        I64Extend32S => wasm_encoder::Instruction::I64Extend32S,
582
14.2k
        I32TruncSatF32S => wasm_encoder::Instruction::I32TruncSatF32S,
583
19.6k
        I32TruncSatF32U => wasm_encoder::Instruction::I32TruncSatF32U,
584
20.6k
        I32TruncSatF64S => wasm_encoder::Instruction::I32TruncSatF64S,
585
30.4k
        I32TruncSatF64U => wasm_encoder::Instruction::I32TruncSatF64U,
586
31.5k
        I64TruncSatF32S => wasm_encoder::Instruction::I64TruncSatF32S,
587
25.8k
        I64TruncSatF32U => wasm_encoder::Instruction::I64TruncSatF32U,
588
18.9k
        I64TruncSatF64S => wasm_encoder::Instruction::I64TruncSatF64S,
589
31.1k
        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
9.15M
}