Skip to content

Pragma to force function inlining#462

Merged
eldritchconundrum merged 4 commits intomasterfrom
pragma-inline
Sep 24, 2024
Merged

Pragma to force function inlining#462
eldritchconundrum merged 4 commits intomasterfrom
pragma-inline

Conversation

@eldritchconundrum
Copy link
Copy Markdown
Collaborator

No description provided.

Comment thread src/rewriter.fs Outdated
forceInlineNextFunction <- None
Some tl
| tl -> Some tl
let li = li |> List.choose processPragmas
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

not let needed: li |> List.choose processPragmas |>

Comment thread src/rewriter.fs Outdated
let mutable forceInlineNextFunction = None
let processPragmas tl =
match tl with
| TLDirective ["#pragma function inline"] ->
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

String matching is very restricted and will fail if there's any extra whitespace.
In theory, we could parse the pragmas in the parser.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I'll accept multiple spaces. But I'm not so sure that the parser is the best place to process a format that's specific to minifier rather than specific to the language.

Comment thread src/rewriter.fs
| None -> ()
forceInlineNextFunction <- None
Some tl
| tl -> Some tl
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

What if #pragma function inline is not followed by a function?
Do we want to handle that case?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

We could emit a warning for unused function inline pragmas.

@eldritchconundrum eldritchconundrum merged commit cfeae09 into master Sep 24, 2024
@eldritchconundrum eldritchconundrum deleted the pragma-inline branch September 24, 2024 17:37
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.

2 participants