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

Implement ArrayVec and use it for RegisterRuleMap and UnwindContext #582

Merged
merged 1 commit into from
Sep 16, 2021

Conversation

nbdd0121
Copy link
Contributor

Essentially undoes #497, but provide an in-crate implementation of a minimal ArrayVec instead of using a dependency.

It should aid readability and keeping all unsafe in one place should make auditing easier.

Copy link
Collaborator

@philipc philipc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm happy to merge this because I think this is heading in the right direction, but do you think we'll need to make this ArrayVec implementation public in order for you to choose between Vec and ArrayVec for #581? If so, maybe we can revert back to the ArrayVec crate as a dependency instead, but make it optional and change the default here to Vec, since I think that's actually a better choice for many users.

src/read/util.rs Outdated Show resolved Hide resolved
src/read/util.rs Outdated Show resolved Hide resolved
@nbdd0121
Copy link
Contributor Author

I'm happy to merge this because I think this is heading in the right direction, but do you think we'll need to make this ArrayVec implementation public in order for you to choose between Vec and ArrayVec for #581?

I am still experimenting different designs and I am not so sure about whether this should be public. I feel that this is a worthy change about readability/maintainability so I send a PR anyway.

If so, maybe we can revert back to the ArrayVec crate as a dependency instead, but make it optional and change the default here to Vec, since I think that's actually a better choice for many users.

Wouldn't that break signal safety guarantee?

@nbdd0121 nbdd0121 force-pushed the master branch 3 times, most recently from 6ac75dc to 799ec15 Compare August 29, 2021 13:45
src/read/util.rs Outdated
type Target = [A::Item];

fn deref(&self) -> &[A::Item] {
let slice = &A::as_slice(&self.storage)[..self.len];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We didn't previously bounds check this in RegisterRuleMap::rules or RegisterRuleMap::rules_mut. There is a performance regression for the benchmark cfi::iterate_entries_evaluate_every_fde, and removing this and the bounds check in deref_mut seems to fix that.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the status of this PR? Do you think this bounds check is something that can be changed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I missed the comment. Will fix and push soon.

@philipc
Copy link
Collaborator

philipc commented Aug 30, 2021

Wouldn't that break signal safety guarantee?

The default behaviour would, but users could use ArrayVec if they need that. I suspect that most current users of gimli don't need signal safety (the only other unwind implementation I'm aware of is unmaintained). There is already a problem for Evaluation, for which we don't support signal safety at all.

Copy link
Collaborator

@philipc philipc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@philipc philipc merged commit d20becf into gimli-rs:master Sep 16, 2021
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