-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Use compiler-lowered DAM when trimming #117624
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
Merged
Merged
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
e216e06
Add support for extra source files in tests
sbomer 61e3722
Add test DAM attribute with CompilerLoweringPreserve
sbomer 45692be
Add primary ctor test
sbomer 3a6fa90
Don't use generated code heuristics for .NET10
sbomer 8f91d61
Make new behavior opt-in
sbomer 4f5582a
Add test infra for ILC
sbomer 7e175b9
Fix validation for System members
sbomer da23c73
Add ILC implementation
sbomer f82e5bf
Add CompilerLoweringPreserveAttribute
sbomer d74ed22
Merge remote-tracking branch 'origin/main' into primaryCtorDataflow
sbomer 069ee1e
Fix formatting
sbomer 84e9950
Fix ref assembly
sbomer bc53e75
Fix warning origin for compiler-generated code warnings
sbomer 1f6355c
Fix ILC build
sbomer 5635c89
Fix STJ build, make attribute internal
sbomer 6338a5d
Add encoding to fix CS8055
sbomer 7d05176
Fix analyzer tests
sbomer 64c6da5
Revert framework changes
sbomer cc28962
Run the old logic for coverage
sbomer a726c87
Fix DependencyGraphTests build
sbomer 0bf54e7
Add doc about lowering/heuristics behavior
sbomer 850ec23
PR feedback
sbomer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
41 changes: 41 additions & 0 deletions
41
src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/AssemblyExtensions.cs
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
|
|
||
| using System; | ||
| using System.Diagnostics; | ||
| using System.Reflection.Metadata; | ||
| using Internal.TypeSystem; | ||
| using Internal.TypeSystem.Ecma; | ||
|
|
||
| #nullable enable | ||
|
|
||
| namespace ILCompiler | ||
| { | ||
| public static class AssemblyExtensions | ||
| { | ||
| public static Version? GetTargetFrameworkVersion(this EcmaAssembly assembly) | ||
| { | ||
| // Get the custom attributes from the assembly's metadata | ||
| MetadataReader reader = assembly.MetadataReader; | ||
| CustomAttributeHandle attrHandle = reader.GetCustomAttributeHandle(assembly.AssemblyDefinition.GetCustomAttributes(), | ||
| "System.Runtime.Versioning", "TargetFrameworkAttribute"); | ||
| if (!attrHandle.IsNil) | ||
| { | ||
| CustomAttribute attr = reader.GetCustomAttribute(attrHandle); | ||
| CustomAttributeValue<TypeDesc> decoded = attr.DecodeValue(new CustomAttributeTypeProvider(assembly)); | ||
| if (decoded.FixedArguments.Length == 1 && decoded.FixedArguments[0].Value is string tfm && !string.IsNullOrEmpty(tfm)) | ||
| { | ||
| var versionPrefix = "Version=v"; | ||
| var idx = tfm.IndexOf(versionPrefix); | ||
| if (idx >= 0) | ||
| { | ||
| var versionStr = tfm.Substring(idx + versionPrefix.Length); | ||
| if (Version.TryParse(versionStr, out var version)) | ||
| return version; | ||
| } | ||
| } | ||
| } | ||
| return null; | ||
| } | ||
| } | ||
| } |
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
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
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
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.