-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Enable "Allocate on stack" for NAOT/R2R #104411
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 4 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
000b528
Enable "Allocate on stack" for NAOT/R2R
EgorBo 67b495d
Fix getClassGClayout on NAOT
EgorBo 8e0e9eb
Handle CORINFO_HELP_UNBOX_TYPETEST on NAOT/R2R
EgorBo 2a62eeb
fix build
EgorBo 741e4fa
implement RhUnboxTypeTest
EgorBo 396677b
Update ILCompiler.RyuJit.csproj
EgorBo 19936e7
Update StackAllocatedBox.cs
EgorBo b07c1a0
clean up
EgorBo ea65a01
Update src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs
EgorBo 62b67d1
Merge branch 'main' of github.com:dotnet/runtime into alloc-stack-naot
EgorBo ebd8f9a
Add tests
EgorBo b5985a5
Address feedback
EgorBo 1ef6ccf
Merge branch 'main' of github.com:dotnet/runtime into alloc-stack-naot
EgorBo 4f9ff46
Update ObjectStackAllocationTests.cs
EgorBo ac65ff6
Update ObjectStackAllocationTests.cs
EgorBo 203593c
Merge branch 'main' into alloc-stack-naot
EgorBo 001b01c
Merge branch 'alloc-stack-naot' of github.com:EgorBo/runtime-1 into a…
EgorBo ac0e6e8
Merge branch 'main' of github.com:dotnet/runtime into alloc-stack-naot
EgorBo ed2568c
Clean up in the test
EgorBo d6a32b3
Update ObjectStackAllocationTests.csproj
EgorBo 85340ae
Update ObjectStackAllocationTests.cs
EgorBo 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding
<DebuggerSupport>true</DebuggerSupport>
to the project file would make the attribute visible, but ILC has its own optimization switch so CoreLib having this attribute still doesn't necessarily imply how optimized it is.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MichalStrehovsky do we run runtime tests with NativeAOT in full debug mode?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So can you tell me how to properly check it here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do have such legs, I'm not sure if they include this test too. It would be in the runtime or runtime-nativeaot-outerloop if it exists.
Native AOT will use the same settings for optimizing both CoreLib and user code so enabling the attribute and looking for the attribute on
Assembly.GetEntryAssembly
would give the answer.I guess I don't understand why this is looking at whether corelib is optimized. Why does that affect stack allocations in this test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe the way we build the tests, optimization of CoreLib always matches optimization of the test?
If that's the case, all that's needed is to add
<DebuggerSupport>true</DebuggerSupport>
to the test project and this will work the same. It will also fail the same if there's ever mismatch between test optimization and corelib optimization.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not the original author (I presume the authors no longer work in the team), but looks like the test tries to be agile and validate that nothing is stack-allocated under debug maybe? 🤷
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, but for that one would check whether the test is optimized, not corelib. One can build the test with
<Optimize>true</Optimize>
and have corelib from a debug build. I assume the test would fail in that case.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(I mean in the JIT case. It would also fail in the AOT case because I believe the test is looking at the wrong assembly.)
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ended up removing these bits and the test is still working fine (it's always optimized due to
<Optimize>true</Optimize>
)