dart-sdk/pkg/wasm_builder
Ömer Sinan Ağacan 4c89d9f6e2 [dart2wasm] Improve Wasm stack error messages
Currently if I generate a `call` with incorrect number of values on
stack, I get an error like:

    Unhandled exception:
       local.get 0                i64
       i64.const 1073741823       i64, i64
       i64.gt_u                   i32
       L1: if () -> ()
         local.get 0              i64
         i64.const 0              i64, i64
         i64.const 1073741823     i64, i64, i64
         ref.null Object          i64, i64, i64, ref null Object

    Underflowing base stack of innermost block

After this I usually need to check the type of the function being called
to see how many arguments it's expecting, with their types.

With this change we now report:

    Unhandled exception:
       local.get 0                i64
       i64.const 1073741823       i64, i64
       i64.gt_u                   i32
       L1: if () -> ()
         local.get 0              i64
         i64.const 0              i64, i64
         i64.const 1073741823     i64, i64, i64
         ref.null Object          i64, i64, i64, ref null Object

    Underflowing base stack of innermost block: expected [i64, i64, i64, ref null Object, ref null Object], but stack contained [i64, i64, i64, ref null Object]

Change-Id: I3191ebf6112e90d341cd121a2afd2fc858282c68
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279089
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
2023-01-18 10:13:19 +00:00
..
lib [dart2wasm] Improve Wasm stack error messages 2023-01-18 10:13:19 +00:00
analysis_options.yaml [pkg/wasm_builder] analyze with package:lints 2022-07-07 21:31:28 +00:00
LICENSE
OWNERS
pubspec.yaml [pkg/wasm_builder] analyze with package:lints 2022-07-07 21:31:28 +00:00