Skip to content
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

Eliminate bounds checks in Bloom #7049

Merged
merged 1 commit into from
May 20, 2024
Merged

Eliminate bounds checks in Bloom #7049

merged 1 commit into from
May 20, 2024

Conversation

benaadams
Copy link
Member

@benaadams benaadams commented May 20, 2024

Changes

  • Take the .Topics array to a local array rather than operating through the property so the Jit can confirm it's .Length cannot change per iteration and eliminate the bounds check.

Before the asm contains the RNGCHKFAIL exception

G_M000_IG09:                ;; offset=0x00D7
       xor      rdx, rdx
       xor      r8d, r8d
       jmp      G_M000_IG05
 
G_M000_IG10:                ;; offset=0x00E1
       call     CORINFO_HELP_RNGCHKFAIL
       int3     
 
; Total bytes of code 231

After it doesn't (and asm is slightly smaller)

G_M000_IG09:                ;; offset=0x00CF
       xor      rdx, rdx
       xor      r8d, r8d
       jmp      G_M000_IG05
 
; Total bytes of code 217

Types of changes

What types of changes does your code introduce?

  • Optimization

Testing

Requires testing

  • No

@LukaszRozmej LukaszRozmej merged commit d781283 into master May 20, 2024
67 checks passed
@LukaszRozmej LukaszRozmej deleted the bloom branch May 20, 2024 08:19
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.

3 participants