Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: Simon Marchi <simark@simark.ca>
Cc: Tom Tromey <tom@tromey.com>,
	 Simon Marchi <simon.marchi@efficios.com>,
	gdb-patches@sourceware.org
Subject: Re: [PATCH] gdb: restore nullptr check in compunit_symtab::find_call_site
Date: Tue, 03 Dec 2024 13:15:28 -0700	[thread overview]
Message-ID: <871pyomskf.fsf@tromey.com> (raw)
In-Reply-To: <eab86f97-445a-4ac3-b568-4d00f65f9062@simark.ca> (Simon Marchi's message of "Tue, 3 Dec 2024 15:05:23 -0500")

>>>>> "Simon" == Simon Marchi <simark@simark.ca> writes:

>> Yeah, that just doesn't seem significantly better to me.  It is more
>> like a spelling change.

Simon> I don't think it's just a spelling change, because a destructor would
Simon> invoke the destructor of fields.  So I think that if we started invoking
Simon> ~compunit_symtab() manually (instead of compunit_symtab::finalize()),
Simon> we could start using non-trivially-destructible stuff directly as fields
Simon> of compunit_symtab.  In other words, m_call_site_htab wouldn't have to
Simon> be a pointer anymore.

I thought you meant something like 'symtab->m_mumble.~unique_ptr()', as
opposed to 'delete symtab->m_mumble'.

So I see what you mean, but this also seems less good to me.
Currently the obstack allocator prohibits non-trivial destructors, and
this is a good thing, because it means it is harder to make a mistake
here -- adding a field that requires destruction will cause a
compile-time error.

I'd be reluctant to lift that restriction.

Another way forward is a slab allocator that is type-specific so it
knows how to run the destructors.  Inheriting from an interface class
and keeping objects on a list would also work for this purpose.

I somewhat doubt we'll need this kind of thing but it's fine by me if we
do.

Tom

      reply	other threads:[~2024-12-03 20:16 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-03 15:52 Simon Marchi
2024-12-03 16:17 ` Tom de Vries
2024-12-03 19:19   ` Simon Marchi
2024-12-03 17:49 ` Tom Tromey
2024-12-03 19:11   ` Simon Marchi
2024-12-03 19:43     ` Tom Tromey
2024-12-03 20:05       ` Simon Marchi
2024-12-03 20:15         ` Tom Tromey [this message]

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=871pyomskf.fsf@tromey.com \
    --to=tom@tromey.com \
    --cc=gdb-patches@sourceware.org \
    --cc=simark@simark.ca \
    --cc=simon.marchi@efficios.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