Skip to content

Full support for pointer fragments #72

Description

@RalfJung

These days, values of types like MaybeUninit are only ever represented in-memory in the interpreter; they cannot be stored in a Scalar. Only integers (that never have provenance) and pointers (that always have a single well-defined provenance) can exist as Scalar.

This does give us a chance to represent "partial pointers", so that we could support people writing their own memcpy in const that works by copying MaybeUninit<u8> in a loop. I don't know if there's any real usecase for this, but it seems neat. :D

The main challenge is that we have to ensure that when the bytes of a pointer get put back together, that they all appear in the right order. This is not a constraint that our current per-byte provenance system supports, and I doubt that we want to put such a constraint onto regular runtime semantics. We'd also have to report an error if such a pointer fragment byte makes it into the final value of a constant, since AFAIK we can't represent them in LLVM.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions