Re: define pg_structiszero(addr, s, r)
Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
From: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
To: Ranier Vilela <ranier.vf@gmail.com>
Cc: Michael Paquier <michael@paquier.xyz>, David Rowley <dgrowleyml@gmail.com>, Peter Smith <smithpb2250@gmail.com>, Peter Eisentraut <peter@eisentraut.org>, Heikki Linnakangas <hlinnaka@iki.fi>, pgsql-hackers@lists.postgresql.org
Date: 2024-11-14T12:33:20Z
Lists: pgsql-hackers
Hi, On Thu, Nov 14, 2024 at 09:13:19AM -0300, Ranier Vilela wrote: > Em qui., 14 de nov. de 2024 às 08:58, Bertrand Drouvot < > Maybe I'm doing something wrong. > But I'm testing in 32-bit, with the size set to 63, with v12 and I'm seeing > the SIMD loop execute. Yeah, that's expected and safe as each iteration reads 32 bytes on 32-bit. > if (len < sizeof(size_t) * 8) // 8-63 bytes > failed. > > I expected that with size 63, it would be solved by case 2, or am I wrong? Case 2 should be read as "in the 4-31" bytes range on 32-bit system as all comparisons are done in size_t. What would be unsafe on 32-bit would be to read up to 32 bytes while len < 32 and that can not happen. As mentioned up-thread the comments are wrong on 32-bit, indeed they must be read as: Case 1: len < 4 bytes Case 2: len in the 4-31 bytes range Case 3: len >= 32 bytes Regards, -- Bertrand Drouvot PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com
Commits
-
Use pg_memory_is_all_zeros() in PageIsVerifiedExtended()
- 03a42c9652f8 18.0 landed
-
Optimize pg_memory_is_all_zeros() in memutils.h
- 5be1dabd2ae0 18.0 landed
-
Remove use of pg_memory_is_all_zeros() in bufpage.c
- e819bbb7c82a 18.0 landed
-
Add pg_memory_is_all_zeros() in memutils.h
- 07e9e28b56db 18.0 landed