public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Chung-Lin Tang <cltang@codesourcery.com>
To: Jakub Jelinek <jakub@redhat.com>
Cc: gcc-patches <gcc-patches@gcc.gnu.org>,
	Catherine Moore <clm@codesourcery.com>,
	Andrew Stubbs <ams@codesourcery.com>
Subject: Re: [PATCH, v2, OpenMP 5.0, libgomp] Structure element mapping for OpenMP 5.0
Date: Tue, 19 Jan 2021 16:46:36 +0800	[thread overview]
Message-ID: <d277213b-cc8e-4193-d4ec-8df2264a549b@codesourcery.com> (raw)
In-Reply-To: <20210116094518.GA1034503@tucnak>



On 2021/1/16 5:45 下午, Jakub Jelinek wrote:
>> +    /* Unified reference count for structure element siblings, this is used
>> +       when REFCOUNT_STRUCTELEM_FIRST_P(k->refcount) == true, the first sibling
>> +       in a structure element sibling list item sequence.  */
>> +    uintptr_t structelem_refcount;
>> +
>> +    /* When REFCOUNT_STRUCTELEM_P (k->refcount) == true, this field points
> 
> REFCOUNT_STRUCTELEM_P (k->refcount) is true even for
> REFCOUNT_STRUCTELEM_FIRST_P(k->refcount), so shouldn't the description say
> that structelem_refcount_ptr is only used if
> REFCOUNT_STRUCTELEM_P (k->refcount) && !REFCOUNT_STRUCTELEM_FIRST_P (k->refcount)
> ?

Sure, I'll revise the comments a bit.

>> +       into the (above) structelem_refcount field of the _FIRST splay_tree_key,
>> +       the first key in the created sequence. All structure element siblings
>> +       share a single refcount in this manner. Since these two fields won't be
>> +       used at the same time, they are stashed in a union.  */
>> +    uintptr_t *structelem_refcount_ptr;
>> +  };
>>     struct splay_tree_aux *aux;
>>   };
>>   
>>   /* The comparison function.  */
> 
> Anyway, most of the patch looks good, but I'd like to understand the
> rationale for choosing a htab over what I've been trying to suggest, which
> was essentially instead of incrementing or decrementing refcounts push them
> into a vector for later incrementing/decrementing, then qsort the vector
> (by the pointers to refcounts) and increment what the elements point to unless
> the same address has been incremented/decremented already.
> 
> 	Jakub

Essentially the requirement is to increment/decrement a refcount only once per construct,
so using a pointer-set (implemented by htab_t here) to track the processing status
seemed to be more intuitive in code, and probably faster than sorting a vector I think
(at least in most cases).

Chung-Lin

  reply	other threads:[~2021-01-19  8:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-04 14:15 Chung-Lin Tang
2020-12-14 10:32 ` Chung-Lin Tang
2021-01-13 15:25   ` Chung-Lin Tang
2021-01-16  9:45 ` Jakub Jelinek
2021-01-19  8:46   ` Chung-Lin Tang [this message]
2021-01-19  9:22     ` Jakub Jelinek
2023-03-24 15:36 ` [og12] In 'libgomp/target.c:gomp_unmap_vars_internal', defer 'gomp_remove_var' (was: [PATCH, v2, OpenMP 5.0, libgomp] Structure element mapping for OpenMP 5.0) Thomas Schwinge

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=d277213b-cc8e-4193-d4ec-8df2264a549b@codesourcery.com \
    --to=cltang@codesourcery.com \
    --cc=ams@codesourcery.com \
    --cc=clm@codesourcery.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).