Skip to content

Tighten InstanceIndexBuffer GC-safety#1766

Merged
badrishc merged 1 commit intodevfrom
badrishc/lightepoch-ref
May 4, 2026
Merged

Tighten InstanceIndexBuffer GC-safety#1766
badrishc merged 1 commit intodevfrom
badrishc/lightepoch-ref

Conversation

@badrishc
Copy link
Copy Markdown
Collaborator

@badrishc badrishc commented May 4, 2026

Earlier LightEpoch finding by @kevin-montrose was verified in repro, so porting that fix over.

Copilot AI review requested due to automatic review settings May 4, 2026 18:14
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

Note

Copilot was unable to run its full agentic suite in this review.

Ports a GC-safety fix for InstanceIndexBuffer by switching from explicit-layout/pointer arithmetic to InlineArray with ref-based element access.

Changes:

  • Replace explicit-layout InstanceIndexBuffer with [InlineArray(MaxInstances)] in both LightEpoch implementations
  • Replace pointer-based element addressing with Unsafe.Add(ref field0, instanceId)
  • Annotate byref-return with [UnscopedRef] to relax ref-escape analysis

Reviewed changes

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

File Description
libs/storage/Tsavorite/cs/src/core/Epochs/LightEpoch.cs Converts instance index storage to InlineArray and uses ref-based indexing for GC-safety
libs/client/LightEpoch.cs Mirrors the same InlineArray + Unsafe.Add GC-safety change in the client copy

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread libs/storage/Tsavorite/cs/src/core/Epochs/LightEpoch.cs
Comment thread libs/client/LightEpoch.cs
@badrishc badrishc merged commit ddd711b into dev May 4, 2026
31 of 33 checks passed
@badrishc badrishc deleted the badrishc/lightepoch-ref branch May 4, 2026 19:46
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.

2 participants