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

Basic match for integers; bugfix #18

Merged
merged 2 commits into from
Jan 27, 2025
Merged

Basic match for integers; bugfix #18

merged 2 commits into from
Jan 27, 2025

Conversation

AdUhTkJm
Copy link

@AdUhTkJm AdUhTkJm commented Jan 24, 2025

Adds support to match expression on integers.

Currently, if we denote the set of values to match against as S, only those cases subject to max(S) - min(S) <= 20 will be compiled.

For larger ranges (such as the one in match03), I plan to implement an algorithm of finding a perfect hash function that hashes them into [0, len(S)), so they can fit in a jump table. (On the contrary, the WASM backend just compiles it into a series of if-else.) For len(S) <= 3, I also plan to compile them into if-else.

Bugfix:

  • match on variants now works with Cexpr_join_apply.
  • escape analysis now works properly; it should be done with backwards data flow approach, not forward.

@mengzhuo mengzhuo merged commit 12affe1 into plctlab:main Jan 27, 2025
2 checks passed
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