TypeInfo in struct ABI
Teodor Dutu
teodor.dutu at gmail.com
Mon Jan 17 15:26:46 UTC 2022
Hi,
In order to allocate a `struct` type, two DRuntime hooks are
used: `_d_newitemT` for uninitialised structs and `_d_newitemiT`
for initialised ones. Both hooks call `_d_newitemU`, which
allocates memory for the struct and [writes the struct’s
`TypeInfo`](https://github.com/dlang/druntime/blob/9d99b1ccd90d1e66c31e27cc71b8a266612aa14a/src/rt/lifetime.d#L1122) at the end of the allocated chunk.
We now attempt to convert these hooks to templates, with the goal
of not using `TypeInfo` at all. However, the fact that the ABI of
a struct contains its `TypeInfo` prevents us from achieving this
goal. Is this `TypeInfo` object still necessary for anything, or
are we free to remove it from the ABI altogether so that we have
cleaner implementations for `_d_newitem{U,iT,T}`?
Thanks,
Teodor
More information about the Digitalmars-d
mailing list