Re: [HACKERS] Minor codegen silliness in ExecInterpExpr()

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Re: [HACKERS] Minor codegen silliness in ExecInterpExpr()
Дата
Msg-id 20170928224720.lqasb3kyb2j73tpk@alap3.anarazel.de
обсуждение исходный текст
Ответ на Re: [HACKERS] Minor codegen silliness in ExecInterpExpr()  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: [HACKERS] Minor codegen silliness in ExecInterpExpr()  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On 2017-09-28 18:39:03 -0400, Tom Lane wrote:
> Andres Freund <andres@anarazel.de> writes:
> > On 2017-09-28 16:21:34 -0400, Tom Lane wrote:
> >> We could save a pointless register spill
> >> and reload if there were a temporary variable in there,
> 
> > Makes sense.  Do you want to make it so, or shall I?
> 
> I just finished testing a patch, as attached.  On my machine (again,
> not latest gcc: 4.4.7 on RHEL6 x86_64), it reduces the code size of
> execExprInterp.o by a fraction of a percent, and it seems to offer
> a slight benefit in "pgbench -S" performance although I'd not put
> much stock in that being reproducible.

Cool.

> +         * Note: the reason for using a temporary variable "d", here and in
> +         * other places, is that some compilers think "*op->resvalue = f();"
> +         * requires them to evaluate op->resvalue into a register before
> +         * calling f(), just in case f() is able to modify op->resvalue
> +         * somehow.  The extra line of code can save a useless register spill
> +         * and reload, on architectures without many registers.

I'd remove the "without many registers" bit - that's really more an
functioncall ABI question (#caller vs #callee saved registers) than
about the actual architecture.

Greetings,

Andres Freund


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Peter Geoghegan
Дата:
Сообщение: Re: [HACKERS] The case for removing replacement selection sort
Следующее
От: Tom Lane
Дата:
Сообщение: Re: [HACKERS] Binary search in fmgr_isbuiltin() is a bottleneck.