From: Aldy Hernandez <aldyh@redhat.com>
To: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>,
Aldy Hernandez via Gcc-patches <gcc-patches@gcc.gnu.org>
Cc: Andrew MacLeod <amacleod@redhat.com>,
Richard Biener <richard.guenther@gmail.com>,
Jakub Jelinek <jakub@redhat.com>,
mjambor@suse.cz
Subject: Re: [PATCH] Add auto-resizing capability to irange's [PR109695]
Date: Mon, 15 May 2023 16:27:50 +0200 [thread overview]
Message-ID: <02c2333f-31ca-ca58-f167-540e842e4650@redhat.com> (raw)
In-Reply-To: <20230515162453.4f2a5e94@nbbrfq.loc>
On 5/15/23 16:24, Bernhard Reutner-Fischer wrote:
> On Mon, 15 May 2023 12:35:23 +0200
> Aldy Hernandez via Gcc-patches <gcc-patches@gcc.gnu.org> wrote:
>
>> +// For resizable ranges, resize the range up to HARD_MAX_RANGES if the
>> +// NEEDED pairs is greater than the current capacity of the range.
>> +
>> +inline void
>> +irange::maybe_resize (int needed)
>> +{
>> + if (!m_resizable || m_max_ranges == HARD_MAX_RANGES)
>> + return;
>> +
>> + if (needed > m_max_ranges)
>> + {
>> + m_max_ranges = HARD_MAX_RANGES;
>> + wide_int *newmem = new wide_int[m_max_ranges * 2];
>> + memcpy (newmem, m_base, sizeof (wide_int) * num_pairs () * 2);
>> + m_base = newmem;
>
> Please excuse my ignorance, but where's the old m_base freed? I think
> the assignment above does not call the destructor, or does it?
The old m_base is never freed because it points to m_ranges, a static
array in int_range:
template<unsigned N, bool RESIZABLE = false>
class GTY((user)) int_range : public irange
{
...
...
private:
wide_int m_ranges[N*2];
};
Aldy
prev parent reply other threads:[~2023-05-15 14:27 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-15 10:35 Aldy Hernandez
2023-05-15 10:42 ` Jakub Jelinek
2023-05-15 15:07 ` Aldy Hernandez
2023-05-15 18:14 ` Aldy Hernandez
2023-05-16 9:24 ` Aldy Hernandez
2023-05-15 11:08 ` Richard Biener
2023-05-15 11:26 ` Jakub Jelinek
2023-05-15 15:03 ` Aldy Hernandez
2023-05-15 17:23 ` Aldy Hernandez
2023-05-15 14:24 ` Bernhard Reutner-Fischer
2023-05-15 14:27 ` Aldy Hernandez [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=02c2333f-31ca-ca58-f167-540e842e4650@redhat.com \
--to=aldyh@redhat.com \
--cc=amacleod@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jakub@redhat.com \
--cc=mjambor@suse.cz \
--cc=rep.dot.nop@gmail.com \
--cc=richard.guenther@gmail.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).