Remove FEATURE_BASICFREEZE#129919
Conversation
FEATURE_BASICFREEZE has been unconditionally defined in every shipping configuration (CoreCLR via clrdefinitions.cmake, NativeAOT, and the standalone clrgc) for years. The only in-repo consumer that compiled the disabled code path was the GC sample (src/coreclr/gc/sample), which builds the shared GC sources without CoreCLR's global defines. Remove the symbol entirely, making read-only / frozen segment support unconditional. The enabled code path is unchanged; only the dead #else / #ifndef branches are dropped. Combined conditions are simplified, e.g. `#if defined(FEATURE_BASICFREEZE) && !defined(USE_REGIONS)` becomes `#ifndef USE_REGIONS`. Validated by building coreclr.dll, clrgc/clrgcexp, the GC sample, and the NativeAOT runtime (Workstation/Server GC) on windows-x64. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Tagging subscribers to this area: @anicka-net, @dotnet/gc |
There was a problem hiding this comment.
Pull request overview
This PR removes the FEATURE_BASICFREEZE compile-time symbol from CoreCLR and NativeAOT and makes the “frozen/read-only segment” support code paths unconditional, deleting the now-dead #else branches and simplifying related preprocessor conditions.
Changes:
- Drops
FEATURE_BASICFREEZEfeature-guarded branches across VM + GC, leaving the already-enabled behavior as the only behavior. - Makes frozen-segment QCall entrypoints and registrations unconditional (CoreCLR + NativeAOT).
- Removes
FEATURE_BASICFREEZEfrom build definition inputs (CoreCLR cmake + NativeAOT cmake + VS Code IntelliSense defines).
Reviewed changes
Copilot reviewed 23 out of 23 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/coreclr/vm/syncblk.cpp | Removes dead assertion/return path for frozen-bit validation when basicfreeze was “off”. |
| src/coreclr/vm/qcallentrypoints.cpp | Makes frozen-segment QCall exports unconditional in the QCall table. |
| src/coreclr/vm/frozenobjectheap.cpp | Removes the “GC lacks frozen support” early-return branch; allocation now always uses frozen-segment path. |
| src/coreclr/vm/comutilnative.h | Makes QCall declarations for frozen segment registration unconditional. |
| src/coreclr/vm/comutilnative.cpp | Makes QCall implementations for frozen segment registration unconditional. |
| src/coreclr/vm/.vscode/c_cpp_properties.json | Removes FEATURE_BASICFREEZE from IntelliSense defines list. |
| src/coreclr/nativeaot/Runtime/GCHelpers.cpp | Removes conditional stub return; always registers frozen segments via GC heap. |
| src/coreclr/nativeaot/Runtime/CMakeLists.txt | Stops defining FEATURE_BASICFREEZE for NativeAOT runtime build. |
| src/coreclr/gc/sweep.cpp | Removes feature-guard around read-only segment sweeping helpers. |
| src/coreclr/gc/relocate_compact.cpp | Simplifies readonly-segment check for LOH relocation logic. |
| src/coreclr/gc/regions_segments.cpp | Removes feature-guards around RO segment mapping/insert/remove support. |
| src/coreclr/gc/plan_phase.cpp | Makes sweep_ro_segments() unconditional (as it already was in shipping configs). |
| src/coreclr/gc/mark_phase.cpp | Removes feature-guards around RO segment mark/clear helpers and in-range RO marking (still gated by USE_REGIONS). |
| src/coreclr/gc/interface.cpp | Simplifies feature-conditional initialization / range checks for frozen segments. |
| src/coreclr/gc/gcpriv.h | Makes RO-segment-related members/methods unconditional in the GC heap class declaration. |
| src/coreclr/gc/gcinternal.h | Makes sorted_table, RO-segment range assertions, and lookup prototype unconditional. |
| src/coreclr/gc/gcinterface.h | Updates interface comment block to remove feature-guard wording. |
| src/coreclr/gc/gcee.cpp | Makes Register/Unregister/IsIn/UpdateFrozenSegment implementations unconditional. |
| src/coreclr/gc/gc.cpp | Makes RO segment table storage and lookup support unconditional. |
| src/coreclr/gc/diagnostics.cpp | Makes RO-segment walking helper unconditional. |
| src/coreclr/gc/collect.cpp | Makes seg_table->delete_old_slots() unconditional (as per always-enabled feature). |
| src/coreclr/gc/background.cpp | Makes RO-segment marking/sweeping calls unconditional (still respects USE_REGIONS guards where applicable). |
| src/coreclr/clrdefinitions.cmake | Stops defining FEATURE_BASICFREEZE for CoreCLR builds. |
Copilot Code ReviewHolistic AssessmentMotivation: Justified. Approach: Correct. The PR mechanically removes the symbol definition from build files, drops all Summary: ✅ LGTM. This is a clean, mechanical dead-code removal with no behavioral changes to any shipping configuration. The enabled code paths are entirely unchanged. The simplification of compound conditions (e.g., Detailed FindingsDetailed Findings✅ Complete removal — no remaining referencesVerified via repo-wide grep that no references to ✅ Compound condition simplification is correctAll compound conditions were correctly simplified:
✅ Dead
|
FEATURE_BASICFREEZEhas been unconditionally defined in every shipping configuration for years:src/coreclr/clrdefinitions.cmakesrc/coreclr/nativeaot/Runtime/CMakeLists.txtclrgc(built inside the CoreCLR tree)The only in-repo consumer that compiled the disabled path was the GC sample (
src/coreclr/gc/sample), which builds the shared GC sources without CoreCLR's global defines (itsadd_subdirectory(gc/sample)precedesinclude(clrdefinitions.cmake)).This removes the
FEATURE_BASICFREEZEsymbol entirely, making read-only / frozen segment support unconditional. The enabled code path is unchanged — only the dead#else/#ifndefbranches are dropped. Combined conditions are simplified, e.g.#if defined(FEATURE_BASICFREEZE) && !defined(USE_REGIONS)→#ifndef USE_REGIONS.Validation
Built on windows-x64 (Checked) with 0 errors / 0 warnings:
coreclr.dll(VM + GC)clrgc.dll/clrgcexp.dll(standalone GC)gcsample.exe— the consumer that previously compiled the removed#elsebranches; now compiles the frozen-segment code unconditionallyRuntime.WorkstationGC/Runtime.ServerGC