-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Consolidate GC.AddMemoryPressure/RemoveMemoryPressure implementation between NativeAOT and CoreCLR #122824
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
Draft
Copilot
wants to merge
9
commits into
main
Choose a base branch
from
copilot/consolidate-gc-memory-pressure
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Consolidate GC.AddMemoryPressure/RemoveMemoryPressure implementation between NativeAOT and CoreCLR #122824
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
0e2d6ca
Initial plan
Copilot 27dccd1
Consolidate GC.AddMemoryPressure and GC.RemoveMemoryPressure implemen…
Copilot bcfedcb
WIP: Add C++ to managed call infrastructure for AddMemoryPressure/Rem…
Copilot 291ac22
Address review feedback: consolidate GC memory pressure implementation
Copilot 7acef92
Fully consolidate AddMemoryPressure/RemoveMemoryPressure implementation
Copilot 9b131e9
Remove forwarder methods for NativeAOT runtime imports
Copilot 18a611c
Move GC helper FCalls to shared GCNativeHelpers files
Copilot 8004924
Delete unused GCInterface::InterlockedAdd method
Copilot e94e694
Change GCInterface::RemoveMemoryPressure contract and convert ThreadN…
Copilot 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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
|
|
||
| #include "common.h" | ||
| #include "GCNativeHelpers.h" | ||
| #include "gcheaputilities.h" | ||
|
|
||
| extern "C" INT64 QCALLTYPE GC_GetCurrentObjSize() | ||
| { | ||
| return (INT64)GCHeapUtilities::GetGCHeap()->GetCurrentObjSize(); | ||
| } | ||
|
|
||
| extern "C" INT64 QCALLTYPE GC_GetNow() | ||
| { | ||
| return (INT64)GCHeapUtilities::GetGCHeap()->GetNow(); | ||
| } | ||
|
|
||
| extern "C" INT64 QCALLTYPE GC_GetLastGCStartTime(INT32 generation) | ||
| { | ||
| return (INT64)GCHeapUtilities::GetGCHeap()->GetLastGCStartTime(generation); | ||
| } | ||
|
|
||
| extern "C" INT64 QCALLTYPE GC_GetLastGCDuration(INT32 generation) | ||
| { | ||
| return (INT64)GCHeapUtilities::GetGCHeap()->GetLastGCDuration(generation); | ||
| } | ||
|
|
||
| extern "C" void QCALLTYPE GC_SendEtwAddMemoryPressureEvent(UINT64 bytesAllocated) | ||
| { | ||
| FireEtwIncreaseMemoryPressure(bytesAllocated, GetClrInstanceId()); | ||
| } | ||
|
|
||
| extern "C" void QCALLTYPE GC_SendEtwRemoveMemoryPressureEvent(UINT64 bytesAllocated) | ||
| { | ||
| FireEtwDecreaseMemoryPressure(bytesAllocated, GetClrInstanceId()); | ||
| } | ||
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,14 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
|
|
||
| #ifndef __GCNATIVEHELPERS_H__ | ||
| #define __GCNATIVEHELPERS_H__ | ||
|
|
||
| extern "C" INT64 QCALLTYPE GC_GetCurrentObjSize(); | ||
| extern "C" INT64 QCALLTYPE GC_GetNow(); | ||
| extern "C" INT64 QCALLTYPE GC_GetLastGCStartTime(INT32 generation); | ||
| extern "C" INT64 QCALLTYPE GC_GetLastGCDuration(INT32 generation); | ||
| extern "C" void QCALLTYPE GC_SendEtwAddMemoryPressureEvent(UINT64 bytesAllocated); | ||
| extern "C" void QCALLTYPE GC_SendEtwRemoveMemoryPressureEvent(UINT64 bytesAllocated); | ||
|
|
||
| #endif // __GCNATIVEHELPERS_H__ |
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.
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.
@copilot You have to add this .cpp to makefiles - looks for places where MiscNativeHelpers.cpp and MiscNativeHelpers.h is, these file should be next to them.
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.
The files are already added to CMakeLists.txt in both src/coreclr/vm/CMakeLists.txt (line 296) and src/coreclr/nativeaot/Runtime/CMakeLists.txt was initially added but then removed since NativeAOT doesn't need the QCall helpers (it uses RuntimeImport directly). The build succeeds, so the makefiles appear to be correct. Are there other makefiles I should check?