On Thu, Sep 07, 2006 at 01:11:49PM +0100, Gregory Stark wrote: > > Martijn van Oosterhout <kleptog@svana.org> writes: > > > The fundamental property of a Datum is that you can pass it by value to > > a C function. This generally means it has to fit in a register. On the > > whole, the CPU register size is the same as the pointer size, so > > 2*sizeof(pointer) is unlikely to fit... > > Not having it fit in a register might impact performance but it certainly > isn't a requirement. You can pass whole structs by value in modern C. (And by > modern here I don't mean C99, this has been supported since before ANSI and is > required by *C89*).
Sure, the C compiler pushes it on the stack and passes a pointer to the function. Pass-by-value in this context means "pass a reference to a copy". It works, but it's not very efficient. The C compiler also allows you create struct variables and assign them as if they were plain variables. The assembly code to make this work isn't pretty. You're proposing doing it for everywhere in the backend, which seems like a huge cost for very little gain. A better approach would be to revive the proposal for a variable-length varlena header. It's four-bytes fixed because that's easy, but given most values are under 4K you could come up with a coding scheme that cut the header for such Datums to only 2 bytes, or less... Have a ncie day, -- Martijn van Oosterhout <kleptog@svana.org> http://svana.org/kleptog/ > From each according to his ability. To each according to his ability to > litigate.
signature.asc
Description: Digital signature