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

Add PlutusTx.Optimize.Inline.inline for callsite inlining #6847

Merged
merged 5 commits into from
Feb 18, 2025

Conversation

zliu41
Copy link
Member

@zliu41 zliu41 commented Feb 13, 2025

This works like GHC.Magic.inline, and can be used in the form of inline f or inline (f args).

@zliu41 zliu41 requested review from Unisay, effectfully and a team February 13, 2025 18:59
@Unisay
Copy link
Contributor

Unisay commented Feb 17, 2025

This works like GHC.Magic.inline, and can be used in the form of inline f or inline (f args).

Thanks for adding this! To help me understand the motivation behind this change, could you describe the issue it's designed to resolve? A brief explanation of the problem would be really helpful.

@zliu41
Copy link
Member Author

zliu41 commented Feb 17, 2025

could you describe the issue it's designed to resolve?

See the tests - the more you inline, the cheaper.

@Unisay
Copy link
Contributor

Unisay commented Feb 17, 2025

See the tests - the more you inline, the cheaper.

Its not clear to me why GHC.inline is not enough? Why having our own magic is better?

@ana-pantilie
Copy link
Contributor

@Unisay I think the idea is that we want inline to have the {-# OPAQUE inline #-} pragma, in order to hook into it at the plugin level. We need to define it ourselves if we want that, since we can't modify the source in GHC.inline.

@zliu41
Copy link
Member Author

zliu41 commented Feb 17, 2025

@Unisay GHC's inline may work, and probably does work most of the time, but there's no guarantee that GHC won't transform it away before it gets to the plugin.

Copy link
Contributor

@effectfully effectfully left a comment

Choose a reason for hiding this comment

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

Great stuff.

@zliu41 zliu41 merged commit 61e0726 into master Feb 18, 2025
4 checks passed
@zliu41 zliu41 deleted the zliu41/magic-inline branch February 18, 2025 01:14
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.

4 participants