Re: A few more opportunities to use TupleTableSlotOps fields - Mailing list pgsql-hackers

From Andres Freund
Subject Re: A few more opportunities to use TupleTableSlotOps fields
Date
Msg-id 20190521163920.hvibbhmybqrjaoe5@alap3.anarazel.de
Whole thread Raw
In response to Re: A few more opportunities to use TupleTableSlotOps fields  (Antonin Houska <ah@cybertec.at>)
List pgsql-hackers
Hi,

On 2019-05-21 16:47:50 +0200, Antonin Houska wrote:
> I admit I didn't think about this problem. Nevertheless I imagine that due to
> constness of the variables like TTSOpsVirtual (and due to several other const
> declarations) the compiler might be able to compute the address of the
> tts_ops->clear() expression.

It really can't, without actually fetching tts_ops, and reading the
callback's location. How would e.g. tts_virtual_copyslot() know that the
slot's tts_ops point to TTSOpsVirtual? There's simply no way to express
that in C.  If this were a class in C++, the compiler would have decent
chance at it these days (because if it's a final method it can infer
that it has to be, and because whole program optimization allows
devirtualization passes to do so), but well, it's not.

And then there's the whole inlining issue explained in my other recent
mail on the topic.

Greetings,

Andres Freund



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: A few more opportunities to use TupleTableSlotOps fields
Next
From: Andres Freund
Date:
Subject: Re: POC: Cleaning up orphaned files using undo logs