(It helps if you've watched the linked allocator video.)
Conceptually, an abstract allocator in the style proposed by Andrei can be set up to just return an offset
This offset can then later be interpreted as "from the start of the struct" or "from the start of memory identified by the pointer to 0".
Fundamentally it's the same thing: take a contiguous (or not!) space of bytes and "carve it up" using some simple algorithm. Then, compose the simple algorithms to make complicated allocators. How you use this later is up to you.
I guarantee you that there's code just like this in the guts of any compiler that can reorder struct/record members, such as the Rust compiler. It might be spaghetti code [1], but it could instead look just like Andrei's beautiful component-based code!
I think it ought to be possible for developers to plug in something as complex as a CP-SAT solver if they want to. It might squeeze out 5% performance, which could be worth millions at the scale of a FAANG!
> This offset can then later be interpreted as "from the start of the struct" or "from the start of memory identified by the pointer to 0".
The issue is, how do you create such an offset, at comptime, such that you can interpet it as "from the start of memory identified by the pointer to 0" at runtime. Because at runtime you'll most often want to do the latter (and surely you don't want to branch on whether it's one or the other), but creating such offsets is the part that's very tricky if not impossible to do properly at comptime.
> I guarantee you that there's code just like this in the guts of any compiler that can reorder struct/record members
How is that relevant though? Ok, the code might look similar, but that's not the problematic part.
Conceptually, an abstract allocator in the style proposed by Andrei can be set up to just return an offset
This offset can then later be interpreted as "from the start of the struct" or "from the start of memory identified by the pointer to 0".
Fundamentally it's the same thing: take a contiguous (or not!) space of bytes and "carve it up" using some simple algorithm. Then, compose the simple algorithms to make complicated allocators. How you use this later is up to you.
I guarantee you that there's code just like this in the guts of any compiler that can reorder struct/record members, such as the Rust compiler. It might be spaghetti code [1], but it could instead look just like Andrei's beautiful component-based code!
I think it ought to be possible for developers to plug in something as complex as a CP-SAT solver if they want to. It might squeeze out 5% performance, which could be worth millions at the scale of a FAANG!
[1] Eww: https://doc.rust-lang.org/beta/nightly-rustc/src/rustc_middl...