Skip to content

read/cfi: minor CIE/FDE parsing optimisation#866

Merged
philipc merged 1 commit intogimli-rs:masterfrom
philipc:cfi
Jan 20, 2026
Merged

read/cfi: minor CIE/FDE parsing optimisation#866
philipc merged 1 commit intogimli-rs:masterfrom
philipc:cfi

Conversation

@philipc
Copy link
Collaborator

@philipc philipc commented Jan 20, 2026

When asked to parse a CIE, we would fully parse any CIE or FDE at the offset, and then discard the result if it was an FDE. Similarly for parsing an FDE. Optimise this by doing the check of the CIE ID immediately. In practice this is unlikely to make any difference, because the entries will always be the expected type if the data is valid.

Additionally, we had Error::NotCieId, Error::NotCiePointer, and Error::NotFdePointer, but Error::NotCiePointer was not used. However, Error::NotCiePointer is the more logical error for the situation where Error::NotFdePointer was used, so switch to it and delete Error::NotFdePointer.

The git history shows that at some point we already did both of the above (which is why NotCiePointer existed), but they were lost along the way during refactoring.

Also reorder some function parameters for consistency.

When asked to parse a CIE, we would fully parse any CIE or FDE at
the offset, and then discard the result if it was an FDE. Similarly
for parsing an FDE. Optimise this by doing the check of the CIE ID
immediately. In practice this is unlikely to make any difference,
because the entries will always be the expected type if the data is
valid.

Additionally, we had `Error::NotCieId`, `Error::NotCiePointer`, and
`Error::NotFdePointer`, but `Error::NotCiePointer` was not used.
However, `Error::NotCiePointer` is the more logical error for the
situation where `Error::NotFdePointer` was used, so switch to it and
delete `Error::NotFdePointer`.

The git history shows that at some point we already did both of the
above (which is why `NotCiePointer` existed), but they were lost along
the way during refactoring.

Also reorder some function parameters for consistency.
@philipc philipc merged commit d2bd94a into gimli-rs:master Jan 20, 2026
19 checks passed
@philipc philipc deleted the cfi branch January 20, 2026 11:11
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