Skip to content

[For Further Discussions] Better format for structs  #733

@kenje4090

Description

@kenje4090

CX Struct definition

One array vs N-arrays

CXStruct

  • num fields
  • field string
  • field offset
  • field size
  • field type
    • Type ID (CX atomic, cx atomic pointer, cx struct pointer, cx struct)
    • Field
      • If CX atomic then type id
      • if struct pointer then pointer id
      • if cxatomic pointer then the type of the cx atomic

CXStruct Definition

  1. A struct
  2. the variable layout of a function
  3. the inputs to a function
  4. the outputs of a function
  5. It has the same layout format as a “struct” definition

Is there a “dynamic variable” struct that can define other types at runtime?

TypeID

  • CXAtomic
  • CXAtomicPointer
  • CXStruct
  • CXStructPointer
  • CXArray
  • CXArrayPointer
  • etc
    TypeField
  • If CXAtomic, then CXAtomic type
  • if StructPointer, then the pointer id
  • If CXAtomicPointer, then the type of CXAtomic
  • etc
    Ptr to data/object
    in theory any operation on fixxed data can now occur on an atomic data


Arrays of TypeID and TypeFIeld is enough to define a CXFunction, input and output
and the packing of variables in function bodies

CXStruct Definition

  1. Type Signatures
  • StructFields/Elements/“slots”
  • variable type
  • the misc mets identifier
  1. Data layout/offsets
  • Byte offsets for each data field in a struct
  • Byte offsets for each data field/variable in a cx function
  • Inputs to a function/signature
  • Outputs of a function/signature

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions