[CLASSES]: Shrink struct class_member
[acme@newtoy pahole]$ codiff build/libclasses.so.orig build/libclasses.so /home/acme/pahole/classes.c: struct class_member | -16 1 struct changed class_member__new | +6 class_member__names | +5 class_member__print | -9 class__find_holes | -37 class__print_struct | -22 cu__process_class | +1 6 functions changed, 12 bytes added, 68 bytes removed [acme@newtoy pahole]$ Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
This commit is contained in:
parent
849eda4a71
commit
95578b7694
12
classes.c
12
classes.c
|
@ -641,9 +641,9 @@ static struct class_member *class_member__new(Dwarf_Off id,
|
|||
const char *decl_file,
|
||||
uint32_t decl_line,
|
||||
const char *name,
|
||||
uint64_t offset,
|
||||
Dwarf_Off offset,
|
||||
size_t bit_size,
|
||||
unsigned int bit_offset)
|
||||
uint8_t bit_offset)
|
||||
{
|
||||
struct class_member *self = zalloc(sizeof(*self));
|
||||
|
||||
|
@ -848,7 +848,7 @@ static size_t class_member__print(struct class_member *self)
|
|||
sizeof(class_name),
|
||||
self->name, 1);
|
||||
|
||||
printf("%s %*.*s/* %5llu %5u */",
|
||||
printf("%s %*.*s/* %5u %5u */",
|
||||
class_name, spacing, spacing, " ",
|
||||
self->offset, size);
|
||||
goto out;
|
||||
|
@ -866,7 +866,7 @@ static size_t class_member__print(struct class_member *self)
|
|||
strlen(self->name) : -1);
|
||||
union__snprintf(type, class_name, sizeof(class_name),
|
||||
self->name, 1);
|
||||
printf("%s %*.*s/* %5llu %5u */",
|
||||
printf("%s %*.*s/* %5u %5u */",
|
||||
class_name, spacing, spacing, " ",
|
||||
self->offset, size);
|
||||
goto out;
|
||||
|
@ -882,7 +882,7 @@ static size_t class_member__print(struct class_member *self)
|
|||
strncat(class_name, ";", sizeof(class_name));
|
||||
}
|
||||
|
||||
printf("%-26s %-21s /* %5llu %5u */",
|
||||
printf("%-26s %-21s /* %5u %5u */",
|
||||
class_name, member_name, self->offset, size);
|
||||
out:
|
||||
return size;
|
||||
|
@ -1630,7 +1630,7 @@ static uint64_t __libdw_get_uleb128(uint64_t acc, unsigned int i,
|
|||
} while (0)
|
||||
|
||||
|
||||
static uint64_t attr_offset(Dwarf_Die *die)
|
||||
static Dwarf_Off attr_offset(Dwarf_Die *die)
|
||||
{
|
||||
Dwarf_Attribute attr;
|
||||
|
||||
|
|
12
classes.h
12
classes.h
|
@ -79,13 +79,13 @@ struct class_member {
|
|||
struct tag tag;
|
||||
char *name;
|
||||
struct class *class;
|
||||
uint64_t offset;
|
||||
size_t bit_size;
|
||||
unsigned int bit_offset;
|
||||
unsigned char visited:1;
|
||||
unsigned short hole; /* If there is a hole before the next
|
||||
uint16_t offset;
|
||||
uint8_t bit_offset;
|
||||
uint8_t bit_size;
|
||||
uint8_t bit_hole; /* If there is a bit hole before the next
|
||||
one (or the end of the struct) */
|
||||
unsigned short bit_hole; /* If there is a bit hole before the next
|
||||
uint8_t visited:1;
|
||||
uint16_t hole; /* If there is a hole before the next
|
||||
one (or the end of the struct) */
|
||||
};
|
||||
|
||||
|
|
12
codiff.c
12
codiff.c
|
@ -141,11 +141,13 @@ static int check_print_change(const struct class_member *old,
|
|||
|
||||
if (changes && print && !show_terse_type_changes)
|
||||
printf(" %s\n"
|
||||
" from: %-21s /* %5llu(%u) %5u(%u) */\n"
|
||||
" to: %-21s /* %5llu(%u) %5u(%u) */\n",
|
||||
" from: %-21s /* %5u(%u) %5u(%u) */\n"
|
||||
" to: %-21s /* %5u(%u) %5u(%u) */\n",
|
||||
old_member_name,
|
||||
old_class_name, old->offset, old->bit_offset, old_size, old->bit_size,
|
||||
new_class_name, new->offset, new->bit_offset, new_size, new->bit_size);
|
||||
old_class_name, old->offset, old->bit_offset,
|
||||
old_size, old->bit_size,
|
||||
new_class_name, new->offset, new->bit_offset,
|
||||
new_size, new->bit_size);
|
||||
|
||||
return changes;
|
||||
}
|
||||
|
@ -302,7 +304,7 @@ static void show_changed_member(char change, const struct class_member *member)
|
|||
size_t size = class_member__names(NULL, member,
|
||||
class_name, sizeof(class_name),
|
||||
member_name, sizeof(member_name));
|
||||
printf(" %c%-26s %-21s /* %5llu %5u */\n",
|
||||
printf(" %c%-26s %-21s /* %5u %5u */\n",
|
||||
change, class_name, member_name, member->offset, size);
|
||||
}
|
||||
|
||||
|
|
4
pahole.c
4
pahole.c
|
@ -79,7 +79,7 @@ static void nr_members_formatter(const struct structure *self)
|
|||
|
||||
static void size_formatter(const struct structure *self)
|
||||
{
|
||||
printf("%s: %llu %u\n", self->class->name, self->class->size,
|
||||
printf("%s: %u %u\n", self->class->name, self->class->size,
|
||||
self->class->nr_holes);
|
||||
}
|
||||
|
||||
|
@ -152,7 +152,7 @@ static void class__chkdupdef(const struct class *self, struct class *dup)
|
|||
char hdr = 0;
|
||||
|
||||
if (self->size != dup->size)
|
||||
class__dupmsg(self, dup, &hdr, "size: %llu != %llu\n",
|
||||
class__dupmsg(self, dup, &hdr, "size: %u != %u\n",
|
||||
self->size, dup->size);
|
||||
|
||||
if (self->nr_members != dup->nr_members)
|
||||
|
|
Loading…
Reference in New Issue