Sorry, my response was to Morgaine, not you - perhaps I clicked the wrong
"reply" button, oops :)

Regarding the last point, on the one hand, yes, asm.js and WebAssembly are
lower-level than C. Still, as they are in AST format, they are both far
more readable than say x86 machine code. It's an interesting middle ground.

I would say it is better than reading LLVM assembly, because ifs and loops
are there. However, as you said, LLVM assembly might have more struct info
(if the optimizer did not  remove it). But just overall, LLVM IR is not
that human readable, for example

  %waka = select i1 fcmp ult (float fadd (float fmul (float undef, float
1.0), float 2.0), float 3.0), double 4.0, double 5.0

whereas in asm.js and in WebAssembly, that would be

  waka = (undef * 1.0) + 2.0 < 3.0 ? 4.0 : 5.0;

which is pretty much what a human would write. Taking that plus loops and
ifs, it's very readable in my opinion, even with struct accesses being raw
loads and stores.

- Alon


On Wed, Jun 17, 2015 at 11:36 AM, Pepijn Van Eeckhoudt <
[email protected]> wrote:

> Hi Alon,
>
> On 17 Jun 2015, at 20:12, Alon Zakai <[email protected]> wrote:
>
> I think it is a valid concern to worry about code on the web remaining
> human-readable, and in fact we are being very careful about that, see this
> FAQ entry:
>
>
> I didn’t mean to say that this isn’t a valid concern, just that it’s not
> that much different from what Emscripten is doing today already.
>
> 2. asm.js is currently hard to read due to all the extra | 0 and +
> coercions, etc. The WebAssembly text format will be much cleaner, and much
> more readable.
>
>
> That’s true, but even if you take out all the ‘| 0’s you’re left with code
> that is at a significantly lower level than the original C or C++ code it
> came from. Since struct/class metadata isn’t retained at runtime in C/C++
> you’re left with a bunch of loads and stores from/to the heap and local
> stack variables. It’s useful to be able to see this in text form of course,
> but it’s a challenge to look at this and figure out what the code is
> supposed to be doing. Based on the AST description
> <https://github.com/WebAssembly/design/blob/master/AstSemantics.md> it’ll
> be like reading LLVM assembly or javap output. Retaining expressions as
> ASTs should make it a bit easier to read compared to stack or register
> based bytecode of course. Is that about right?
>
> Pepijn
>
> --
> 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.

Reply via email to