WebAssembly image dithering example

kinke noone at nowhere.com
Fri Aug 3 20:17:14 UTC 2018


On Friday, 3 August 2018 at 19:47:14 UTC, Allen Garvey wrote:
> I will try seeing if I can build the current LDC master from 
> source to test with that, but I have had mixed success with 
> building projects from source in the past.

Probably not worth it, the changes since beta2 are minimal.

> (func $dither (export "dither") (type $t4) (param $p0 i32) 
> (param $p1 i32) (param $p2 i32) (param $p3 i32)
>     (i64.store align=4
>       (get_local $p2)
>       (i64.const 4469670136257392629))
>     (i64.store align=4
>       (i32.add
>         (get_local $p2)
>         (i32.const 8))
>       (i64.const -4753701902744866827))
>     (block $B0
>       (br_if $B0
>         (i32.ge_s
>           (i32.shl
>             (i32.mul
>               (get_local $p0)
>               (get_local $p1))
>             (i32.const 2))
>           (i32.const 1)))
>       (return))
>     (unreachable)
>     (unreachable))
>
> and the browser says the error is on the first unreachable 
> declaration at the end of the function.

I haven't looked into the actual wasm semantics; guessing by your 
report, it looks as if the return after the conditional branch 
[the Firefox textual display is clearer IMO] would return from 
the enclosing block, and not from the function. Otherwise, the 2 
(!) unreachables at the end would truly be unreachable. An LLVM 
issue, I guess.


More information about the digitalmars-d-ldc mailing list