Stream: git-wasmtime

Topic: wasmtime / issue #5456 Assertion "you cannot add an instr...


view this post on Zulip Wasmtime GitHub notifications bot (Dec 16 2022 at 15:10):

alexcrichton labeled issue #5456:

This input:

(module
  (func
    (local i32 f64 v128 v128 v128 v128 v128 v128 f64 f64 f64 v128 v128 v128)
    f32.const 0
    i32.const 0
    f64.const 0
    f64.store align=1
    i32.const 0
    f64.const 0
    f64.store align=4
    i32.const 1
    local.get 3
    v128.load64_lane offset=1416707644 align=1 0
    drop
    drop
  )
  (memory (;0;) 0 2)
)

fails with

$ cargo run compile testcase0.shrunken.wat --static-memory-maximum-size 657468977
    Finished dev [unoptimized + debuginfo] target(s) in 0.12s
     Running `target/debug/wasmtime compile testcase0.shrunken.wat --static-memory-maximum-size 657468977`
thread '<unnamed>' panicked at 'you cannot add an instruction to a block already filled', cranelift/frontend/src/frontend.rs:533:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

cc @fitzgen

view this post on Zulip Wasmtime GitHub notifications bot (Dec 16 2022 at 15:11):

alexcrichton opened issue #5456:

This input:

(module
  (func
    (local i32 f64 v128 v128 v128 v128 v128 v128 f64 f64 f64 v128 v128 v128)
    f32.const 0
    i32.const 0
    f64.const 0
    f64.store align=1
    i32.const 0
    f64.const 0
    f64.store align=4
    i32.const 1
    local.get 3
    v128.load64_lane offset=1416707644 align=1 0
    drop
    drop
  )
  (memory (;0;) 0 2)
)

fails with

$ cargo run compile testcase0.shrunken.wat --static-memory-maximum-size 657468977
    Finished dev [unoptimized + debuginfo] target(s) in 0.12s
     Running `target/debug/wasmtime compile testcase0.shrunken.wat --static-memory-maximum-size 657468977`
thread '<unnamed>' panicked at 'you cannot add an instruction to a block already filled', cranelift/frontend/src/frontend.rs:533:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

cc @fitzgen

view this post on Zulip Wasmtime GitHub notifications bot (Dec 16 2022 at 21:45):

elliottt commented on issue #5456:

Looks like the trap emitted from the bounds checking code is emitted in the middle of a block:
https://github.com/bytecodealliance/wasmtime/blob/d9fdbfd50e653f93403405e4c4fd56cb77d034ae/cranelift/wasm/src/code_translator/bounds_checks.rs#L219-L221

view this post on Zulip Wasmtime GitHub notifications bot (Dec 16 2022 at 21:58):

elliottt edited a comment on issue #5456:

Looks like the trap emitted from the bounds checking code is emitted in the middle of a block:
https://github.com/bytecodealliance/wasmtime/blob/d9fdbfd50e653f93403405e4c4fd56cb77d034ae/cranelift/wasm/src/code_translator/bounds_checks.rs#L219-L221
The block is terminated by the trap, but there are additional instructions emitted after that.

view this post on Zulip Wasmtime GitHub notifications bot (Dec 16 2022 at 22:13):

elliottt edited a comment on issue #5456:

Looks like the trap emitted from the bounds checking code is emitted in the middle of a block:
https://github.com/bytecodealliance/wasmtime/blob/d9fdbfd50e653f93403405e4c4fd56cb77d034ae/cranelift/wasm/src/code_translator/bounds_checks.rs#L219-L221
The block is terminated by the trap, but there are additional instructions emitted after that. Should we stop translating if we've discovered that the load will unconditionally trap?

view this post on Zulip Wasmtime GitHub notifications bot (Jan 03 2023 at 22:04):

fitzgen closed issue #5456:

This input:

(module
  (func
    (local i32 f64 v128 v128 v128 v128 v128 v128 f64 f64 f64 v128 v128 v128)
    f32.const 0
    i32.const 0
    f64.const 0
    f64.store align=1
    i32.const 0
    f64.const 0
    f64.store align=4
    i32.const 1
    local.get 3
    v128.load64_lane offset=1416707644 align=1 0
    drop
    drop
  )
  (memory (;0;) 0 2)
)

fails with

$ cargo run compile testcase0.shrunken.wat --static-memory-maximum-size 657468977
    Finished dev [unoptimized + debuginfo] target(s) in 0.12s
     Running `target/debug/wasmtime compile testcase0.shrunken.wat --static-memory-maximum-size 657468977`
thread '<unnamed>' panicked at 'you cannot add an instruction to a block already filled', cranelift/frontend/src/frontend.rs:533:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

cc @fitzgen


Last updated: Oct 23 2024 at 20:03 UTC