On Fri, Dec 8, 2023 at 3:06 PM Masahiko Sawada <sawada.m...@gmail.com> wrote: > > BTW Given that the actual value size can be calculated only by the > caller, how does the tree know if the value is embedded or not? It's > probably related to how to store combined pointer/value slots.
Right, this is future work. At first, variable-length types will have to be single-value leaves. In fact, the idea for storing up to 3 offsets in the bitmap header could be done this way -- it would just be a (small) single-value leaf. (Reminder: Currently, fixed-length values are compile-time embeddable if the platform pointer size is big enough.) > If leaf > nodes have a bitmap array that indicates the corresponding slot is an > embedded value or a pointer to a value, it would be easy. That's the most general way to do it. We could do it much more easily with a pointer tag, although for the above idea it may require some endian-aware coding. Both were mentioned in the paper, I recall. > But since > the bitmap array is needed only in the leaf nodes, internal nodes and > leaf nodes will no longer be identical structure, which is not a bad > thing to me, though. Absolutely no way we are going back to double everything: double types, double functions, double memory contexts. Plus, that bitmap in inner nodes could indicate a pointer to a leaf that got there by "lazy expansion".