Skip to content

Add a get_and_zero_local operator. #698

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

Closed
ghost opened this issue May 27, 2016 · 2 comments
Closed

Add a get_and_zero_local operator. #698

ghost opened this issue May 27, 2016 · 2 comments

Comments

@ghost
Copy link

ghost commented May 27, 2016

The use case is to help inform the runtime compiler that local variables are not used (or constants) over code ranges.

This might be exploited by a baseline compiler to avoid flushing local variables cached in registers to memory. If a use of a local variable also zeros it then whatever value it had is no longer needed.

For decoding to SSA, if wasm code can use get_and_zero_local on the last use of a local then at control flow merge points the locals not live will be flagged as constant zero rather than having potentially different definitions, and this would avoid the need to emit a phi for them rather a single definition could be carried forward flagged as zero.

My expressionless encoding experiment noted excess phi's being generated for unused locals as a problem, but perhaps being able to zero a local on the last use of a definition offers a way to address this. Something to explore.

@sunfishcode sunfishcode modified the milestone: Discussion Jul 12, 2016
@flagxor
Copy link
Member

flagxor commented Jul 19, 2016

Don't think this is necessary for MVP.
This seems like a very particular flavor of trying to pre-compute liveness. That might be an interesting direction, but also seems very open ended.
Worth exploring in the future.

@ghost
Copy link
Author

ghost commented Jul 20, 2016

@flagxor It might not be necessary for the MVP, or it might be, we just don't have a MVP at this point and far from it I seem to be the only person articulating any design that might scale to handle multiple values. One of my proposals was the expressionless encoding but on exploration it caused more effort decoding and produced more phi's, however it later occurred that get_and_zero_local might address some of these shortcomings. If decoding efficiency is a show stopper for a MVP then this might be too.

How do we know that this can be explored later efficiently? Perhaps other design decisions will make it too inefficient to encode? I would like to see a path forward, a plan, and the expressionless encoding is at least a path and a plan.

Perhaps you would like to help move the design forward and articulating some proposal for handling multiple return values from functions might at least create some discussion?

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

No branches or pull requests

3 participants