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

machine: Fix passing of free variables to local functions #219

Merged
merged 9 commits into from
Feb 23, 2023

Conversation

marzipankaiser
Copy link
Contributor

@marzipankaiser marzipankaiser commented Jan 16, 2023

Now this uses all free Ids minus block labels, the name of this definition and constructor names,
and also adds the free Ids of called functions.

This also eta-expands functions passed directly as block parameters (since they are labels and thus, this will never work).

Additionally, adds a minor bugfix to transform(BlockType).

Resolves #217.

@marzipankaiser marzipankaiser marked this pull request as draft January 16, 2023 17:11
@marzipankaiser
Copy link
Contributor Author

marzipankaiser commented Jan 16, 2023

Marked as draft because this still does not work for:

def sumPaths(): Int = {
  val state = 0

  def explore(): Int = state
  def explore2(): Int = explore()

  explore2()
}

def main() =  println(sumPaths())

Notes:

  • Here, state is not free in the lifted version of explore2. But it must still be passed on, so it can be forwarded to explore
  • (Regarding the names: This code was gotten by successively shrinking the benchmark tree.effekt)

@marzipankaiser
Copy link
Contributor Author

Since both the problem and the solution for #218 are closely related, I will fix that in this PR, too.

@marzipankaiser
Copy link
Contributor Author

marzipankaiser commented Jan 17, 2023

Fixes #218

@marzipankaiser marzipankaiser marked this pull request as ready for review January 17, 2023 11:14
@marzipankaiser marzipankaiser changed the title machine: Fix computation of freeParams for local functions machine: Fix passing of free variables to local functions Jan 17, 2023
@marzipankaiser marzipankaiser added the bug Something isn't working label Jan 17, 2023
@marzipankaiser
Copy link
Contributor Author

@phischu This is what we talked about back then. Since it is now rebased and working, I will just merge it.

@marzipankaiser marzipankaiser merged commit d16151a into master Feb 23, 2023
@b-studios b-studios deleted the bugfix/issue217 branch January 28, 2024 11:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
1 participant