public inbox for jit@gcc.gnu.org
 help / color / mirror / Atom feed
From: David Malcolm <dmalcolm@redhat.com>
To: Antoni Boucher <bouanto@zoho.com>,
	jit@gcc.gnu.org, gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] libgccjit: Add support for types used by atomic builtins [PR96066] [PR96067]
Date: Thu, 20 May 2021 16:24:25 -0400	[thread overview]
Message-ID: <f684e5622d84ca75aebbec88c6fcbf395cc115e1.camel@redhat.com> (raw)
In-Reply-To: <212418d2a4b81cfff1e125ddb12d0b4d10d8404a.camel@zoho.com>

On Mon, 2021-05-17 at 21:02 -0400, Antoni Boucher via Jit wrote:
> Hello.
> This patch fixes the issue with using atomic builtins in libgccjit.
> Thanks to review it.

[...snip...]
 
> diff --git a/gcc/jit/jit-recording.c b/gcc/jit/jit-recording.c
> index 117ff70114c..de876ff9fa6 100644
> --- a/gcc/jit/jit-recording.c
> +++ b/gcc/jit/jit-recording.c
> @@ -2598,8 +2598,18 @@ recording::memento_of_get_pointer::accepts_writes_from (type *rtype)
>      return false;
>  
>    /* It's OK to assign to a (const T *) from a (T *).  */
> -  return m_other_type->unqualified ()
> -    ->accepts_writes_from (rtype_points_to);
> +  if (m_other_type->unqualified ()
> +    ->accepts_writes_from (rtype_points_to)) {
> +      return true;
> +  }
> +
> +  /* It's OK to assign to a (volatile const T *) from a (volatile const T *). */
> +  if (m_other_type->unqualified ()->unqualified ()
> +    ->accepts_writes_from (rtype_points_to->unqualified ())) {
> +      return true;
> +  }

Presumably you need this to get the atomic builtins working?

If I'm reading the above correctly, the new test doesn't distinguish
between the 3 different kinds of qualifiers (aligned, volatile, and
const), it merely tries to strip some of them off.

It's not valid to e.g. assign to a (aligned T *) from a (const T *).

Maybe we need an internal enum to discriminate between different
subclasses of decorated_type?


> +
> +  return false;
>  }
>  
>  /* Implementation of pure virtual hook recording::memento::replay_into
> diff --git a/gcc/testsuite/jit.dg/all-non-failing-tests.h b/gcc/testsuite/jit.dg/all-non-failing-tests.h
> index 4202eb7798b..dfc6596358c 100644
> --- a/gcc/testsuite/jit.dg/all-non-failing-tests.h
> +++ b/gcc/testsuite/jit.dg/all-non-failing-tests.h
> @@ -181,6 +181,13 @@
>  #undef create_code
>  #undef verify_code
>  
> +/* test-builtin-types.c */
> +#define create_code create_code_builtin_types
> +#define verify_code verify_code_builtin_types
> +#include "test-builtin-types.c"
> +#undef create_code
> +#undef verify_code
> +
>  /* test-hello-world.c */
>  #define create_code create_code_hello_world
>  #define verify_code verify_code_hello_world

As with various other patches, this needs to also add a new entry to
the "testcases" array making use of the new
{create|verify}_code_builtin_types functions.

[...snip...]

Hope this is constructive
Dave


  reply	other threads:[~2021-05-20 20:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-18  1:02 Antoni Boucher
2021-05-20 20:24 ` David Malcolm [this message]
2021-05-26 21:58   ` Antoni Boucher
2021-11-20 16:27   ` Antoni Boucher
2021-11-20 18:50     ` David Malcolm
2021-11-21 21:44       ` Antoni Boucher
2021-12-04  4:37         ` Antoni Boucher
2021-12-09 20:25         ` David Malcolm

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=f684e5622d84ca75aebbec88c6fcbf395cc115e1.camel@redhat.com \
    --to=dmalcolm@redhat.com \
    --cc=bouanto@zoho.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jit@gcc.gnu.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).