Skip to content

Revert ZeroGC: stop depending on MethodTable internal layout for IsLargeObject (#3298) - #3299

Merged
kkokosa merged 1 commit into
dotnet:feature/ZeroGCfrom
kkokosa:revert/zerogc-islargeobject-methodtable
Aug 5, 2026
Merged

Revert ZeroGC: stop depending on MethodTable internal layout for IsLargeObject (#3298)#3299
kkokosa merged 1 commit into
dotnet:feature/ZeroGCfrom
kkokosa:revert/zerogc-islargeobject-methodtable

Conversation

@kkokosa

@kkokosa kkokosa commented Aug 4, 2026

Copy link
Copy Markdown
Member

Summary

Reverts #3298 ("ZeroGC: stop depending on MethodTable internal layout for IsLargeObject"), restoring the original pObj->GetGCSafeMethodTable()->GetBaseSize() >= LARGE_OBJECT_SIZE implementation of IsLargeObject.

Why

Per review discussion on #3298: the GC/EE data-layout contract is versioned in a structured way, not just by convention.

  • LARGE_OBJECT_SIZE (85,000 bytes) is a public constant from the versioned gcinterface.h - safe to depend on regardless.
  • The one concrete historical layout break ZeroGC: stop depending on MethodTable internal layout for IsLargeObject #3298 was defending against - MethodTable::Collectible()'s flag bit remap (Converge Representations between NativeAOT and CoreCLR runtime#91821) - bumped EE_INTERFACE_MAJOR_VERSION 1→2 in that same PR. gcenv.object.h's existing shim (g_oldMethodTableFlags), which ZeroGC's dllmain.cpp already plugs into (g_runtimeSupportedVersion.MajorVersion < 2), branches on exactly that signal. So this kind of layout drift is covered by a real, numbered contract, not just convention.
  • MethodTable::GetBaseSize() itself has never needed such a compatibility shim.
  • ZeroGC can't avoid depending on MethodTable/Object layout anyway - those types are mandatory for the IGCHeap interface signatures it implements. Removing this one call site didn't reduce ZeroGC's actual exposure to layout drift.

Net effect of #3298 was added ongoing cost (a std::map + critical section on every LOH-sized allocation) without closing off a real risk. This PR reverts it back to the simpler, original implementation.

Testing

@kkokosa
kkokosa merged commit 7ec235b into dotnet:feature/ZeroGC Aug 5, 2026
8 checks passed
@kkokosa
kkokosa deleted the revert/zerogc-islargeobject-methodtable branch August 5, 2026 07:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant