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

Implement handling of function pointers #129

Merged
merged 1 commit into from
Jan 27, 2025

Conversation

iamrecursion
Copy link
Collaborator

Summary

Function pointers are now handled according to the memory model documentation, ensuring that we can generate code that will allow us to call through opaque function pointers correctly.

Note that this commit only encompasses the compiler-side part of this work, with more work to be done in the linker to handle generation of the meta-dispatch functions for each function type.

Closes #100

Details

Check that it seems sane please!

Checklist

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

@iamrecursion iamrecursion added the enhancement New feature or request label Jan 15, 2025
@iamrecursion iamrecursion self-assigned this Jan 15, 2025
@iamrecursion iamrecursion linked an issue Jan 15, 2025 that may be closed by this pull request
3 tasks
@iamrecursion iamrecursion force-pushed the wip/ara/function-pointer-impl branch 4 times, most recently from 6f0716d to 3114d7b Compare January 15, 2025 18:36
@iamrecursion iamrecursion marked this pull request as ready for review January 15, 2025 18:40
@iamrecursion iamrecursion requested a review from a team as a code owner January 15, 2025 18:40
@iamrecursion iamrecursion force-pushed the wip/ara/function-pointer-impl branch from 3114d7b to bd7a5b4 Compare January 15, 2025 18:41
@iamrecursion iamrecursion force-pushed the wip/ara/name-mangling branch from aeb3df3 to 9cea036 Compare January 23, 2025 16:15
@iamrecursion iamrecursion force-pushed the wip/ara/function-pointer-impl branch 2 times, most recently from f568279 to 919064b Compare January 23, 2025 16:18
Copy link
Collaborator

@ktemkin ktemkin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Few questions/comments inline, but other than those this is approved.

crates/compiler/src/obj_gen/mod.rs Show resolved Hide resolved
crates/compiler/src/obj_gen/mod.rs Show resolved Hide resolved
@iamrecursion iamrecursion force-pushed the wip/ara/name-mangling branch from 9cea036 to 8e16cbf Compare January 27, 2025 15:58
@iamrecursion iamrecursion force-pushed the wip/ara/function-pointer-impl branch 2 times, most recently from dcc56eb to 7651b38 Compare January 27, 2025 16:06
Base automatically changed from wip/ara/name-mangling to main January 27, 2025 16:08
Function pointers are now handled according to the memory model
documentation, ensuring that we can generate code that will allow us to
call through opaque function pointers correctly.

Note that this commit only encompasses the compiler-side part of this
work, with more work to be done in the linker to handle generation of
the meta-dispatch functions for each function type.

It also makes some minor changes to the mangler to allow it to handle
reserved names in a more sensible way.

Closes #100
@iamrecursion iamrecursion force-pushed the wip/ara/function-pointer-impl branch from 7651b38 to ccc4658 Compare January 27, 2025 16:09
@iamrecursion iamrecursion merged commit c8f21e8 into main Jan 27, 2025
10 checks passed
@iamrecursion iamrecursion deleted the wip/ara/function-pointer-impl branch January 27, 2025 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[TASK] Handle calling through function pointers
3 participants