Sha256: e8098d0cf3e3bda6312ed8232b24744ddbbed643baa71306caa4b5a7e585378d

Contents?: true

Size: 887 Bytes

Versions: 4

Compression:

Stored size: 887 Bytes

Contents

use crate::machinst::{ABIArg, ABIArgSlot, ArgsAccumulator};

// Winch writes the first result to the highest offset, so we need to iterate through the
// args and adjust the offsets down.
pub(super) fn reverse_stack(mut args: ArgsAccumulator, next_stack: u32, uses_extension: bool) {
    for arg in args.args_mut() {
        if let ABIArg::Slots { slots, .. } = arg {
            for slot in slots.iter_mut() {
                if let ABIArgSlot::Stack { offset, ty, .. } = slot {
                    let size = if uses_extension {
                        i64::from(std::cmp::max(ty.bytes(), 8))
                    } else {
                        i64::from(ty.bytes())
                    };
                    *offset = i64::from(next_stack) - *offset - size;
                }
            }
        } else {
            unreachable!("Winch cannot handle {arg:?}");
        }
    }
}

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
wasmtime-29.0.0 ./ext/cargo-vendor/cranelift-codegen-0.116.0/src/isa/winch.rs
wasmtime-28.0.0 ./ext/cargo-vendor/cranelift-codegen-0.115.0/src/isa/winch.rs
wasmtime-27.0.0 ./ext/cargo-vendor/cranelift-codegen-0.114.0/src/isa/winch.rs
wasmtime-26.0.0 ./ext/cargo-vendor/cranelift-codegen-0.113.0/src/isa/winch.rs