Closed baszalmstra closed 1 year ago
Im not sure if this is still needed. The ABI already doesn't store layouts for arrays or pointers since we use TypeIds for them now. The only place this is now stored is in the mun_memory::Type
however there I think it makes sense because the layout refers to the stack size of storing the element.
These methods are implemented for mun_codegen::Type
, maybe we could explain the difference a little better?
/// Returns the memory layout of the data of the type. This is the layout of the memory when
/// stored on the stack or in the heap.
pub fn value_layout(&self) -> Layout {
...
}
/// Returns the layout of the type when being referenced.
pub fn reference_layout(&self) -> Layout {
...
}
The existing comments LGTM.
Currently, all types store a
layout
which describes the size and alignment of storing a specific Type. For primitives and structs this is a dynamic value but for arrays and pointers this value is always the same (the layout of a*const c_void
).We should remove this from the
TypeData
struct and instead store the layout only in theTypeDataKind
of structs and primitives.