You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'd like to be able to invoke wasm.opt awesome.wast --entry main and automatically get main invoked (as if awesome.wast had (invoke main ...)). This is desirable because I already have valid .wast files (and create .wasm binaries with them), and invoke is an extra for spec's convenience which isn't valid .wast. It's similar to how C programs by default have main as an entry point and UNIX-y environments _start (which then calls main).
binaryen's interpreter supports a similar option, and automatically figure out the number of parameters for main (because the export sometimes has 0, 1, or 2 parameters): WebAssembly/binaryen@c0c40ce
@kripken it's from make opt (the native version of wasm) @sunfishcode I think that is exactly what @jfbastien means. However, that feature has not been implemented in spec yet. I would probably implement it soon, if you want :)
That's what binaryen-shell does now, and it's convenient. We can also standardize on invoke or some declarator for entry point, but right now I'd like something and I'd like it to be uniform between tools, so IMO agreeing with the design isn't as high priority as getting things working.
I actually think that 'invoke' makes much more sense, since you can invoke any exported function. You can just as well allow multiple --invoke parameters on the command line. This is somewhat orthogonal to the start function.
Activity
haxxpop commentedon Feb 3, 2016
lgtm
sunfishcode commentedon Feb 3, 2016
How does this relate to WebAssembly/design#495?
kripken commentedon Feb 3, 2016
What do you mean by
wasm.opt? We don't have a tool by that name currently?haxxpop commentedon Feb 3, 2016
@kripken it's from
make opt(the native version of wasm)@sunfishcode I think that is exactly what @jfbastien means. However, that feature has not been implemented in
specyet. I would probably implement it soon, if you want :)kripken commentedon Feb 3, 2016
@haxxpop oh right, thanks!
sunfishcode commentedon Feb 3, 2016
@haxxpop Yes, it would be good to keep the spec and the design in sync, rather than having them each do their own thing. Thanks!
jfbastien commentedon Feb 3, 2016
That's what binaryen-shell does now, and it's convenient. We can also standardize on invoke or some declarator for entry point, but right now I'd like something and I'd like it to be uniform between tools, so IMO agreeing with the design isn't as high priority as getting things working.
lukewagner commentedon Feb 3, 2016
In the interim before
startis implemented in ml-proto, seems easy enough to work around in the harness by appending(invoke blah)to the .wast.rossberg commentedon Feb 4, 2016
I'll look into it.
jfbastien commentedon Feb 4, 2016
It seems like renaming "invoke" to "start" and enforcing that there's just one is the best approach. I'll add support for "start" to binaryen.
rossberg commentedon Feb 4, 2016
I actually think that 'invoke' makes much more sense, since you can invoke any exported function. You can just as well allow multiple --invoke parameters on the command line. This is somewhat orthogonal to the start function.
jfbastien commentedon Feb 4, 2016
Supporting "start" from binaryen is indeed orthogonal to adding command-line parameters to spec.
I'd rather call the parameter
--entrythough, since binaryen-shell already uses that name and it's consistent with Linux-y things.Support start
jfbastien commentedon Feb 4, 2016
I opened a PR to add start to binaryen: WebAssembly/binaryen#182
Support start
sunfishcode commentedon Feb 12, 2016
With
startnow in both design and spec, is this issue still needed?jfbastien commentedon Feb 12, 2016
No, closing.
Miscellaneous fixes to formal overview document. (WebAssembly#231)