cx icon indicating copy to clipboard operation
cx copied to clipboard

[For Further Discussions] Better format for structs

Open kenje4090 opened this issue 3 years ago • 0 comments

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

kenje4090 avatar Jan 18 '22 03:01 kenje4090