From: Ulrich Weigand via Gdb-patches <gdb-patches@sourceware.org>
To: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>,
Aditya Kamath1 <Aditya.Kamath1@ibm.com>
Cc: Sangamesh Mallayya <sangamesh.swamy@in.ibm.com>
Subject: Re: [PATCH] Fix for call feature having nine parameters or more in AIX
Date: Fri, 25 Aug 2023 14:13:13 +0000 [thread overview]
Message-ID: <7e067016d514474303f75e6475c1a9c85842e420.camel@de.ibm.com> (raw)
In-Reply-To: <CH2PR15MB3544875C14E9D34421C81146D6E3A@CH2PR15MB3544.namprd15.prod.outlook.com>
Aditya Kamath1 <Aditya.Kamath1@ibm.com> wrote:
>- space += ((len - argbytes + 3) & -4);
>+ space += ((len - argbytes + (int) pow (2, (int)log2 (wordsize)) -1) & -wordsize);
This seems unnecessarily complex, as wordsize is always a power of 2.
It could simply be:
+ space += ((len - argbytes + wordsize - 1) & -wordsize);
>If not let me know what else I can learn or need to change.
I think this is still not quite correct. Depending on the type,
some parameters that are not integers (e.g. structs) should not
be extended, as that doesn't make sense for this type. When
loading into registers, you see the existing code:
memset (word, 0, reg_size);
if (type->code () == TYPE_CODE_INT
|| type->code () == TYPE_CODE_ENUM
|| type->code () == TYPE_CODE_BOOL
|| type->code () == TYPE_CODE_CHAR)
/* Sign or zero extend the "int" into a "word". */
store_unsigned_integer (word, reg_size, byte_order,
unpack_long (type, arg->contents ().data ()));
else
memcpy (word, arg->contents ().data (), len);
It would probably be best to duplicate that logic for the
stack argument case.
Also, the "argbytes" case seems wrong - this is the case where
an argument fits "half" in registers and "half" on the stack.
In those cases, it does not make any sense to "extend" just
the second half on its own ...
Bye,
Ulrich
next prev parent reply other threads:[~2023-08-25 14:13 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-25 9:21 Aditya Kamath1 via Gdb-patches
2023-08-25 11:19 ` Ulrich Weigand via Gdb-patches
2023-08-25 13:35 ` Aditya Kamath1 via Gdb-patches
2023-08-25 14:13 ` Ulrich Weigand via Gdb-patches [this message]
2023-08-25 15:35 ` Aditya Kamath1 via Gdb-patches
2023-08-25 15:57 ` Ulrich Weigand via Gdb-patches
2023-08-25 16:36 ` Aditya Kamath1 via Gdb-patches
2023-08-25 16:49 ` Ulrich Weigand via Gdb-patches
2023-08-25 17:47 ` Aditya Kamath1 via Gdb-patches
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7e067016d514474303f75e6475c1a9c85842e420.camel@de.ibm.com \
--to=gdb-patches@sourceware.org \
--cc=Aditya.Kamath1@ibm.com \
--cc=Ulrich.Weigand@de.ibm.com \
--cc=sangamesh.swamy@in.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox