Replace the function inlining mechanism with new platform operators#1484
Merged
pavpanchekha merged 19 commits intomainfrom Apr 25, 2026
Merged
Replace the function inlining mechanism with new platform operators#1484pavpanchekha merged 19 commits intomainfrom
pavpanchekha merged 19 commits intomainfrom
Conversation
2 tasks
Contributor
Author
|
An update on this PR. It now seems correct. I have reviewed all but the big four files: |
# Conflicts: # src/syntax/platform.rkt
Contributor
Author
|
I'm now pretty happy with results, but the nightly fails. Will investigate, but I think we're close to merging. |
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In Herbie, you can write a named FPCore, as in
(FPCore name (...) ...). Then, in later FPCores, you can write(name <expr>)to call that FPCore; you have to do the correct number of arguments and types and everything but it'll do what you expect. Currently, the way this works is a little hash table on the side called*functions*storing named FPCores and their definitions; when the desugarer sees one of these named functions, it'll inline the definition.This PR switches functions to just use the platform feature. When Herbie sees a named FPCore, it'll add that an operator to the current platform, using the name for the
:fpcoreformat and the spec and implementation for the operator spec and impl. Herbie will now generate direct calls to this operator, which is nice, and the rewriter still has access to the spec so can inline if it wants.WIP: