public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/aoliva/heads/testme)] [C++] constexpr: request insert iff depth is ok
@ 2022-12-23 5:27 Alexandre Oliva
0 siblings, 0 replies; 3+ messages in thread
From: Alexandre Oliva @ 2022-12-23 5:27 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:0323b06b60b328fd293d20a707951b7b10be4bc0
commit 0323b06b60b328fd293d20a707951b7b10be4bc0
Author: Alexandre Oliva <oliva@gnu.org>
Date: Fri Dec 23 02:25:54 2022 -0300
[C++] constexpr: request insert iff depth is ok
Diff:
---
gcc/cp/constexpr.cc | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/gcc/cp/constexpr.cc b/gcc/cp/constexpr.cc
index d99c49bdbe2..6d20ffa2cde 100644
--- a/gcc/cp/constexpr.cc
+++ b/gcc/cp/constexpr.cc
@@ -3000,13 +3000,15 @@ cxx_eval_call_expression (const constexpr_ctx *ctx, tree t,
/* If we have seen this call before, we are done. */
maybe_initialize_constexpr_call_table ();
+ bool insert = depth_ok < constexpr_cache_depth;
constexpr_call **slot
- = constexpr_call_table->find_slot (&new_call, INSERT);
- entry = *slot;
+ = constexpr_call_table->find_slot (&new_call,
+ insert ? INSERT : NO_INSERT);
+ entry = slot ? *slot : NULL;
if (entry == NULL)
{
/* Only cache up to constexpr_cache_depth to limit memory use. */
- if (depth_ok < constexpr_cache_depth)
+ if (insert)
{
/* We need to keep a pointer to the entry, not just the slot, as
the slot can move during evaluation of the body. */
^ permalink raw reply [flat|nested] 3+ messages in thread
* [gcc(refs/users/aoliva/heads/testme)] [C++] constexpr: request insert iff depth is ok
@ 2022-12-28 5:23 Alexandre Oliva
0 siblings, 0 replies; 3+ messages in thread
From: Alexandre Oliva @ 2022-12-28 5:23 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:1cb664efe1e4cb3bf313a476648b4a46572c6cd2
commit 1cb664efe1e4cb3bf313a476648b4a46572c6cd2
Author: Alexandre Oliva <oliva@adacore.com>
Date: Wed Dec 28 02:21:39 2022 -0300
[C++] constexpr: request insert iff depth is ok
cxx_eval_call_expression requests an INSERT even in cases when it
would later decide not to insert. This could break double-hashing
chains. Arrange for it to use NO_INSERT when the insertion would not
be completed.
for gcc/cp/ChangeLog
* constexpr.cc (cxx_eval_call_expression): Do not request an
INSERT that would not be completed.
Diff:
---
gcc/cp/constexpr.cc | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/gcc/cp/constexpr.cc b/gcc/cp/constexpr.cc
index 414af7a6d4c..a65dbdc5b13 100644
--- a/gcc/cp/constexpr.cc
+++ b/gcc/cp/constexpr.cc
@@ -3000,13 +3000,15 @@ cxx_eval_call_expression (const constexpr_ctx *ctx, tree t,
/* If we have seen this call before, we are done. */
maybe_initialize_constexpr_call_table ();
+ bool insert = depth_ok < constexpr_cache_depth;
constexpr_call **slot
- = constexpr_call_table->find_slot (&new_call, INSERT);
- entry = *slot;
+ = constexpr_call_table->find_slot (&new_call,
+ insert ? INSERT : NO_INSERT);
+ entry = slot ? *slot : NULL;
if (entry == NULL)
{
/* Only cache up to constexpr_cache_depth to limit memory use. */
- if (depth_ok < constexpr_cache_depth)
+ if (insert)
{
/* We need to keep a pointer to the entry, not just the slot, as
the slot can move during evaluation of the body. */
^ permalink raw reply [flat|nested] 3+ messages in thread
* [gcc(refs/users/aoliva/heads/testme)] [C++] constexpr: request insert iff depth is ok
@ 2022-12-23 7:31 Alexandre Oliva
0 siblings, 0 replies; 3+ messages in thread
From: Alexandre Oliva @ 2022-12-23 7:31 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:fd657c67978b83cc4bed5425cdc7fd6b187052de
commit fd657c67978b83cc4bed5425cdc7fd6b187052de
Author: Alexandre Oliva <oliva@gnu.org>
Date: Fri Dec 23 02:25:54 2022 -0300
[C++] constexpr: request insert iff depth is ok
Diff:
---
gcc/cp/constexpr.cc | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/gcc/cp/constexpr.cc b/gcc/cp/constexpr.cc
index d99c49bdbe2..6d20ffa2cde 100644
--- a/gcc/cp/constexpr.cc
+++ b/gcc/cp/constexpr.cc
@@ -3000,13 +3000,15 @@ cxx_eval_call_expression (const constexpr_ctx *ctx, tree t,
/* If we have seen this call before, we are done. */
maybe_initialize_constexpr_call_table ();
+ bool insert = depth_ok < constexpr_cache_depth;
constexpr_call **slot
- = constexpr_call_table->find_slot (&new_call, INSERT);
- entry = *slot;
+ = constexpr_call_table->find_slot (&new_call,
+ insert ? INSERT : NO_INSERT);
+ entry = slot ? *slot : NULL;
if (entry == NULL)
{
/* Only cache up to constexpr_cache_depth to limit memory use. */
- if (depth_ok < constexpr_cache_depth)
+ if (insert)
{
/* We need to keep a pointer to the entry, not just the slot, as
the slot can move during evaluation of the body. */
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-12-28 5:23 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-23 5:27 [gcc(refs/users/aoliva/heads/testme)] [C++] constexpr: request insert iff depth is ok Alexandre Oliva
2022-12-23 7:31 Alexandre Oliva
2022-12-28 5:23 Alexandre Oliva
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).