-
Notifications
You must be signed in to change notification settings - Fork 29
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
Flow analysis on garbage collector and more #615
Conversation
gabrielsferre
commented
Jul 21, 2024
- Using flow analysis for checking liveness of variables at the garbage collector.
- Using work-list for checking flow analysis convergence (both in gc.lua and uninitialized.lua). See Using a work list when doing flow analysis #609.
- Not using commands as keys for tables anymore. See Stop using commands as keys for tables on the garbage collector #610.
-- appears live at, instead of approximating with first definition and last use. | ||
-- | ||
-- 4) Use SSA form or some form of reaching definitions analysis so that we we only need to mirror | ||
-- 3) Use SSA form or some form of reaching definitions analysis so that we we only need to mirror |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps investigating the items on this list could be an interesting experiment for the project... We could do a subsequent PR for that and then compare how the benchmarks fare, before and after.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes! We could start with them.
kill = {}, -- {var_id -> bool?} variables that are killed inside block | ||
gen = {}, -- {var_id -> bool?} variables that become live inside block | ||
} | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another question for a future PR:
- How similar is our analysis code to the uninitialized analysis
- Is it worth abstracting some of it to a separate flow analysis file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code is very similar. I was thinking of having a separate flow analysis file at some point, but wanted to do a couple more cases to help me abstract away the pattern.
src/pallene/coder.lua
Outdated
if gc.cmd_uses_gc(cmd._tag) then | ||
gen_state.gc_info = { | ||
live_gc_vars = self.gc[func].live_gc_vars[block_i][cmd_i], | ||
slot_of_variable = self.gc[func].slot_of_variable, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move this gc info to self
cmd = cmd, | ||
func = func, | ||
gc_info = false, | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is "args" not "state"
src/pallene/gc.lua
Outdated
function gc.compute_stack_slots(func) | ||
local function FlowState() | ||
return { | ||
input = {}, -- {var_id -> bool?} live variables at block start |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment: this is a set(var_id)