Page MenuHomeFreeBSD

radix_trie: simplify trimkey functions
ClosedPublic

Authored by dougm on Jun 23 2023, 8:34 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Jun 30, 11:49 PM
Unknown Object (File)
Sun, Jun 29, 6:47 AM
Unknown Object (File)
Tue, Jun 24, 1:30 AM
Unknown Object (File)
Sun, Jun 22, 7:37 AM
Unknown Object (File)
Sun, Jun 22, 5:44 AM
Unknown Object (File)
Mon, Jun 16, 9:14 AM
Unknown Object (File)
Sun, Jun 15, 11:40 AM
Unknown Object (File)
Jun 11 2025, 2:08 PM
Subscribers

Details

Summary

Replacing a branch and two shifts with a single masking operation saves 64 bytes the pair of functions lookup_le and lookup_ge.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

dougm requested review of this revision.Jun 23 2023, 8:34 AM
dougm created this revision.
sys/vm/vm_radix.c
187–188

I don't see the point of retaining this variable.

188

Can you revise the comment at the top of the function to more clearly explain what is being done here? "Trims the key" is not very clear.

dougm marked 2 inline comments as done.
This revision is now accepted and ready to land.Jun 25 2023, 5:48 PM
This revision was automatically updated to reflect the committed changes.

I'm surprised this is needed, you'd hope the compiler could do this transformation. Maybe worth filling a LLVM bug report?