Re: AIX support

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: Srirama Kucherlapati <sriram(dot)rk(at)in(dot)ibm(dot)com>, AIX PG user <postgres-ibm-aix(at)wwpdl(dot)vnet(dot)ibm(dot)com>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Peter Eisentraut <peter(at)eisentraut(dot)org>
Subject: Re: AIX support
Date: 2025-12-09 21:00:28
Message-ID: af9f3d82-a1be-42cf-93b4-80e09664c3e5@iki.fi
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 09/12/2025 18:50, Srirama Kucherlapati wrote:
> @@ -1766,9 +1785,9 @@ endforeach
> # any types wider than 64 bits, as allowing MAXIMUM_ALIGNOF to exceed 8
> # would be too much of a penalty for disk and memory space.
> alignof_double = cdata.get('ALIGNOF_DOUBLE')
> -if cc.alignment('int64_t', args: test_c_args, prefix: '#include <stdint.h>') > alignof_double
> - error('alignment of int64_t is greater than the alignment of double')
> -endif
> +#if cc.alignment('int64_t', args: test_c_args, prefix: '#include <stdint.h>') > alignof_double
> +# error('alignment of int64_t is greater than the alignment of double')
> +#endif
> cdata.set('MAXIMUM_ALIGNOF', alignof_double)
>
> cdata.set('SIZEOF_LONG', cc.sizeof('long', args: test_c_args))

This is unfinished.

> @@ -1820,7 +1839,7 @@ if cc.links('''
> if not meson.is_cross_build()
> r = cc.run('''
> /* This must match the corresponding code in c.h: */
> - #if defined(__GNUC__)
> + #if defined(__GNUC__) || defined(__IBMC__)
> #define pg_attribute_aligned(a) __attribute__((aligned(a)))
> #elif defined(_MSC_VER)
> #define pg_attribute_aligned(a) __declspec(align(a))

There's a comment right there that it must match the corresponding code
in c.h, but you didn't modify c.h.

> + # Native memset() is faster, tested on:
> + memset_loop_limit = 0

Incomplete sentence: tested on what?

We talked about this before. I'm reluctant to have a special case for
AIX, because I suspect this has little to do with the operating system,
and more with the compiler and the CPU architecture. I could be wrong;
maybe the libc memset() implementation on AIX is superior to that on
linux, for example. I'd love to see thorough performance testing of
MemSetAligned() vs memset() on common combinations of CPUs and libc
implementations. Ideally, we can just replace MemSetAligned() with
memset() everywhere.

If you do such testing, please start a separate thread for that. On this
thread, it will get lost with all the AIX-specific stuff.

> +/* This change is required for the meson changes as the autoconf is not run and
> + * to resolve the conflicts in picking the float.h details by default from the
> + * postgres defined datatypes.
> + */
> +#ifdef _AIX
> +#ifndef PGDLLIMPORT
> +#define PGDLLIMPORT
> +#endif /* PGDLLIMPORT */
> +typedef float float4;
> +typedef double float8;

I don't understand these typedefs. What is the conflict the comment
talks about?

> +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
> +#define pg_noreturn _Noreturn
> +#elif defined(__GNUC__)
> +#define pg_noreturn __attribute__((noreturn))
> +#else
> +#define pg_noreturn
> +#endif

Isn't this just duplicating the snippet in c.h?

> +#include <stdbool.h>

This is in c.h too.

> src/include/storage/s_lock.h
> [ switches to __sync_lock_release(lock) on all powerpc systems ]

We talked about this before.

> @@ -18,7 +18,8 @@ GetOptions(
>
> if (not( $format eq 'darwin'
> or $format eq 'gnu'
> - or $format eq 'win'))
> + or $format eq 'win'
> + or $format eq 'aix'))
> {
> die "$0: $format is not yet handled (only darwin, gnu, win are)\n";
> }

Forgot to update the error message.

I didn't review the autoconf / Makefile changes.

> Apologies for the delayed response; I was occupied with other tasks.

Oh no worries, I'm not in any hurry with this. On the contrary to be honest.

- Heikki

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jacob Champion 2025-12-09 21:00:58 [oauth] Stabilize the libpq-oauth ABI (and allow alternative implementations?)
Previous Message Melanie Plageman 2025-12-09 20:21:15 Re: PoC: Compute a histogram of prune_xid to support autovacuum improvements