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

HVM inline pass not inlining definitions that have hvm variable indirections. #703

Open
developedby opened this issue Sep 4, 2024 · 0 comments
Labels
bug Something isn't working compilation Compilation of terms and functions to HVM

Comments

@developedby
Copy link
Member

Reproducing the behavior

HVM nets that are simple indirections were changed in hvm2 to be compiled as a LINK redex like this

@indirect = a
  & @target ~ a

However, the inline pass we use in Bend just looks directly for nets that are a single atom.

fn should_inline(net: &Net) -> bool {
  net.rbag.is_empty() && tree_children(&net.root).next().is_none()
}

The inline pass should be updated to also inline functions that are essentially just atoms behind var indirections like the example above. Ideally it should work with more than one indirection and even if the atom is not in the left side of the redex.

For example, this should also be inlined

@should_inline = a
  & b ~ a
  & b ~ 9

System Settings

Bend commit 0945efc

Additional context

No response

@developedby developedby added bug Something isn't working compilation Compilation of terms and functions to HVM labels Sep 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working compilation Compilation of terms and functions to HVM
Projects
None yet
Development

No branches or pull requests

1 participant