Skip to content
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

Mutation and the need for a register allocator #6

Open
ix opened this issue May 10, 2019 · 1 comment
Open

Mutation and the need for a register allocator #6

ix opened this issue May 10, 2019 · 1 comment
Labels

Comments

@ix
Copy link
Owner

ix commented May 10, 2019

A problem - it is theoretically possible with Lazyboy at present to mutate the value of a register as it is being used in something, such as a loop.

I'm writing this on a whim and not testing it, so it could have mistakes, but the general idea is the same.

.a_loop
  ;; some code that modifies A
  sub 1 ;; A--
  jr nz, .a_loop 

To prevent this we could track which registers are in use in a scope and prohibit mutable access to them. Alternatively, we could silently allow them to be mutated, but move the value they have into a free register or create a map-like structure. After the inner code is executed, we can then move the value back into them before it's needed again.

@ix ix added the thoughts label May 10, 2019
@ix
Copy link
Owner Author

ix commented Jan 24, 2020

I've been (slowly) learning about SSA and such, I'll come back to this soon, I just work full time now, so finding time is a little harder than it used to be.

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

No branches or pull requests

1 participant