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

Allow custom storage for UnwindContext and Evaluation #595

Merged
merged 5 commits into from
Oct 12, 2021

Conversation

nbdd0121
Copy link
Contributor

Partially addresses #581 (alloc is still a dep, but everything unwind related doesn't require heap).

New traits UnwindContextStorage and EvaluationStorage is introduced to allow customisation of what the storage is. UnwindContext, UnwindTable and Evaluation will gain 1 additional generic parameter which is defaulted to StoreOnHeap.

The ctor with this generic param is called new_in, and the old new method will use the default param so type inference won't fail.

@philipc
Copy link
Collaborator

philipc commented Oct 10, 2021

Once we do use const generics, would ArrayVec<[T; N]> become ArrayVec<T, N>? Given that, it doesn't make sense to have ArrayVec<Vec<T>>. I realize it will be more boilerplate, but what do you think of leaving Array and ArrayVec how they are, and adding a new ArrayLike that is implemented for ArrayVec and Vec, so that Vec can be used directly instead of via ArrayVec?

@nbdd0121
Copy link
Contributor Author

Wouldn't it require exposing ArrayVec to the user?

@nbdd0121
Copy link
Contributor Author

I think we can still do ArrayVec<[T; N]> with const generics; we don't need the macro anymore and can just do impl<T, const N: usize> ArrayLike for [T; N]> {...}

@philipc
Copy link
Collaborator

philipc commented Oct 10, 2021

Ok, that makes sense. So the comment on ArrayLike is wrong: the trait isn't needed due to lack of const generics, only the macro. (The comment was correct prior to this PR.)

src/read/util.rs Outdated Show resolved Hide resolved
src/read/op.rs Outdated Show resolved Hide resolved
src/read/cfi.rs Outdated Show resolved Hide resolved
src/read/op.rs Outdated Show resolved Hide resolved
src/read/op.rs Outdated Show resolved Hide resolved
src/read/util.rs Show resolved Hide resolved
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 80010ee into gimli-rs:master Oct 12, 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.

None yet

2 participants