Stream: git-wasmtime

Topic: wasmtime / issue #5159 Cranelift: 'Could not allocate min...


view this post on Zulip Wasmtime GitHub notifications bot (Oct 31 2022 at 12:38):

jakubDoka edited issue #5159:

.clif Test Case (reduced)

function u0:0() windows_fastcall {
    sig0 = (i64 sret, i64) -> i64 sret fast
    fn0 = colocated u0:4 sig0

block0:
    v1 = iconst.i64 0
    v5 = iconst.i64 0
    v6 = call fn0(v5, v1)  ; v5 = 0, v1 = 0
    return
}

Steps to Reproduce

(bug.clif)

function u0:0(i64, i64) windows_fastcall {
    sig0 = (i64 sret, i64) -> i64 sret fast
    sig1 = (i64 sret, i64) -> i64 sret fast
    fn0 = colocated u0:4 sig0
    fn1 = colocated u0:4 sig1

block0(v0: i64, v1: i64):
    v2 = iconst.i8 0
    store v2, v0  ; v2 = 0
    v3 = iadd_imm v0, 4
    v4 = call fn0(v3, v1)
    v5 = iadd_imm v0, 16
    v6 = call fn1(v5, v1)
    return
}

(in cranelift directory)

> cargo run --release bugpoint bug.clif x86_64-pc-windows-msvc

Expected Result

The code I provided should be valid or at least possible to compile unless I overlooked something.

Actual Results

thread '<unnamed>' panicked at 'Could not allocate minimal bundle, but the allocation problem should be possible to solve', C:\Users\LENOVO\.cargo\registry\src\github.com-1ecc6299db9ec823\regalloc2-0.4.1\src\ion\process.rs:1268:17
stack backtrace:
   0: std::panicking::begin_panic<str>
             at /rustc/95a992a68694d8bf3959bd2c0ac27ce9e9208b59\library\std\src\panicking.rs:616
   1: regalloc2::ion::data_structures::Env<cranelift_codegen::machinst::vcode::VCode<enum2$<cranelift_codegen::isa::x64::lower::isle::generated_code::MInst> > >::process_bundle<cranelift_codegen::machinst::vcode::VCode<enum2$<cranelift_codegen::isa::x64::lower:
             at C:\Users\LENOVO\.cargo\registry\src\github.com-1ecc6299db9ec823\regalloc2-0.4.1\src\ion\process.rs:1268
   2: regalloc2::ion::data_structures::Env<cranelift_codegen::machinst::vcode::VCode<enum2$<cranelift_codegen::isa::x64::lower::isle::generated_code::MInst> > >::process_bundles<cranelift_codegen::machinst::vcode::VCode<enum2$<cranelift_codegen::isa::x64::lower
             at C:\Users\LENOVO\.cargo\registry\src\github.com-1ecc6299db9ec823\regalloc2-0.4.1\src\ion\process.rs:44
   3: regalloc2::ion::data_structures::Env<cranelift_codegen::machinst::vcode::VCode<enum2$<cranelift_codegen::isa::x64::lower::isle::generated_code::MInst> > >::run<cranelift_codegen::machinst::vcode::VCode<enum2$<cranelift_codegen::isa::x64::lower::isle::gene
             at C:\Users\LENOVO\.cargo\registry\src\github.com-1ecc6299db9ec823\regalloc2-0.4.1\src\ion\mod.rs:107
   4: regalloc2::ion::run<cranelift_codegen::machinst::vcode::VCode<enum2$<cranelift_codegen::isa::x64::lower::isle::generated_code::MInst> > >
             at C:\Users\LENOVO\.cargo\registry\src\github.com-1ecc6299db9ec823\regalloc2-0.4.1\src\ion\mod.rs:127
   5: regalloc2::run<cranelift_codegen::machinst::vcode::VCode<enum2$<cranelift_codegen::isa::x64::lower::isle::generated_code::MInst> > >
             at C:\Users\LENOVO\.cargo\registry\src\github.com-1ecc6299db9ec823\regalloc2-0.4.1\src\lib.rs:1460
   6: cranelift_codegen::machinst::compile::compile<cranelift_codegen::isa::x64::X64Backend>
             at C:\Users\LENOVO\.cargo\registry\src\github.com-1ecc6299db9ec823\cranelift-codegen-0.89.1\src\machinst\compile.rs:41
   7: cranelift_codegen::isa::x64::X64Backend::compile_vcode
             at C:\Users\LENOVO\.cargo\registry\src\github.com-1ecc6299db9ec823\cranelift-codegen-0.89.1\src\isa\x64\mod.rs:58
   8: cranelift_codegen::isa::x64::impl$1::compile_function
             at C:\Users\LENOVO\.cargo\registry\src\github.com-1ecc6299db9ec823\cranelift-codegen-0.89.1\src\isa\x64\mod.rs:69
   9: cranelift_codegen::context::Context::compile_stencil
             at C:\Users\LENOVO\.cargo\registry\src\github.com-1ecc6299db9ec823\cranelift-codegen-0.89.1\src\context.rs:173
  10: cranelift_codegen::context::Context::compile
             at C:\Users\LENOVO\.cargo\registry\src\github.com-1ecc6299db9ec823\cranelift-codegen-0.89.1\src\context.rs:185
  11: middleware::logic::Worker::compile_current_requests
             at C:\src\rust\catalyst\subcommands\middleware\src\logic.rs:686
  12: middleware::logic::Worker::compile_macros
             at C:\src\rust\catalyst\subcommands\middleware\src\logic.rs:614
  13: middleware::logic::Worker::compile_module
             at C:\src\rust\catalyst\subcommands\middleware\src\logic.rs:591
  14: middleware::logic::impl$2::run::closure$0
             at C:\src\rust\catalyst\subcommands\middleware\src\logic.rs:535
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Versions and Environment

Cranelift version or commit: 0.90.0

Operating system: Windows

Architecture: x86_64

view this post on Zulip Wasmtime GitHub notifications bot (Oct 31 2022 at 14:53):

jakubDoka commented on issue #5159:

Seems like removing sret from return type of imported signatures makes compilation pass, Is sret supposed to be used with return value or argument is enough?

view this post on Zulip Wasmtime GitHub notifications bot (Oct 31 2022 at 14:54):

bjorn3 commented on issue #5159:

Using it as argument is enough.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 31 2022 at 15:44):

jakubDoka commented on issue #5159:

Seems like I was misusing this for a while, nevertheless resulting error is not helpful, Would it be possible to integrate some verification for signatures?

view this post on Zulip Wasmtime GitHub notifications bot (Oct 31 2022 at 18:16):

bjorn3 commented on issue #5159:

Yeah, I think we should check this in the verifier. Adding a StructReturn case to https://github.com/bytecodealliance/wasmtime/blob/95ecb7e4d440605165a74de607de5389508779be/cranelift/codegen/src/verifier/mod.rs#L1741-L1753 would work I think.


Last updated: Dec 23 2024 at 13:07 UTC