Skip to content

Any-style dynamic downcasts - #707

Open
SNoAnd wants to merge 1 commit into
asterinas:mainfrom
CertiKProject:main
Open

Any-style dynamic downcasts#707
SNoAnd wants to merge 1 commit into
asterinas:mainfrom
CertiKProject:main

Conversation

@SNoAnd

@SNoAnd SNoAnd commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

This PR introduces two related structures: a trait mechanism representing a collection of distinct types, distinguished by an abstract type_id; and an implementation as a fixed-size array of bytes with the type_id tracked as a ghost variable (GhostTaggedArray).

This allows us to:

  • represent the byte array in MetaSlot with an object that is binary-equivalent, as opposed to MetaSlotStorage, which carries an extra tag to distinguish its contents
  • up- and down-cast to and from dyn AnyFrameMeta soundly
  • prove that write_meta preserves the proper relationship between the metadata type as seen by the compiler, the type's bit-pattern, and vtable_ptr

An alternative approach would be to modify Verus to expose its internal typeIds to the verification. Then we could do away with the complex trait system, but keep the underling ghost-tagged-array representation.

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.

1 participant