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

Design the handling of function pointers #125

Merged
merged 1 commit into from
Jan 14, 2025

Conversation

iamrecursion
Copy link
Collaborator

Summary

As we do not have the ability to arbitrarily set the program counter when compiling via FlatLowered, we have had to come up with a clever way to emulate calling functions via pointers in Hieratika.

This PR includes that design, which makes certain assumptions that seem to hold for generic Rust code, but may do not hold for all LLVM IR. This makes it sufficient for an initial implementation, and for getting Rust code working, but may later see evolution to better support more complex notions of function pointers.

Details

Check it makes sense please! For @ktemkin please make sure I faithfully recorded it as we discussed it!

Checklist

  • Code is formatted by Rustfmt or scarb fmt.
  • Documentation has been updated if necessary.

@iamrecursion iamrecursion added the documentation Improvements or additions to documentation label Jan 13, 2025
@iamrecursion iamrecursion self-assigned this Jan 13, 2025
@iamrecursion iamrecursion force-pushed the wip/ara/global-pointers branch from c3c3b24 to 3af45ce Compare January 13, 2025 21:00
@iamrecursion iamrecursion force-pushed the wip/ara/function-pointer-design branch from 4362877 to 3af45ce Compare January 13, 2025 21:00
@iamrecursion iamrecursion reopened this Jan 13, 2025
@iamrecursion iamrecursion force-pushed the wip/ara/function-pointer-design branch from f9efacc to 79fe1ad Compare January 13, 2025 21:07
@iamrecursion iamrecursion marked this pull request as ready for review January 13, 2025 21:09
@iamrecursion iamrecursion requested a review from a team as a code owner January 13, 2025 21:09
@iamrecursion iamrecursion force-pushed the wip/ara/global-pointers branch from 3af45ce to 74c83a1 Compare January 14, 2025 15:23
@iamrecursion iamrecursion force-pushed the wip/ara/function-pointer-design branch from 79fe1ad to bee2b20 Compare January 14, 2025 15:24
@iamrecursion iamrecursion force-pushed the wip/ara/global-pointers branch from 74c83a1 to 58ab052 Compare January 14, 2025 15:35
@iamrecursion iamrecursion force-pushed the wip/ara/function-pointer-design branch from bee2b20 to a946b08 Compare January 14, 2025 15:35
docs/Memory Model.md Outdated Show resolved Hide resolved
@iamrecursion iamrecursion force-pushed the wip/ara/global-pointers branch from 58ab052 to a0241a2 Compare January 14, 2025 16:28
@iamrecursion iamrecursion force-pushed the wip/ara/function-pointer-design branch from a946b08 to 7cdff40 Compare January 14, 2025 16:28
Base automatically changed from wip/ara/global-pointers to main January 14, 2025 16:36
@iamrecursion iamrecursion force-pushed the wip/ara/function-pointer-design branch 2 times, most recently from f1e508d to e2a2381 Compare January 14, 2025 17:14
@iamrecursion iamrecursion requested a review from ktemkin January 14, 2025 17:23
As we do not have the ability to arbitrarily set the program counter
when compiling via FlatLowered, we have had to come up with a clever
way to emulate calling functions via pointers in Hieratika.

This PR includes that design, which makes certain assumptions that
seem to hold for generic Rust code, but may do not hold for all LLVM
IR. This makes it sufficient for an initial implementation, and for
getting Rust code working, but may later see evolution to better
support more complex notions of function pointers.
@iamrecursion iamrecursion force-pushed the wip/ara/function-pointer-design branch from e2a2381 to 4586c3f Compare January 14, 2025 18:06
@iamrecursion iamrecursion merged commit 8c6308c into main Jan 14, 2025
10 checks passed
@iamrecursion iamrecursion deleted the wip/ara/function-pointer-design branch January 14, 2025 18:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants