public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
From: Tobias Burnus <burnus@net-b.de>
To: Andre Vehreschild <vehre@gmx.de>,
	Tobias Burnus <tobias@codesourcery.com>
Cc: Jakub Jelinek <jakub@redhat.com>,
	gcc-patches <gcc-patches@gcc.gnu.org>,
	fortran <fortran@gcc.gnu.org>
Subject: Re: [Patch] OpenMP/Fortran: Handle polymorphic scalars in data-sharing FIRSTPRIVATE (PR86470)
Date: Mon, 31 Aug 2020 15:58:59 +0200	[thread overview]
Message-ID: <a76b7141-f467-f161-e702-329c7110ef19@net-b.de> (raw)
In-Reply-To: <20200831125507.3affd4af@vepi2>

Hi Andre,

On 8/31/20 12:55 PM, Andre Vehreschild wrote:
> +gfc_is_unlimited_polymorphic_nonptr (tree type)
> +  tree field = TYPE_FIELDS (type); /* _data */
> +  if (!field)
>
> ^^^ here you don't . So theoretically this routine could match a type which
> has a _len as its third field, but that is not a unlim-poly class. Maybe factor
> out the test from the above routine and unify with this one to reuse the test
> for a BT_CLASS?!

Granted. The reason was the code use:
if (polymophic)
   {
   ...
   if (unlimited_polymorphic)

Hence, I assumed that that check was already done, reducing
code size (but having less universality) and increasing
(cold-code) performance.

My new idea is to unify the two functions and add an
"bool only_unlimited" flag.

> Btw, I believe the first routine can be better replaced by:
>
> static bool
> gfc_is_polymorphic_nonptr (tree type)
> {
>    if (POINTER_TYPE_P (type))
>      type = TREE_TYPE (type);
>    return GFC_CLASS_TYPE_P (type);
> }

Maybe. However, when looking into the check for polymorphic
arrays, the DECL_LANG_SPECIFIC (and I think TYPE_LANG_SPECIFIC)
were present but contained only garbage. Thus, it might not work.
(I have to check.) – If it works, I will use your nicer suggestion.
If it doesn't work, I would go for my proposal above.
(Eventually, in a follow-up patch for polymorphic arrays, it has
to be fixed properly to avoid the following hack.)

> +  /* TODO: implement support for polymorphic arrays; reject for now.  */
> +  /* Void arrays appear as var.0 = var._data.data. A bit hackish to
> +     distinguish from 'type(c_ptr) :: var(5)' by scanning for '.';
> +     this assumes that ASM_FORMAT_PRIVATE_NAME uses a '.', which most
> +     systems do. */
> ...
> I totally agree that this is hackish and I don't like for that. But I can't
> come up with a better solution at the moment.

I think some changes at multiple places are needed to implement this
properly – but for the 'sorry' I did not want to do non-local changes;
for the real version, it should use some nicer code!

Thanks for the suggestions and review.

Tobias

PS: I want to first finish working on some other tasks before coming back
to this patch.


  reply	other threads:[~2020-08-31 13:59 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-25 10:50 Tobias Burnus
2020-08-31  8:28 ` Tobias Burnus
2020-08-31 10:55 ` Andre Vehreschild
2020-08-31 13:58   ` Tobias Burnus [this message]
2020-08-31 16:34 ` Jakub Jelinek
2021-03-10 10:55 [Patch] OpenMP/Fortran: Handle polymorphic scalars in data-sharing FIRSTPRIVATE [PR86470] Tobias Burnus
2021-05-23  9:47 ` Tobias Burnus
2021-05-24 14:06 ` Jakub Jelinek

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=a76b7141-f467-f161-e702-329c7110ef19@net-b.de \
    --to=burnus@net-b.de \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=tobias@codesourcery.com \
    --cc=vehre@gmx.de \
    /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).