Skip to content

Add join points to compiler. #1164

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

Open
ordinarymath opened this issue Apr 27, 2025 · 0 comments
Open

Add join points to compiler. #1164

ordinarymath opened this issue Apr 27, 2025 · 0 comments

Comments

@ordinarymath
Copy link
Contributor

ordinarymath commented Apr 27, 2025

Compilers like Haskell support the notion of join points.
Join points are continuations.
See examples like this

fun x = 
let y () = z
 in  ... y()

where the closure compiles to a jump instruction.
This is useful in reducing duplicated code size in pattern matches
i.e.

(case x of
(x::x::y) | a 
[x] | a
_ | b
-->
let A () = a
(case x of
(x::x::y) | A ()
[x] | A()
_ | b

This issue is just about making manually written join points written at source to compile to jump instructions.
Note that given that cakeml is direct style one would want to inline join points used once.
Another issue can be created for making the pmatch compiler generate join points.
Note that this issue is not talking about supporting haskell style recursive join points.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant