Skip to content

Conversation

@Stevengre
Copy link
Contributor

No description provided.

dkcumming and others added 2 commits October 24, 2025 08:28
Support for `binOpOffset`

- `binOpOffset` is applied to a `PtrLocal` but must come from a `Range`
of some kind (e.g. `[u8; 2]`, `&[u8]`) in which case the offset is
applied to a pointer to the element e.g. `*const u8`;
- Both `Reference` and `PtrLocal` has the same `Metadata` that tracks
and offset;
- In order to ensure that pointers are not out of range when the offset
is applied, `Metadata` has an `OriginSize` field for `PtrLocal` and
`Reference` for the necessary bounds checking in the external `Range`;
- After an offset is applied to a `PtrLocal` it can be turned back into
a `Reference`, which essentially is an index into the `Range` but it
does not return the element type but the `Range` type (with smaller
bounds);
- The bulk of the change is in `#traverseProjection` that now needs to
account for an offset when a `projectionDeref` occurs;
- When a non-zero offset is encountered a
`ProjectionElem::PointerOffset` is appended to the place projections,
later this will be turned into a `CtxPointerOffset` when the contexts
are being processed;
- `CtxPointerOffset` is essentially the same as a subslice as we must
have a `Range` to be offsetting through

Test cases for read and write are added

---------

Co-authored-by: Jost Berthold <jost.berthold@gmail.com>
Copy link
Member

@jberthold jberthold left a comment

Choose a reason for hiding this comment

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

Please use the Create a merge commit option to merge it
(we all keep forgetting it)

@Stevengre Stevengre merged commit f48bd71 into feature/p-token Oct 27, 2025
8 checks passed
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.

4 participants