Re: Something's been bugging me

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Something's been bugging me
Дата
Msg-id 27632.1191182717@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Something's been bugging me  (Gregory Stark <stark@enterprisedb.com>)
Ответы Re: Something's been bugging me  (Gregory Stark <stark@enterprisedb.com>)
Re: Something's been bugging me  (Florian Weimer <fweimer@bfk.de>)
Список pgsql-hackers
Gregory Stark <stark@enterprisedb.com> writes:
> Here's a patch that does all of the above. 

Applied with tweak to use the added byte as an actual length word.

I ran into an interesting failure here on HPPA: the code the compiler
generated for copying unaligned toast pointers into aligned local
variables failed, because it was assuming halfword (2-byte) alignment of
the data to be copied!  (Instead of a memcpy call it was generating an
inline loop of ldh/sth instructions.)  Apparently gcc's thought process
is "the pointer is declared as struct varlena *, therefore must be at
least 4-aligned, therefore the data at offset 2 is at least 2-aligned".
The intermediate cast to "varattrib_1b_e *" did not prevent this; I
had to assign the datum pointer into a separate local variable of that
type to suppress the "optimization".

I'm not sure if the gcc boys would consider this a bug or not; I kinda
suspect the behavior is intentional, because otherwise they'd not be
able to optimize constructs likememcpy((char *) &foo, ...)
which is a pretty darn widespread locution.

Anyway, it seems to work now, I just thought I'd put something in the
archives about what that VARATT_EXTERNAL_GET_POINTER macro is for.
        regards, tom lane


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

Предыдущее
От: Stefan Kaltenbrunner
Дата:
Сообщение: Re: First steps with 8.3 and autovacuum launcher
Следующее
От: Gregory Stark
Дата:
Сообщение: Re: Something's been bugging me