Re: SerializeParamList vs machines with strict alignment

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Amit Kapila <amit.kapila16@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>, hlinnaka <hlinnaka@iki.fi>
Date: 2018-10-01T20:49:07Z
Lists: pgsql-hackers
I wrote:
> The attached revised patch contains a test case that demonstrably triggers
> the problem on gaur's host.  Oddly, I do not get a crash either on a PPC
> Mac or a Raspberry Pi 3 running Raspbian.  I'm not very sure why; I traced
> through things with gdb and it's definitely calling EA_flatten_into with
> an odd address and a non-flattened input.  I guess both of those platforms
> have kernel handlers for misaligned accesses?  But the Raspbian box ought
> to be nearly the same as chipmunk, which is where we saw the problem to
> begin with, so I'm a bit confused.

Ah: a bit of googling later, the mystery is solved.  PPC does have support
for unaligned 32-bit accesses, which is as much as EA_flatten_into needs.
(It's 64-bit operations where you might have a problem.)  My info was
also out of date about ARM: more recent processors, at least, can also
do unaligned 32-bit accesses.  chipmunk either has a pretty old processor
or it is configured to disable unaligned access.

Apparently the only somewhat-modern architecture that is resolutely
unaligned-unfriendly is MIPS.

			regards, tom lane


Commits

  1. MAXALIGN the target address where we store flattened value.

  2. Test passing expanded-value representations to workers.