public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <richard.guenther@gmail.com>
To: Alexandre Oliva <oliva@adacore.com>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [17/17] check hash table insertions
Date: Fri, 30 Dec 2022 12:30:41 +0100	[thread overview]
Message-ID: <AF1ED8D1-C391-4BEA-8320-FB9A056D9856@gmail.com> (raw)
In-Reply-To: <orfscxb7ce.fsf@lxoliva.fsfla.org>



> Am 30.12.2022 um 09:53 schrieb Alexandre Oliva <oliva@adacore.com>:
> 
> On Dec 29, 2022, Richard Biener <richard.guenther@gmail.com> wrote:
> 
>>>> Am 29.12.2022 um 00:06 schrieb Alexandre Oliva <oliva@adacore.com>:
>>> 
>>> On Dec 28, 2022, Richard Biener <richard.guenther@gmail.com> wrote:
>>> 
>>>> I wonder if on INSERT, pushing a DELETED marker would fix the dangling
>>>> insert and search during delete problem be whether that would be
>>>> better from a design point of view? (It of course requires a DELETED
>>>> representation)
>>> 
>>> I'm undecided whether a design that rules out the possibility of not
>>> having DELETED would qualify as unequivocally better.
>>> 
>>> Unless DELETED takes over the NULL representation, and something else is
>>> used for EMPTY, every INSERT point would have to be adjusted to look for
>>> the non-NULL DELETED representation.
> 
>> Not sure what you mean
> 
> I meant existing code tests that dereferencing the returned slot pointer
> yields NULL.  If we were to change the slot value during insert, we'd
> have to adjust all callers.
> 
>> I think turning EMPTY (or DELETED) into
>> DELETED at insert time would make the slot occupied for lookups and
>> thus fix lookup during insert.
> 
> Yup.
> 
>> Of course insert during insert would
>> still fail and possibly return the same slot again.
> 
> Yeah.
> 
>> So the most foolproof design would be a new INSERTING representation.
> 
> There's a glitch there: we can't expand with a pending insert.  So we
> might need to count inserting nodes separately, or (ideally) be able to
> check quickly that insertions have completed.
> 
> But then, inserting with a pending insert ought to be caught and
> reported, because an insertion invalidates previously-returned slot
> pointers, including that of the pending insert.  And that's how I got to
> the proposed patch.
> 
>>> The one-pending-insertion strategy I implemented was the only one I
>>> could find that addressed all of the pitfalls without significant
>>> overhead.  It caught even one case that the mere element-counting had
>>> failed to catch.
> 
>> Yes, it’s true that this addresses all issues with just imposing
>> constraints on API use.  But the I wondered how you catched the
>> completion of the insertion?  (I’ll have to
>> Dig into the patch to see)
> 
> Record the slot with the pending insert, and at any subsequent operation
> (that could be affected by the pending insert), check and report in case
> the insertion was not completed.

Ah, OK, so the completion is checked at the next conflicting operation.  Yeah, that makes sense I guess.

Thus OK (I think Jeff already approved the patch).

Thanks and happy holidays!

Richard 

> 
> 
> -- 
> Alexandre Oliva, happy hacker                https://FSFLA.org/blogs/lxo/
>   Free Software Activist                       GNU Toolchain Engineer
> Disinformation flourishes because many people care deeply about injustice
> but very few check the facts.  Ask me about <https://stallmansupport.org>

  reply	other threads:[~2022-12-30 11:30 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-27  4:07 [00/13] check hash table counts Alexandre Oliva
2022-12-27  4:17 ` [01/13] scoped tables: insert before further lookups Alexandre Oliva
2022-12-27 15:11   ` Jeff Law
2022-12-27  4:18 ` [02/13] varpool: do not add NULL vnodes to referenced Alexandre Oliva
2022-12-27 15:14   ` Jeff Law
2022-12-27  4:19 ` [03/13] tree-inline decl_map: skip mapping NULL to itself Alexandre Oliva
2022-12-27 15:15   ` Jeff Law
2022-12-27  4:21 ` [04/13] [C++] constraint: insert norm entry once Alexandre Oliva
2022-12-27 15:37   ` Jeff Law
2022-12-27  4:22 ` [05/13] ssa-loop-niter: skip caching of null operands Alexandre Oliva
2022-12-27 15:19   ` Jeff Law
2022-12-28  4:03     ` Alexandre Oliva
2022-12-27  4:23 ` [06/13] tree-inline decl_map: skip mapping result's NULL default def Alexandre Oliva
2022-12-27 15:23   ` Jeff Law
2022-12-27  4:24 ` [07/13] postreload-gcse: no insert on mere lookup Alexandre Oliva
2022-12-27 15:11   ` Jeff Law
2022-12-27  4:28 ` [08/13] tm: complete tm_restart insertion Alexandre Oliva
2022-12-27 15:27   ` Jeff Law
2022-12-27  4:30 ` [09/13] [C++] constexpr: request insert iff depth is ok Alexandre Oliva
2022-12-27 15:38   ` Jeff Law
2022-12-27  4:35 ` [10/13] lto: drop dummy partition mapping Alexandre Oliva
2022-12-27 15:34   ` Jeff Law
2022-12-27  4:38 ` [11/13] ada: don't map NULL decl to locus Alexandre Oliva
2022-12-27 15:33   ` Jeff Law
2022-12-27 16:54     ` Arnaud Charlet
2022-12-27  4:38 ` [12/13] hash set: reject attempts to add empty values Alexandre Oliva
2022-12-27 15:30   ` Jeff Law
2022-12-27  4:39 ` [13/13] hash-map: reject empty-looking insertions Alexandre Oliva
2022-12-27 15:31   ` Jeff Law
2022-12-27 17:53   ` David Malcolm
2022-12-28 12:32     ` [15/17] prevent hash set/map insertion of deleted entries Alexandre Oliva
2022-12-29  4:25       ` Jeff Law
2022-12-28  8:50 ` [00/13] check hash table counts Martin Liška
2022-12-28 12:46   ` [16/17] check hash table counts at expand Alexandre Oliva
2023-01-09  7:46     ` Richard Biener
2022-12-28 12:30 ` [14/17] parloops: don't request insert that won't be completed Alexandre Oliva
2022-12-29  2:44   ` Jeff Law
2022-12-28 12:50 ` [17/17] check hash table insertions Alexandre Oliva
2022-12-28 14:20   ` Richard Biener
2022-12-28 23:06     ` Alexandre Oliva
2022-12-29  7:29       ` Richard Biener
2022-12-30  8:53         ` Alexandre Oliva
2022-12-30 11:30           ` Richard Biener [this message]
2022-12-30 16:41             ` Alexandre Oliva

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=AF1ED8D1-C391-4BEA-8320-FB9A056D9856@gmail.com \
    --to=richard.guenther@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=oliva@adacore.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).