core: Make function->linkage_name a real string
For the threaded code we want to access strings in tags at the same time that the string table may grow in another thread making the previous pointer invalid, so, to avoid excessive locking, use plain strings. The way the tools work will either consume the just produced CU straight away or keep just one copy of each data structure when we keep all CUs in memory, so lets try stopping using strings_t for strings. Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
a93160df53
commit
4f73cac853
|
@ -1059,7 +1059,7 @@ static struct function *function__new(Dwarf_Die *die, struct cu *cu)
|
|||
ftype__init(&func->proto, die, cu);
|
||||
lexblock__init(&func->lexblock, cu, die);
|
||||
func->name = strings__add(strings, attr_string(die, DW_AT_name));
|
||||
func->linkage_name = strings__add(strings, attr_string(die, DW_AT_MIPS_linkage_name));
|
||||
func->linkage_name = strdup_attr_string(die, DW_AT_MIPS_linkage_name);
|
||||
func->inlined = attr_numeric(die, DW_AT_inline);
|
||||
func->declaration = dwarf_hasattr(die, DW_AT_declaration);
|
||||
func->external = dwarf_hasattr(die, DW_AT_external);
|
||||
|
|
|
@ -807,7 +807,7 @@ struct function {
|
|||
struct lexblock lexblock;
|
||||
struct rb_node rb_node;
|
||||
strings_t name;
|
||||
strings_t linkage_name;
|
||||
const char *linkage_name;
|
||||
uint32_t cu_total_size_inline_expansions;
|
||||
uint16_t cu_total_nr_inline_expansions;
|
||||
uint8_t inlined:2;
|
||||
|
@ -854,10 +854,9 @@ static __pure inline int tag__is_function(const struct tag *tag)
|
|||
|
||||
const char *function__name(struct function *func, const struct cu *cu);
|
||||
|
||||
static inline const char *function__linkage_name(const struct function *func,
|
||||
const struct cu *cu)
|
||||
static inline const char *function__linkage_name(const struct function *func)
|
||||
{
|
||||
return cu__string(cu, func->linkage_name);
|
||||
return func->linkage_name;
|
||||
}
|
||||
|
||||
size_t function__fprintf_stats(const struct tag *tag_func,
|
||||
|
|
|
@ -1349,7 +1349,7 @@ static size_t class__vtable_fprintf(struct class *class, const struct cu *cu,
|
|||
printed += fprintf(fp, "%.*s [%d] = %s(%s), \n",
|
||||
conf->indent, tabs, pos->vtable_entry,
|
||||
function__name(pos, cu),
|
||||
function__linkage_name(pos, cu));
|
||||
function__linkage_name(pos));
|
||||
}
|
||||
|
||||
printed += fprintf(fp, "%.*s} */", conf->indent, tabs);
|
||||
|
@ -1936,8 +1936,7 @@ size_t tag__fprintf(struct tag *tag, const struct cu *cu,
|
|||
const struct function *func = tag__function(tag);
|
||||
|
||||
if (func->linkage_name)
|
||||
printed += fprintf(fp, " /* linkage=%s */",
|
||||
function__linkage_name(func, cu));
|
||||
printed += fprintf(fp, " /* linkage=%s */", function__linkage_name(func));
|
||||
}
|
||||
|
||||
if (pconf->expand_types)
|
||||
|
|
Loading…
Reference in New Issue