-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cranelift: emit_stackmaps
should avoid walking the IR if the function doesn't use r32
or r64
#1883
Comments
Subscribe to Label Actioncc @bnjbvr
This issue or pull request has been labeled: "cranelift"
Thus the following users have been cc'd because of the following labels:
To subscribe or unsubscribe from this label, edit the |
Thanks for opening an issue! Do you have any numbers on how much relative time is spent going over the IR, for a large module? This would help quantifying how urgent an issue it is. In any case, agreed that not doing wasteful work is generally good, of course. The idea of using a flag on the function sounds good. Not sure where to put it, since as far as i can tell it's the first usage of a flag in a Function; could be directly there, or DataFlowGraph, etc. |
Not sure how much time is spent doing the pass when there aren't any reference types used, it just came up during review. |
…ce types This fix avoids a small slow down in scenarios where reference types are enabled but a given function doesn't actually use them. Fixes bytecodealliance#1883
…ce types This fix avoids a small slow down in scenarios where reference types are enabled but a given function doesn't actually use them. Fixes bytecodealliance#1883
…ce types This fix avoids a small slow down in scenarios where reference types are enabled but a given function doesn't actually use them. Fixes bytecodealliance#1883
Enabling stack maps and GC safepoints adds another pass over the IR (
emit_stackmaps
) regardless whether the function in question actually uses reference types at all. One could imagine (especially with wasm-bindgen's "switch reference types into table indices at the boundaries" approach, that seems likely to be copied by C/C++) that many functions in a module don't use reference types. For these functions, that extra pass over the IR is a waste of time.We could have a flag on functions that gets set if it uses reference types in any way (and then never gets unset when a particular reference type-using instruction is removed, so we don't have to precisely count them) and in
emit_stackmaps
, only walk the IR if the flag is set (and probablydebug_assert!
that it doesn't have any uses of reference types if the flag is not set).This came up in #1832 (comment) for Wasmtime.
The text was updated successfully, but these errors were encountered: