dwarves: Ditch parameter__type and simplify parameter__name

parameter__type was needed because the abstract_origin resolution was
done later, now it is at dwarf recode time, and for debugging formats
that don't have this crap, never. So it now can use the same idiom as
other tags: foo->tag.type.

parameter__name still exists because the tools still want a string
returned, but for some what they want is indeed the string_t, so that
when looking for a particular string it can be done as an string__find
for the key + integer comparision instead of doing a costlier strcmp.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Arnaldo Carvalho de Melo 2009-03-06 09:27:40 -03:00
parent c178f4698d
commit a2289d0606
6 changed files with 13 additions and 24 deletions

View File

@ -702,13 +702,13 @@ static int function__emit_probes(struct function *self, uint32_t function_id,
if (member != NULL)
fprintf(fp_methods, "\tif ($%s)\n\t",
parameter__name(pos, cu));
parameter__name(pos));
fprintf(fp_methods,
"\tctracer__method_hook(%d, %d, $%s%s%s, %zd);\n",
probe_type,
function_id,
parameter__name(pos, cu),
parameter__name(pos),
member ? "->" : "", member ?: "",
class__size(mini_class));
break;

View File

@ -1041,16 +1041,6 @@ size_t class_member__size(const struct class_member *self,
return tag__size(type, cu);
}
const char *parameter__name(struct parameter *self, const struct cu *cu __unused)
{
return s(self->name);
}
Dwarf_Off parameter__type(struct parameter *self, const struct cu *cu __unused)
{
return self->tag.type;
}
static size_t union__fprintf(struct type *self, const struct cu *cu,
const struct conf_fprintf *conf, FILE *fp);
@ -1456,8 +1446,7 @@ int ftype__has_parm_of_type(const struct ftype *self, const uint16_t target,
struct parameter *pos;
ftype__for_each_parameter(self, pos) {
struct tag *type =
cu__find_type_by_id(cu, parameter__type(pos, cu));
struct tag *type = cu__find_type_by_id(cu, pos->tag.type);
if (type != NULL && type->tag == DW_TAG_pointer_type) {
if (type->type == target)
@ -1713,8 +1702,8 @@ static size_t ftype__fprintf_parms(const struct ftype *self,
indent, tabs);
} else
first_parm = 0;
name = parameter__name(pos, cu);
type = cu__find_type_by_id(cu, parameter__type(pos, cu));
name = parameter__name(pos);
type = cu__find_type_by_id(cu, pos->tag.type);
if (type == NULL) {
snprintf(sbf, sizeof(sbf),
"<ERROR: type %d not found>", pos->tag.type);

View File

@ -530,8 +530,10 @@ static inline struct parameter *tag__parameter(const struct tag *self)
return (struct parameter *)self;
}
extern Dwarf_Off parameter__type(struct parameter *self, const struct cu *cu);
extern const char *parameter__name(struct parameter *self, const struct cu *cu);
static inline const char *parameter__name(const struct parameter *self)
{
return strings__ptr(strings, self->name);
}
enum vlocation {
LOCATION_UNKNOWN,

View File

@ -695,8 +695,7 @@ static int nr_methods_iterator(struct tag *tag, struct cu *cu,
struct type *ctype;
list_for_each_entry(pos, &tag__ftype(tag)->parms, tag.node) {
struct tag *type =
cu__find_type_by_id(cu, parameter__type(pos, cu));
struct tag *type = cu__find_type_by_id(cu, pos->tag.type);
if (type == NULL || type->tag != DW_TAG_pointer_type)
continue;

View File

@ -311,7 +311,7 @@ static int function__emit_type_definitions(struct function *self,
struct parameter *pos;
function__for_each_parameter(self, pos) {
struct tag *type = cu__find_type_by_id(cu, parameter__type(pos, cu));
struct tag *type = cu__find_type_by_id(cu, pos->tag.type);
try_again:
if (type == NULL)
continue;

View File

@ -68,7 +68,7 @@ static int emit_wrapper(struct tag *self, struct cu *cu, void *cookie __unused)
int regparm = 0, needs_wrapper = 0;
function__for_each_parameter(f, parm) {
const Dwarf_Off type_id = parameter__type(parm, cu);
const uint16_t type_id = parm->tag.type;
struct tag *type = cu__find_type_by_id(cu, type_id);
tag__assert_search_result(type);
@ -81,8 +81,7 @@ static int emit_wrapper(struct tag *self, struct cu *cu, void *cookie __unused)
printf("wrap_%s:\n", name);
needs_wrapper = 1;
}
zero_extend(regparm, bt,
parameter__name(parm, cu));
zero_extend(regparm, bt, parameter__name(parm));
}
}
++regparm;