pgsql: Convert contrib/seg's bool-returning SQL functions to V1 call co

Поиск
Список
Период
Сортировка
От Tom Lane
Тема pgsql: Convert contrib/seg's bool-returning SQL functions to V1 call co
Дата
Msg-id E1atdPs-0005zu-Re@gemulon.postgresql.org
обсуждение исходный текст
Ответы Re: pgsql: Convert contrib/seg's bool-returning SQL functions to V1 call co  (Noah Misch <noah@leadboat.com>)
Список pgsql-committers
Convert contrib/seg's bool-returning SQL functions to V1 call convention.

It appears that we can no longer get away with using V0 call convention
for bool-returning functions in newer versions of MSVC.  The compiler
seems to generate code that doesn't clear the higher-order bits of the
result register, causing the bool result Datum to often read as "true"
when "false" was intended.  This is not very surprising, since the
function thinks it's returning a bool-width result but fmgr_oldstyle
assumes that V0 functions return "char *"; what's surprising is that
that hack worked for so long on so many platforms.

The only functions of this description in core+contrib are in contrib/seg,
which we'd intentionally left mostly in V0 style to serve as a warning
canary if V0 call convention breaks.  We could imagine hacking things
so that they're still V0 (we'd have to redeclare the bool-returning
functions as returning some suitably wide integer type, like size_t,
at the C level).  But on the whole it seems better to convert 'em to V1.
We can still leave the pointer- and int-returning functions in V0 style,
so that the test coverage isn't gone entirely.

Back-patch to 9.5, since our intention is to support VS2015 in 9.5
and later.  There's no SQL-level change in the functions' behavior
so back-patching should be safe enough.

Discussion: <22094.1461273324@sss.pgh.pa.us>

Michael Paquier, adjusted some by me

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/c8e81afc60093b199a128ccdfbb692ced8e0c9cd

Modified Files
--------------
contrib/seg/seg.c | 300 +++++++++++++++++++++++++++++++++++-------------------
1 file changed, 195 insertions(+), 105 deletions(-)


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

Предыдущее
От: Amit Kapila
Дата:
Сообщение: Re: [HACKERS] Re: pgsql: Avoid extra locks in GetSnapshotData if old_snapshot_threshold <
Следующее
От: Tom Lane
Дата:
Сообщение: pgsql: Convert contrib/seg's bool-returning SQL functions to V1 call co