Optimizer: don't inline named functions in debug builds#19548
Open
auduchinok wants to merge 6 commits intodotnet:mainfrom
Open
Optimizer: don't inline named functions in debug builds#19548auduchinok wants to merge 6 commits intodotnet:mainfrom
auduchinok wants to merge 6 commits intodotnet:mainfrom
Conversation
Contributor
❗ Release notes required
|
ed866e5 to
d607132
Compare
bb4fe70 to
9377496
Compare
9377496 to
257c702
Compare
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.
inlinefunctions are fully inlined on the call sites by F# compiler. This means the source information and actual calls are lost, so it's very hard to reliably debug code using such functions.This PR prevents inlining
inlinefunctions in debug builds. This improves debugging experience by allowing setting breakpoints inside such functions and allowing stepping into them and checking the function arguments. It also allows IDEs to analyze the produced IL more reliably during debug.The implementation handles two distinct cases. When possible, a normal call to the existing method is emitted. When a function contains SRTPs and no callable method is produced, a specialized method is created for each type instantiation.
An example
inlinefunction that can be called directly:The existing method is called:

An
inlinefunction with SRTPs:A specialized method is produced and called:

Open questions:
DebuggerNonUserCode?Implements fsharp/fslang-suggestions#824 for debug builds.
Fixes #9555.