Skip to content

Text format: named expressions instead of push/pop? #693

Closed

Description

@qwertie

Reviewing this proposal I would propose, instead of a strict push-pop regime, a simple way of naming trees. That is, instead of

   push:0 call $foo($x)
   push:1 call $bar($y)
   call $qux(pop:0, pop:1)

let's use

   expr #0 call $foo($x)
   expr #1 call $bar($y)
   call $qux(#0, #1)

This is potentially better when writing code by hand because you can give a name to each subtree, and you can use a tree more than once:

```
expr #halve0 ($0 = $0 * 0x0.8p+0) // parens optional
call $foo(#halve0, #halve0)
```

Activity

  1. sunfishcode commented on May 23, 2016

    @sunfishcode
    Member

    That document is an experiment. Please file issues pertaning to it on the repo which contains it, rather than the WebAssembly repo.

  2. qwertie commented on May 23, 2016

    @qwertie
    Author

    @sunfishcode I assumed that since issues were disabled in your copy of the repo, that discussion should take place here. It made sense to me.

    @JSStats the former. push/pop has nothing to do with the binary format, so likewise for expr.

  3. sunfishcode commented on May 23, 2016

    @sunfishcode
    Member

    I didn't realize the issue tracker was not enabled. It is now. Please do keep in mind that this is an experiment.

  4. dschuff commented on May 23, 2016

    @dschuff
    Member

    @sunfishcode It's a personal strawman experiment right up until it gets implemented in a browser. After that it's something more. I actually think it's fine to have an experimental text format (and other experimental stuff) in a browser too, but at that point I think it's also fair to say you can no longer avoid public discussion (including bikeshedding). :)

    Having said that I like the format quite a bit. I agree with you that we don't want re-usable subtrees and, more generally, that the text format should explicitly mirror the wasm semantics and binary encoding. In other words no macro layers, and no reusable subtrees unless we get them in the semantics. There's only one tree, and push and pop are a way to express the structure of the tree. It's not the only possible way, but any other way should be isomorphic (e.g. having push and pop without the numbers would be fine if less readable; allowing them to have names instead of the numbers would be ok, but allowing re-use would mean that the instructions in the text would be different than what is executed or encoded in the binary).

  5. dschuff commented on May 23, 2016

    @dschuff
    Member

    @sunfishcode Sorry I raced with you. https://bugzilla.mozilla.org/show_bug.cgi?id=1274618 says that you're looking to get feedback from users. What forum would that feedback be in? I'm sympathetic to the idea that since this is an experiment we don't need to be having discussion here, but since Mozilla is implementing it I'd like there to be a bit more visibility than just discussion on your github. On the other hand, now that we've had all this noise, maybe that's sufficient if someone opens another discussion on some Moz forum or wherever and links to it here?

  6. sunfishcode commented on May 23, 2016

    @sunfishcode
    Member

    @dschuff I'd like to get our initial implementation up and running before we get too far into this, because I believe that with WebAssembly's unique nature, experiments in context on real code will inform the discussion better than just design docs and a few small examples.

    In the meantime, any questions, concerns, suggestions, opinions, etc. are welcome on my repo's issue tracker.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions