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

Flow analysis on garbage collector and more #615

Merged
merged 5 commits into from
Jul 23, 2024
Merged

Conversation

gabrielsferre
Copy link
Contributor

-- 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
Copy link
Member

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.

Copy link
Contributor Author

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
Copy link
Member

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:

  1. How similar is our analysis code to the uninitialized analysis
  2. Is it worth abstracting some of it to a separate flow analysis file?

Copy link
Contributor Author

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/gc.lua Outdated Show resolved Hide resolved
src/pallene/gc.lua Outdated Show resolved Hide resolved
src/pallene/gc.lua Outdated Show resolved Hide resolved
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,
Copy link
Member

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,
}
Copy link
Member

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"

function gc.compute_stack_slots(func)
local function FlowState()
return {
input = {}, -- {var_id -> bool?} live variables at block start
Copy link
Member

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)

@hugomg hugomg merged commit a3fbfdd into master Jul 23, 2024
2 checks passed
@hugomg hugomg deleted the tcc-gabrielsferreira branch July 23, 2024 21:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants