• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

henrythasler / rust-tiny-wasm / 27089938512

07 Jun 2026 10:29AM UTC coverage: 92.847% (-1.3%) from 94.121%
27089938512

Pull #6

github

web-flow
Merge 0a4fe7baf into df49d44a8
Pull Request #6: Feature/floats

426 of 470 new or added lines in 17 files covered. (90.64%)

5 existing lines in 3 files now uncovered.

1921 of 2069 relevant lines covered (92.85%)

64.65 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

95.24
/src/compiler/variable_instr.rs
1
use super::*;
2

3
pub fn compile_local_get(
200✔
4
    variable: &LocalVar,
200✔
5
    offset: usize,
200✔
6
    value_stack: &mut Vec<StackElement>,
200✔
7
    register_pool: &mut RegisterPool,
200✔
8
    machinecode: &mut Vec<u32>,
200✔
9
) {
200✔
10
    match variable.valtype {
200✔
11
        ValType::I32 | ValType::I64 => {
200✔
12
            let reg = register_pool.alloc();
200✔
13
            value_stack.push(StackElement {
200✔
14
                reg: Reg::IReg(reg),
200✔
15
                valtype: variable.valtype,
200✔
16
            });
200✔
17
            machinecode.push(memory::ldr_imm_unsigned_offset(
200✔
18
                reg,
200✔
19
                IReg::SP,
200✔
20
                offset as u32,
200✔
21
                map_valtype_to_memsize(&variable.valtype),
200✔
22
                map_valtype_to_regsize(&variable.valtype),
200✔
23
            ));
200✔
24
        }
200✔
NEW
25
        _ => panic!("Unsupported variable type for local.get"),
×
26
    }
27
}
200✔
28

29
pub fn compile_local_set(
56✔
30
    variable: &LocalVar,
56✔
31
    offset: usize,
56✔
32
    value_stack: &mut Vec<StackElement>,
56✔
33
    register_pool: &mut RegisterPool,
56✔
34
    machinecode: &mut Vec<u32>,
56✔
35
) {
56✔
36
    let element = value_stack
56✔
37
        .pop()
56✔
38
        .expect("value stack should contain at least one element on 'local.set' opcode");
56✔
39

40
    assert_eq!(
56✔
41
        variable.valtype, element.valtype,
42
        "ValType mismatch on 'local.tee'"
43
    );
44

45
    match element.reg {
56✔
46
        Reg::IReg(reg) => machinecode.push(memory::str_imm_unsigned_offset(
56✔
47
            reg,
56✔
48
            IReg::SP,
49
            offset as u32,
56✔
50
            map_valtype_to_memsize(&variable.valtype),
56✔
51
            map_valtype_to_regsize(&variable.valtype),
56✔
52
        )),
NEW
53
        _ => panic!("Unsupported register type for local.set"),
×
54
    }
55
    register_pool.free();
56✔
56
}
56✔
57

58
pub fn compile_local_tee(
6✔
59
    variable: &LocalVar,
6✔
60
    offset: usize,
6✔
61
    value_stack: &mut Vec<StackElement>,
6✔
62
    machinecode: &mut Vec<u32>,
6✔
63
) {
6✔
64
    let element = value_stack
6✔
65
        .pop()
6✔
66
        .expect("value stack should contain at least one element on 'local.set' opcode");
6✔
67

68
    assert_eq!(
6✔
69
        variable.valtype, element.valtype,
70
        "ValType mismatch on 'local.tee'"
71
    );
72

73
    match element.reg {
6✔
74
        Reg::IReg(reg) => machinecode.push(memory::str_imm_unsigned_offset(
6✔
75
            reg,
6✔
76
            IReg::SP,
77
            offset as u32,
6✔
78
            map_valtype_to_memsize(&variable.valtype),
6✔
79
            map_valtype_to_regsize(&variable.valtype),
6✔
80
        )),
NEW
81
        _ => panic!("Unsupported register type for local.tee"),
×
82
    }
83
    value_stack.push(element);
6✔
84
}
6✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc