Conversation
| std::vector<Name> getConfigureAllFunctions(); | ||
|
|
||
| // Returns the names of all functions that are JS-called. That includes ones | ||
| // in configureAll (which we look through the module for), and also those |
There was a problem hiding this comment.
Are we still planning to eventually phase out this special handling for configureAll? I think we should to make the usage more consistent across different configureAll usage patterns.
There was a problem hiding this comment.
I think we were discussing removing it, yeah. Once all our users are marking the functions with jsCalled, we can do that.
| // configureAll functions are signature-called, and must also not be | ||
| // modified. | ||
| for (auto func : Intrinsics(*module).getConfigureAllFunctions()) { | ||
| // Signature-called functions must also not be modified. |
There was a problem hiding this comment.
In principle we could still remove a suffix of the parameters, although I'm not sure whether that comes with a performance overhead. Maybe worth checking on that and adding a TODO if there would be no downside.
| // configureAll functions are signature-called, which means their params | ||
| // must not be refined. | ||
| for (auto func : Intrinsics(*module).getConfigureAllFunctions()) { | ||
| // Signature-called functions must not have params refined. |
There was a problem hiding this comment.
Would it make sense to retire the "signature-called" terminology?
There was a problem hiding this comment.
I am torn about that. On the one hand the spec is "js interop" so this is all for JS, but otoh at least this concept could make sense to other embedder languages, so it feels better to be more general.
There was a problem hiding this comment.
So perhaps sig.called makes sense and not js.called, but the lack of a concrete other language makes me unsure. And js.called is easier to grasp, I think.
| ;; RUN: foreach %s %t wasm-opt --remove-unused-module-elements --closed-world -all -S -o - | filecheck %s | ||
|
|
||
| (module | ||
| (@binaryen.js.called) |
There was a problem hiding this comment.
I think the latest changes to the update script should put this annotation down with the function.
| @@ -0,0 +1,24 @@ | |||
| ;; RUN: wasm-opt -all %s -S -o - | filecheck %s | |||
There was a problem hiding this comment.
This can use the update script now.
|
@kripken could you please release a new version of binaryen as soon as this PR is merged? |
|
@bashor sure, no problem. |
|
@bashor version 126 is released! |
|
@kripken supper! Thanks a lot! |
When a function is annotated with this:
then it is assumed to be called from JS (if a reference is taken).
In closed world, we assume such references are not actually
called from the outside, and this annotation can be used to mark
the exceptions that are.
Such functions are not normally exported, but "js called" in
that JS may call them, but not other wasm code (so rec
group type identity does not matter).