runtimeverification / runtimeverification/mir-semantics
Semantics of iterator core code
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 52
- Forks
- 5
- PR merge metrics
- No merged PRs in 30d
Description
Currently our semantics does not support iterators. This can be largely broken down to two problems that we face currently:
- projection ordering issues seen in TransparentWrapper (maybe?);
- Insufficient implementation of BinOp::Offset which always points to a subslice in a collection and not a single element;
When iterating through a collection (or at least an array) the std library converts [T; N] to [std::mem::MaybeUninit<T>; N] via the into_iter() method. Below is std::mem::MaybeUninit and notice that field 0 represents uninit while field 1 represents value containing the T.
pub union MaybeUninit<T> {
uninit: (),
value: ManuallyDrop<T>,
}
Unions are transparent wrappers, in the sense that they are typed different but the they only store the data of T at the local and there is not change binary (e.g. alignment, offset, anything extra stored). The current implementation is designed for structs and only supports field access of 0 as that is the only field that is possible for a struct to be a transparent wrapper, however unions (like above) may have field access of 1. In the branch dc/WIP-union-transparent-wrapper I attempt to add the non-zero field access for unions in the transparent wrapper logic of TraverseProjection.
I am not sure if there is a projection ordering issue in the transparent wrapper logic, I think there might be. But currently it is hard to work with the problem as the wrong type is coming back from the pointer offset logic which always returns a subslice and never an index. After fixing that up things will be much clearer.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the BinOp::Offset and TransparentWrapper sections in kmir/src/kmir/kdist/mir-semantics/rt/data.md, then inspect TraverseProjection and compare the dc/WIP-union-transparent-wrapper branch. Clarify whether projection ordering is involved before changing the offset behavior. Done means iterator handling works for arrays, including MaybeUninit unions and offsets that identify a single element rather than only a subslice.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100