Thanks for the testcase! I do see uses, though:
(import "global" "NaN" (global $gimport$12 f64))
[..]
(global $global$1 (mut f64) (global.get $gimport$12))
[..]
(global.get $global$1)
etc.
So it's imported, assigned to a mutable global, and that mutable global is
used.
On Fri, Apr 26, 2019 at 6:49 PM 'Stephen Weber' via emscripten-discuss <
[email protected]> wrote:
> Compiling the attached with
>
> emcc -std=c99 -Wall --memory-init-file 0 -DEMSCRIPTEN -s
> DISABLE_EXCEPTION_CATCHING=1 -s MALLOC=emmalloc -s FILESYSTEM=0 -s
> EXPORTED_FUNCTIONS='["_duk_eval_raw"]' -O3 -g duktape.c
>
> then disassembling with binaryen wasm-dis I see NaN and Infinity
> imports but grepping the disassembly doesn't show any uses I can see.
>
> On Fri, Apr 26, 2019 at 6:07 PM Alon Zakai <[email protected]> wrote:
> >
> > This is a side effect caused by asm2wasm - in asm.js we do need to
> import NaN. But you're right it's unnecessary in wasm.
> >
> > Once we switch away from asm2wasm to the LLVM wasm backend by default,
> this problem will go away.
> >
> > It's odd btw that you see an import that is never used not being
> optimized out - I only see NaN remain when it is actually used. So you
> might be seeing a bug in the binaryen optimizer - if you can share a
> testcase I can take a look at that.
> >
> >
> > On Fri, Apr 26, 2019 at 12:29 PM stephen.weber via emscripten-discuss <
> [email protected]> wrote:
> >>
> >> When compiling some code with emcc I get these imports in the result:
> >>
> >> (import "global" "NaN" (global $gimport$16 f64))
> >> (import "global" "Infinity" (global $gimport$17 f64))
> >>
> >> Why are these needed? Could the values for these constants not exist
> internal to the WASM?
> >>
> >> Also, I searched the disassembly for NaN and it is only here in the
> import -- even when I use -O3 -- so maybe unused import removal is missing
> it for some reason?
> >>
> >> Thanks.
> >>
> >> --
> >> You received this message because you are subscribed to the Google
> Groups "emscripten-discuss" group.
> >> To unsubscribe from this group and stop receiving emails from it, send
> an email to [email protected].
> >> For more options, visit https://groups.google.com/d/optout.
> >
> > --
> > You received this message because you are subscribed to a topic in the
> Google Groups "emscripten-discuss" group.
> > To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/emscripten-discuss/0y1Ve9gz5f0/unsubscribe
> .
> > To unsubscribe from this group and all its topics, send an email to
> [email protected].
> > For more options, visit https://groups.google.com/d/optout.
>
>
>
> --
> singpolyma.net
>
> --
> You received this message because you are subscribed to the Google Groups
> "emscripten-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>
--
You received this message because you are subscribed to the Google Groups
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.