* [committed][odr] Guard odr code with odr_active_p
@ 2020-01-01 0:00 Tom de Vries
0 siblings, 0 replies; only message in thread
From: Tom de Vries @ 2020-01-01 0:00 UTC (permalink / raw)
To: dwz, jakub
Hi,
The odr optimization is enabled by the odr variable.
When enabled, some DIEs will get an die_odr_state of ODR_DEF or ODR_DECL,
which is then handled further by code guarded with odr.
However, it may be the case that all DIEs were marked with ODR_NONE, because:
- read_debug_info was run in low-mem mode, or
- read_debug_info was run in optimize-multifile mode, or
- there were no DIEs for which the optimization was applicable.
If all DIEs were marked with ODR_NONE, there is no point in entering further
odr handling code.
Add a variable odr_active_p that is set to true when at least one DIE has an
die_odr_state that is not ODR_NONE, and use the variable to guard some odr code.
Committed to trunk.
Thanks,
- Tom
[odr] Guard odr code with odr_active_p
2020-02-13 Tom de Vries <tdevries@suse.de>
* dwz.c (odr_active_p): New var.
(set_die_odr_state): Set odr_active_p to true.
(read_debug_info): Initialize odr_active_p to false.
(partition_dups_1, partition_dups): Use odr_active_p instead of odr.
---
dwz.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/dwz.c b/dwz.c
index f08bf4e..0c13682 100644
--- a/dwz.c
+++ b/dwz.c
@@ -223,6 +223,7 @@ int odr = 1;
enum odr_mode { ODR_BASIC, ODR_LINK };
enum odr_mode odr_mode = ODR_LINK;
int odr_mode_parsed = 0;
+bool odr_active_p = false;
/* Struct to gather statistics. */
struct stats
@@ -2544,6 +2545,8 @@ set_die_odr_state (dw_cu_ref cu, dw_die_ref die)
/* Ignore anonymous types. */
return;
+ odr_active_p = true;
+
if (decl_p && !other_p && die->die_child == NULL)
{
/* Detected a declaration with no attributes other than DW_AT_name and
@@ -5610,6 +5613,7 @@ read_debug_info (DSO *dso, int kind, unsigned int *die_count)
struct dw_cu cu_buf;
struct dw_die die_buf;
+ odr_active_p = false;
if (odr)
odr_phase = 1;
@@ -6958,7 +6962,7 @@ partition_dups_1 (dw_die_ref *arr, size_t vec_size,
dw_die_ref child;
if (second_phase && !arr[k]->die_ref_seen)
continue;
- if (odr && odr_mode != ODR_BASIC)
+ if (odr_active_p && odr_mode != ODR_BASIC)
arr[k] = reorder_dups (arr[k]);
if (dump_pus_p)
dump_die (arr[k]);
@@ -7113,14 +7117,14 @@ partition_dups (void)
to_free = obstack_alloc (&ob2, 1);
- if (odr)
+ if (odr_active_p)
odr_phase = 2;
for (cu = first_cu; cu; cu = cu->cu_next)
partition_find_dups (&ob2, cu->cu_die);
vec_size = obstack_object_size (&ob2) / sizeof (void *);
- if (odr)
+ if (odr_active_p)
{
arr = (dw_die_ref *) obstack_base (&ob2);
if (progress_p)
@@ -7170,7 +7174,7 @@ partition_dups (void)
vec_size = obstack_object_size (&ob2) / sizeof (void *);
}
- if (odr)
+ if (odr_active_p)
odr_phase = 3;
if (stats_p)
@@ -7179,7 +7183,7 @@ partition_dups (void)
if (vec_size != 0)
{
arr = (dw_die_ref *) obstack_finish (&ob2);
- if (odr)
+ if (odr_active_p)
for (i = 0; i < vec_size; ++i)
{
assert (arr[i] != NULL);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-02-13 18:00 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-01 0:00 [committed][odr] Guard odr code with odr_active_p Tom de Vries
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).