Skip to content

Remove IsCallerSPValid, standardize caller-frame validity on IsCallerContextValid, and finalize ARM AsmOffsets updates#128873

Merged
jkotas merged 4 commits into
mainfrom
copilot/remove-iscaller-spvalid
Jun 3, 2026
Merged

Remove IsCallerSPValid, standardize caller-frame validity on IsCallerContextValid, and finalize ARM AsmOffsets updates#128873
jkotas merged 4 commits into
mainfrom
copilot/remove-iscaller-spvalid

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jun 1, 2026

IsCallerSPValid was a legacy EH-era flag that could drift from IsCallerContextValid semantics. This change removes the legacy flag and makes caller-frame validity uniformly context-based, with explicit callouts for spots that previously tolerated divergence.

Co-authored-by: davidwrighton <10779849+davidwrighton@users.noreply.github.com>
Copilot AI requested review from Copilot and removed request for Copilot June 1, 2026 23:27
Copilot AI changed the title Remove IsCallerSPValid in favor of IsCallerContextValid Remove IsCallerSPValid and standardize caller-frame validity on IsCallerContextValid Jun 1, 2026
Copilot AI requested a review from davidwrighton June 1, 2026 23:28
@dotnet-policy-service
Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @agocke
See info in area-owners.md if you want to be subscribed.

@davidwrighton
Copy link
Copy Markdown
Member

@copilot, in the build there are a lot of errors that look like

  /__w/1/s/src/coreclr/vm/../System.Private.CoreLib/src/System/Runtime/ExceptionServices/AsmOffsets.cs:261:19: error: static assertion failed due to requirement 'sizeof(REGDISPLAY) == AsmOffsets::SIZEOF__REGDISPLAY'
    261 |     static_assert(sizeof(REGDISPLAY) == AsmOffsets::SIZEOF__REGDISPLAY);
        |                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  /__w/1/s/src/coreclr/vm/../System.Private.CoreLib/src/System/Runtime/ExceptionServices/AsmOffsets.cs:261:38: note: expression evaluates to '80 == 84'
    261 |     static_assert(sizeof(REGDISPLAY) == AsmOffsets::SIZEOF__REGDISPLAY);
        |                   ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  /__w/1/s/src/coreclr/vm/../System.Private.CoreLib/src/System/Runtime/ExceptionServices/AsmOffsets.cs:262:19: error: static assertion failed due to requirement '__builtin_offsetof(REGDISPLAY, SP) == AsmOffsets::OFFSETOF__REGDISPLAY__SP'
    262 |     static_assert(offsetof(REGDISPLAY, SP) == AsmOffsets::OFFSETOF__REGDISPLAY__SP);
        |                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  /__w/1/s/src/mono/browser/emsdk/lib/clang/19/include/__stddef_offsetof.h:16:24: note: expanded from macro 'offsetof'
     16 | #define offsetof(t, d) __builtin_offsetof(t, d)
        |                        ^
  /__w/1/s/src/coreclr/vm/../System.Private.CoreLib/src/System/Runtime/ExceptionServices/AsmOffsets.cs:262:44: note: expression evaluates to '72 == 76'
    262 |     static_assert(offsetof(REGDISPLAY, SP) == AsmOffsets::OFFSETOF__REGDISPLAY__SP);
        |                   ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  /__w/1/s/src/coreclr/vm/../System.Private.CoreLib/src/System/Runtime/ExceptionServices/AsmOffsets.cs:263:19: error: static assertion failed due to requirement '__builtin_offsetof(REGDISPLAY, ControlPC) == AsmOffsets::OFFSETOF__REGDISPLAY__ControlPC'
    263 |     static_assert(offsetof(REGDISPLAY, ControlPC) == AsmOffsets::OFFSETOF__REGDISPLAY__ControlPC);
        |                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  /__w/1/s/src/mono/browser/emsdk/lib/clang/19/include/__stddef_offsetof.h:16:24: note: expanded from macro 'offsetof'
     16 | #define offsetof(t, d) __builtin_offsetof(t, d)
        |                        ^
  /__w/1/s/src/coreclr/vm/../System.Private.CoreLib/src/System/Runtime/ExceptionServices/AsmOffsets.cs:263:51: note: expression evaluates to '76 == 80'
    263 |     static_assert(offsetof(REGDISPLAY, ControlPC) == AsmOffsets::OFFSETOF__REGDISPLAY__ControlPC);
    
    ```
    
    These are different on each platform, but generally indicate that offsets and sizes need to be fixed. Please do so.

Co-authored-by: davidwrighton <10779849+davidwrighton@users.noreply.github.com>
Copilot AI requested review from Copilot and removed request for Copilot June 2, 2026 00:33
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Jun 2, 2026

@copilot, in the build there are a lot of errors that look like

  /__w/1/s/src/coreclr/vm/../System.Private.CoreLib/src/System/Runtime/ExceptionServices/AsmOffsets.cs:261:19: error: static asser...

Fixed in 87ea2d9 by updating src/coreclr/System.Private.CoreLib/src/System/Runtime/ExceptionServices/AsmOffsets.cs to match the new REGDISPLAY layout after removing IsCallerSPValid.

I updated the SIZEOF__REGDISPLAY, OFFSETOF__REGDISPLAY__SP, and OFFSETOF__REGDISPLAY__ControlPC constants for the affected 32-bit targets (ARM, X86, WASM) in both Debug and Release sections.

Validated with:

  • ./build.sh clr.runtime -c Release -arch x64 -os linux -ninja
  • ./build.sh clr.runtime -os browser -arch wasm -c Release -ninja

Copilot AI changed the title Remove IsCallerSPValid and standardize caller-frame validity on IsCallerContextValid Remove IsCallerSPValid, standardize caller-frame validity on IsCallerContextValid, and update AsmOffsets Jun 2, 2026
@davidwrighton
Copy link
Copy Markdown
Member

@copilot arm builds are still failing with errors like

1300/2198] Building CXX object vm/wks/CMakeFiles/cee_wks_core.dir/__/exceptionhandling.cpp.o
  FAILED: vm/wks/CMakeFiles/cee_wks_core.dir/__/exceptionhandling.cpp.o 
  /usr/local/bin/clang++ --target=armv7-alpine-linux-musleabihf --gcc-toolchain=/crossrootfs/arm/usr --sysroot=/crossrootfs/arm -DCLR_ARM_FPU_CAPABILITY=0x7 -DCOMPILER_SUPPORTS_W_RESERVED_IDENTIFIER -DDEBUGGING_SUPPORTED -DDISABLE_CONTRACTS -DFEATURE_BASICFREEZE -DFEATURE_CODE_VERSIONING -DFEATURE_COLLECTIBLE_TYPES -DFEATURE_COMWRAPPERS -DFEATURE_CORECLR -DFEATURE_CORECLR_FLUSH_INSTRUCTION_CACHE_TO_PROTECT_STUB_READS -DFEATURE_DBGIPC_TRANSPORT_DI -DFEATURE_DBGIPC_TRANSPORT_VM -DFEATURE_DEFAULT_INTERFACES -DFEATURE_DYNAMIC_CODE_COMPILED -DFEATURE_EMULATE_SINGLESTEP -DFEATURE_EVENTSOURCE_XPLAT -DFEATURE_EVENT_TRACE -DFEATURE_HIJACK -DFEATURE_METADATA_UPDATER -DFEATURE_MULTICOREJIT -DFEATURE_MULTITHREADING -DFEATURE_PAL_ANSI -DFEATURE_PERFMAP -DFEATURE_PERFTRACING -DFEATURE_PGO -DFEATURE_PROFAPI_ATTACH_DETACH -DFEATURE_READYTORUN -DFEATURE_REJIT -DFEATURE_REMOTE_PROC_MEM -DFEATURE_STANDALONE_GC -DFEATURE_SVR_GC -DFEATURE_SYMDIFF -DFEATURE_TIERED_COMPILATION -DFEATURE_USE_ASM_GC_WRITE_BARRIERS -DFEATURE_USE_SOFTWARE_WRITE_WATCH_FOR_GC_HEAP -DFEATURE_VIRTUAL_STUB_DISPATCH -DGC_DESCRIPTOR -DHOST_ARM -DHOST_UNIX -DNDEBUG -DNO_FIXED_STACK_LIMIT -DPROFILING_SUPPORTED -DTARGET_32BIT -DTARGET_ARM -DTARGET_LINUX -DTARGET_LINUX_MUSL -DTARGET_UNIX -DUNICODE -DUNIX_ARM_ABI -DURTBLDENV_FRIENDLY=Retail -D_FILE_OFFSET_BITS=64 -D_SECURE_SCL=0 -D_TIME_BITS=64 -D_UNICODE -I/__w/1/s/artifacts/obj/coreclr/linux.arm.Release/vm/wks -I/__w/1/s/src/coreclr/vm/wks -I/__w/1/s/src/coreclr/vm -I/__w/1/s/src/native -I/__w/1/s/src/native/inc -I/__w/1/s/src/coreclr/pal/prebuilt/inc -I/__w/1/s/artifacts/obj -I/__w/1/s/src/coreclr/pal/inc -I/__w/1/s/src/coreclr/pal/inc/rt -I/__w/1/s/src/coreclr/pal/src/safecrt -I/__w/1/s/src/coreclr/inc -I/__w/1/s/src/coreclr/debug/inc -I/__w/1/s/src/coreclr/debug/inc/arm -I/__w/1/s/src/coreclr/debug/inc/dump -I/__w/1/s/src/coreclr/md/inc -I/__w/1/s/artifacts/obj/coreclr/linux.arm.Release/inc -I/__w/1/s/src/coreclr/hosts/inc -I/__w/1/s/src/coreclr/interpreter/inc -I/__w/1/s/src/coreclr/minipal -I/__w/1/s/src/coreclr/nativeresources -I/__w/1/s/src/coreclr/vm/arm -I/__w/1/s/src/coreclr/vm/../interop/inc -I/__w/1/s/src/coreclr/runtime -I/__w/1/s/src/native/libs/System.IO.Compression.Native -I/__w/1/s/src/native/libs/Common -I/__w/1/s/src/coreclr/vm/eventing/eventpipe -O3 -DNDEBUG -std=gnu++17 -fPIC -mthumb -mfpu=vfpv3 -O3 -Wall -Wno-null-conversion -glldb -fno-omit-frame-pointer -fno-strict-overflow -fno-strict-aliasing -fstack-protector-strong -Werror -Wno-unused-variable -Wno-unused-value -Wno-unused-function -Wno-tautological-compare -Wno-unknown-pragmas -Wimplicit-fallthrough -Wvla -Wno-invalid-offsetof -Wno-unused-but-set-variable -ffp-contract=off -fno-rtti -Wno-unknown-warning-option -ferror-limit=4096 -Wno-unused-private-field -Wno-constant-logical-operand -Wno-pragma-pack -Wno-incompatible-ms-struct -Wno-reserved-identifier -Wno-unsafe-buffer-usage -Wno-single-bit-bitfield-constant-conversion -Wno-cast-function-type-strict -Wno-switch-default -Wno-nontrivial-memaccess -fsigned-char -fvisibility=hidden -ffunction-sections -fdata-sections -march=armv7-a -Wno-null-arithmetic -Wno-sync-alignment -Winvalid-pch -Xclang -include-pch -Xclang /__w/1/s/artifacts/obj/coreclr/linux.arm.Release/vm/wks/CMakeFiles/cee_wks_core.dir/cmake_pch.hxx.pch -Xclang -include -Xclang /__w/1/s/artifacts/obj/coreclr/linux.arm.Release/vm/wks/CMakeFiles/cee_wks_core.dir/cmake_pch.hxx -MD -MT vm/wks/CMakeFiles/cee_wks_core.dir/__/exceptionhandling.cpp.o -MF vm/wks/CMakeFiles/cee_wks_core.dir/__/exceptionhandling.cpp.o.d -o vm/wks/CMakeFiles/cee_wks_core.dir/__/exceptionhandling.cpp.o -c /__w/1/s/src/coreclr/vm/exceptionhandling.cpp
  In file included from /__w/1/s/src/coreclr/vm/exceptionhandling.cpp:4469:
  /__w/1/s/src/coreclr/vm/../System.Private.CoreLib/src/System/Runtime/ExceptionServices/AsmOffsets.cs:261:19: error: static assertion failed due to requirement 'sizeof(REGDISPLAY) == AsmOffsetsAsserts::AsmOffsets::SIZEOF__REGDISPLAY'
    261 |     static_assert(sizeof(REGDISPLAY) == AsmOffsets::SIZEOF__REGDISPLAY);
        |                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  /__w/1/s/src/coreclr/vm/../System.Private.CoreLib/src/System/Runtime/ExceptionServices/AsmOffsets.cs:261:38: note: expression evaluates to '1024 == 1028'
    261 |     static_assert(sizeof(REGDISPLAY) == AsmOffsets::SIZEOF__REGDISPLAY);
        |                   ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  /__w/1/s/src/coreclr/vm/../System.Private.CoreLib/src/System/Runtime/ExceptionServices/AsmOffsets.cs:262:19: error: static assertion failed due to requirement '__builtin_offsetof(REGDISPLAY, SP) == AsmOffsetsAsserts::AsmOffsets::OFFSETOF__REGDISPLAY__SP'
    262 |     static_assert(offsetof(REGDISPLAY, SP) == AsmOffsets::OFFSETOF__REGDISPLAY__SP);
        |                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  /crossrootfs/arm/usr/include/stddef.h:22:32: note: expanded from macro 'offsetof'
     22 | #define offsetof(type, member) __builtin_offsetof(type, member)
        |                                ^
  /__w/1/s/src/coreclr/vm/../System.Private.CoreLib/src/System/Runtime/ExceptionServices/AsmOffsets.cs:262:44: note: expression evaluates to '992 == 996'
    262 |     static_assert(offsetof(REGDISPLAY, SP) == AsmOffsets::OFFSETOF__REGDISPLAY__SP);
        |                   ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  /__w/1/s/src/coreclr/vm/../System.Private.CoreLib/src/System/Runtime/ExceptionServices/AsmOffsets.cs:263:19: error: static assertion failed due to requirement '__builtin_offsetof(REGDISPLAY, ControlPC) == AsmOffsetsAsserts::AsmOffsets::OFFSETOF__REGDISPLAY__ControlPC'
    263 |     static_assert(offsetof(REGDISPLAY, ControlPC) == AsmOffsets::OFFSETOF__REGDISPLAY__ControlPC);
        |                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  /crossrootfs/arm/usr/include/stddef.h:22:32: note: expanded from macro 'offsetof'
     22 | #define offsetof(type, member) __builtin_offsetof(type, member)
        |                                ^
  /__w/1/s/src/coreclr/vm/../System.Private.CoreLib/src/System/Runtime/ExceptionServices/AsmOffsets.cs:263:51: note: expression evaluates to '996 == 1000'
    263 |     static_assert(offsetof(REGDISPLAY, ControlPC) == AsmOffsets::OFFSETOF__REGDISPLAY__ControlPC);
        |

Co-authored-by: davidwrighton <10779849+davidwrighton@users.noreply.github.com>
Copilot AI requested review from Copilot and removed request for Copilot June 2, 2026 03:17
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Jun 2, 2026

@copilot arm builds are still failing with errors like

Fixed in b85338d9.

I corrected the ARM Release AsmOffsets REGDISPLAY constants to match the native layout after removing IsCallerSPValid:

  • SIZEOF__REGDISPLAY = 0x400
  • OFFSETOF__REGDISPLAY__SP = 0x3e0
  • OFFSETOF__REGDISPLAY__ControlPC = 0x3e4

Validation run:

  • ./build.sh clr.runtime -c Release -arch arm -os linux -ninja (passes)
  • ./build.sh clr.runtime -c Release -arch x64 -os linux -ninja (passes)

Copilot AI changed the title Remove IsCallerSPValid, standardize caller-frame validity on IsCallerContextValid, and update AsmOffsets Remove IsCallerSPValid, standardize caller-frame validity on IsCallerContextValid, and finalize AsmOffsets updates Jun 2, 2026
@am11
Copy link
Copy Markdown
Member

am11 commented Jun 2, 2026

arm builds are still failing:

  [1314/2213] Building CXX object vm/wks/CMakeFiles/cee_wks_core.dir/__/exceptionhandling.cpp.o
  FAILED: vm/wks/CMakeFiles/cee_wks_core.dir/__/exceptionhandling.cpp.o 
  /usr/local/bin/clang++ --target=arm-linux-gnueabihf --gcc-toolchain=/crossrootfs/arm/usr --sysroot=/crossrootfs/arm -DBUILDENV_CHECKED=1 -DCLR_ARM_FPU_CAPABILITY=0x7 -DCOMPILER_SUPPORTS_W_RESERVED_IDENTIFIER -DDEBUG -DDEBUGGING_SUPPORTED -DDISABLE_CONTRACTS -DFEATURE_BASICFREEZE -DFEATURE_CODE_VERSIONING -DFEATURE_COLLECTIBLE_TYPES -DFEATURE_COMWRAPPERS -DFEATURE_CORECLR -DFEATURE_CORECLR_FLUSH_INSTRUCTION_CACHE_TO_PROTECT_STUB_READS -DFEATURE_DBGIPC_TRANSPORT_DI -DFEATURE_DBGIPC_TRANSPORT_VM -DFEATURE_DEFAULT_INTERFACES -DFEATURE_DYNAMIC_CODE_COMPILED -DFEATURE_EMULATE_SINGLESTEP -DFEATURE_EVENTSOURCE_XPLAT -DFEATURE_EVENT_TRACE -DFEATURE_HIJACK -DFEATURE_INTERPRETER -DFEATURE_JAVAMARSHAL -DFEATURE_METADATA_UPDATER -DFEATURE_MULTICOREJIT -DFEATURE_MULTITHREADING -DFEATURE_PAL_ANSI -DFEATURE_PERFMAP -DFEATURE_PERFTRACING -DFEATURE_PGO -DFEATURE_PROFAPI_ATTACH_DETACH -DFEATURE_READYTORUN -DFEATURE_REJIT -DFEATURE_REMOTE_PROC_MEM -DFEATURE_STANDALONE_GC -DFEATURE_SVR_GC -DFEATURE_SYMDIFF -DFEATURE_TIERED_COMPILATION -DFEATURE_USE_ASM_GC_WRITE_BARRIERS -DFEATURE_USE_SOFTWARE_WRITE_WATCH_FOR_GC_HEAP -DFEATURE_VIRTUAL_STUB_DISPATCH -DGC_DESCRIPTOR -DHOST_ARM -DHOST_UNIX -DPROFILING_SUPPORTED -DTARGET_32BIT -DTARGET_ARM -DTARGET_LINUX -DTARGET_UNIX -DUNICODE -DUNIX_ARM_ABI -DURTBLDENV_FRIENDLY=Checked -DWRITE_BARRIER_CHECK -D_DBG -D_DEBUG -D_FILE_OFFSET_BITS=64 -D_SECURE_SCL=0 -D_TIME_BITS=64 -D_UNICODE -I/__w/1/s/artifacts/obj/coreclr/linux.arm.Checked/vm/wks -I/__w/1/s/src/coreclr/vm/wks -I/__w/1/s/src/coreclr/vm -I/__w/1/s/src/native -I/__w/1/s/src/native/inc -I/__w/1/s/src/coreclr/pal/prebuilt/inc -I/__w/1/s/artifacts/obj -I/__w/1/s/src/coreclr/pal/inc -I/__w/1/s/src/coreclr/pal/inc/rt -I/__w/1/s/src/coreclr/pal/src/safecrt -I/__w/1/s/src/coreclr/inc -I/__w/1/s/src/coreclr/debug/inc -I/__w/1/s/src/coreclr/debug/inc/arm -I/__w/1/s/src/coreclr/debug/inc/dump -I/__w/1/s/src/coreclr/md/inc -I/__w/1/s/artifacts/obj/coreclr/linux.arm.Checked/inc -I/__w/1/s/src/coreclr/hosts/inc -I/__w/1/s/src/coreclr/interpreter/inc -I/__w/1/s/src/coreclr/minipal -I/__w/1/s/src/coreclr/nativeresources -I/__w/1/s/src/coreclr/vm/arm -I/__w/1/s/src/coreclr/vm/../interop/inc -I/__w/1/s/src/coreclr/runtime -I/__w/1/s/src/native/libs/System.IO.Compression.Native -I/__w/1/s/src/native/libs/Common -I/__w/1/s/src/coreclr/vm/eventing/eventpipe -std=gnu++17 -fPIC -mthumb -mfpu=vfpv3 -O2 -Wall -Wno-null-conversion -glldb -fno-omit-frame-pointer -fno-strict-overflow -fno-strict-aliasing -fstack-protector-strong -Werror -Wno-unused-variable -Wno-unused-value -Wno-unused-function -Wno-tautological-compare -Wno-unknown-pragmas -Wimplicit-fallthrough -Wvla -Wno-invalid-offsetof -Wno-unused-but-set-variable -ffp-contract=off -fno-rtti -Wno-unknown-warning-option -ferror-limit=4096 -Wno-unused-private-field -Wno-constant-logical-operand -Wno-pragma-pack -Wno-incompatible-ms-struct -Wno-reserved-identifier -Wno-unsafe-buffer-usage -Wno-single-bit-bitfield-constant-conversion -Wno-cast-function-type-strict -Wno-switch-default -Wno-nontrivial-memaccess -fsigned-char -fvisibility=hidden -ffunction-sections -fdata-sections -march=armv7-a -Wno-null-arithmetic -Wno-sync-alignment -Winvalid-pch -Xclang -include-pch -Xclang /__w/1/s/artifacts/obj/coreclr/linux.arm.Checked/vm/wks/CMakeFiles/cee_wks_core.dir/cmake_pch.hxx.pch -Xclang -include -Xclang /__w/1/s/artifacts/obj/coreclr/linux.arm.Checked/vm/wks/CMakeFiles/cee_wks_core.dir/cmake_pch.hxx -MD -MT vm/wks/CMakeFiles/cee_wks_core.dir/__/exceptionhandling.cpp.o -MF vm/wks/CMakeFiles/cee_wks_core.dir/__/exceptionhandling.cpp.o.d -o vm/wks/CMakeFiles/cee_wks_core.dir/__/exceptionhandling.cpp.o -c /__w/1/s/src/coreclr/vm/exceptionhandling.cpp
  In file included from /__w/1/s/src/coreclr/vm/exceptionhandling.cpp:4469:
  /__w/1/s/src/coreclr/vm/../System.Private.CoreLib/src/System/Runtime/ExceptionServices/AsmOffsets.cs:261:19: error: static assertion failed due to requirement 'sizeof(REGDISPLAY) == AsmOffsetsAsserts::AsmOffsets::SIZEOF__REGDISPLAY'
    261 |     static_assert(sizeof(REGDISPLAY) == AsmOffsets::SIZEOF__REGDISPLAY);
        |                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  /__w/1/s/src/coreclr/vm/../System.Private.CoreLib/src/System/Runtime/ExceptionServices/AsmOffsets.cs:261:38: note: expression evaluates to '1032 == 1036'
    261 |     static_assert(sizeof(REGDISPLAY) == AsmOffsets::SIZEOF__REGDISPLAY);
        |                   ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  /__w/1/s/src/coreclr/vm/../System.Private.CoreLib/src/System/Runtime/ExceptionServices/AsmOffsets.cs:262:19: error: static assertion failed due to requirement '__builtin_offsetof(REGDISPLAY, SP) == AsmOffsetsAsserts::AsmOffsets::OFFSETOF__REGDISPLAY__SP'
    262 |     static_assert(offsetof(REGDISPLAY, SP) == AsmOffsets::OFFSETOF__REGDISPLAY__SP);
        |                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  /usr/local/lib/clang/22/include/__stddef_offsetof.h:16:24: note: expanded from macro 'offsetof'
     16 | #define offsetof(t, d) __builtin_offsetof(t, d)
        |                        ^
  /__w/1/s/src/coreclr/vm/../System.Private.CoreLib/src/System/Runtime/ExceptionServices/AsmOffsets.cs:262:44: note: expression evaluates to '996 == 1000'
    262 |     static_assert(offsetof(REGDISPLAY, SP) == AsmOffsets::OFFSETOF__REGDISPLAY__SP);
        |                   ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  /__w/1/s/src/coreclr/vm/../System.Private.CoreLib/src/System/Runtime/ExceptionServices/AsmOffsets.cs:263:19: error: static assertion failed due to requirement '__builtin_offsetof(REGDISPLAY, ControlPC) == AsmOffsetsAsserts::AsmOffsets::OFFSETOF__REGDISPLAY__ControlPC'
    263 |     static_assert(offsetof(REGDISPLAY, ControlPC) == AsmOffsets::OFFSETOF__REGDISPLAY__ControlPC);
        |                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  /usr/local/lib/clang/22/include/__stddef_offsetof.h:16:24: note: expanded from macro 'offsetof'
     16 | #define offsetof(t, d) __builtin_offsetof(t, d)
        |                        ^
  /__w/1/s/src/coreclr/vm/../System.Private.CoreLib/src/System/Runtime/ExceptionServices/AsmOffsets.cs:263:51: note: expression evaluates to '1000 == 1004'
    263 |     static_assert(offsetof(REGDISPLAY, ControlPC) == AsmOffsets::OFFSETOF__REGDISPLAY__ControlPC);
        |                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  3 errors generated.

@jkotas
Copy link
Copy Markdown
Member

jkotas commented Jun 2, 2026

@copilot Fix build break above

Co-authored-by: jkotas <6668460+jkotas@users.noreply.github.com>
Copilot AI requested review from Copilot and removed request for Copilot June 2, 2026 15:23
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Jun 2, 2026

@copilot Fix build break above

Fixed in d38395eb.

I fixed the remaining ARM Checked build break by correcting DEBUG TARGET_ARM REGDISPLAY constants in AsmOffsets.cs to the values required by native static asserts:

  • SIZEOF__REGDISPLAY = 0x408
  • OFFSETOF__REGDISPLAY__SP = 0x3e4
  • OFFSETOF__REGDISPLAY__ControlPC = 0x3e8

Validated with:

  • ./build.sh clr.runtime -c Checked -arch arm -os linux -ninja

Copilot AI changed the title Remove IsCallerSPValid, standardize caller-frame validity on IsCallerContextValid, and finalize AsmOffsets updates Remove IsCallerSPValid, standardize caller-frame validity on IsCallerContextValid, and finalize ARM AsmOffsets updates Jun 2, 2026
Copilot finished work on behalf of jkotas June 2, 2026 15:25
Copilot AI requested a review from jkotas June 2, 2026 15:25
@jkotas jkotas marked this pull request as ready for review June 2, 2026 19:20
Copilot AI review requested due to automatic review settings June 2, 2026 19:20
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR removes the legacy REGDISPLAY_BASE::IsCallerSPValid flag and standardizes all “caller frame validity” checks and invariants on IsCallerContextValid. It also updates the managed AsmOffsets constants for 32-bit targets so the managed/native REGDISPLAY size/offset static asserts continue to match after the layout change.

Changes:

  • Removed IsCallerSPValid from REGDISPLAY_BASE and deleted remaining writes to it across VM and debugger frame unwind/update sites.
  • Tightened assertions / preconditions that previously accepted either SP-valid or context-valid to require IsCallerContextValid.
  • Updated System.Private.CoreLib AsmOffsets.cs constants for ARM/X86/WASM (Debug + Release) to reflect the new native REGDISPLAY layout.

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/coreclr/vm/wasm/helpers.cpp Drops IsCallerSPValid invalidation during wasm inlined call frame regdisplay updates.
src/coreclr/vm/stackwalk.cpp Drops IsCallerSPValid invalidation after virtual unwind; caller validity now tracked solely via context validity.
src/coreclr/vm/riscv64/stubs.cpp Removes IsCallerSPValid clearing in multiple frame UpdateRegDisplay_Impl implementations.
src/coreclr/vm/loongarch64/stubs.cpp Removes IsCallerSPValid clearing in multiple frame UpdateRegDisplay_Impl implementations.
src/coreclr/vm/i386/cgenx86.cpp Removes IsCallerSPValid clearing in x86 frame UpdateRegDisplay* paths.
src/coreclr/vm/exceptionhandling.cpp Updates a precondition to require IsCallerContextValid (no longer allows SP-only validity).
src/coreclr/vm/excep.cpp Removes IsCallerSPValid clearing in SoftwareExceptionFrame::UpdateRegDisplay_Impl.
src/coreclr/vm/eetwain.cpp Switches GetCallerSp to validate via IsCallerContextValid and removes IsCallerSPValid clearing in unwind paths.
src/coreclr/vm/arm64/stubs.cpp Removes IsCallerSPValid clearing in ARM64 frame UpdateRegDisplay_Impl implementations.
src/coreclr/vm/arm/stubs.cpp Removes IsCallerSPValid clearing in ARM frame UpdateRegDisplay_Impl implementations.
src/coreclr/vm/amd64/cgenamd64.cpp Removes IsCallerSPValid clearing in AMD64 frame UpdateRegDisplay_Impl implementations.
src/coreclr/System.Private.CoreLib/src/System/Runtime/ExceptionServices/AsmOffsets.cs Updates 32-bit target REGDISPLAY size/offset constants (Debug + Release) to match the new native struct layout.
src/coreclr/inc/stackframe.h Tightens CallerStackFrame::FromRegDisplay assertion to require IsCallerContextValid.
src/coreclr/inc/regdisp.h Removes the IsCallerSPValid field and deletes corresponding assignments in FillRegDisplay.
src/coreclr/debug/ee/debugger.cpp Removes IsCallerSPValid clearing in FuncEvalFrame::UpdateRegDisplay_Impl across architectures.

@jkotas jkotas enabled auto-merge (squash) June 3, 2026 01:07
@jkotas jkotas merged commit ac69569 into main Jun 3, 2026
133 checks passed
@jkotas jkotas deleted the copilot/remove-iscaller-spvalid branch June 3, 2026 02:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants