This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Add debug support for merging identical functions (aka ICF)


>> + ?vcall_insn_table = htab_create_ggc (10, vcall_insn_table_hash,
>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?vcall_insn_table_eq, NULL);
>
>> + ? ? ? ? ?struct vcall_insn *item = XNEW (struct vcall_insn);
>> + ? ? ? ? ?struct vcall_insn **slot;
>> +
>> + ? ? ? ? ?gcc_assert (item);
>> + ? ? ? ? ?item->insn_uid = insn_uid;
>> + ? ? ? ? ?item->vtable_slot = TREE_INT_CST_LOW (token);
>> + ? ? ? ? ?slot = (struct vcall_insn **)
>> + ? ? ? ? ? ? ?htab_find_slot_with_hash (vcall_insn_table, (void *) &item,
>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?(hashval_t) insn_uid, INSERT);
>> + ? ? ? ? ?*slot = item;
>
> It looks like vcall_insn_table is a GC hash table, but you're allocating
> items from the heap. ?Do you want GGC_NEW instead of XNEW?

Yes, thanks for catching that!

> I also don't think the (void *) cast is necessary.

Doesn't look like it -- I got a clean bootstrap without it.

After updating my copy to the svn head, I found that my testcase
wasn't robust -- the test case was expecting exactly six points of
call, but the new generated code had an extra destructor call -- so I
modified the test case to be insensitive to exact call counts.

An updated patch is attached.

To answer a question asked on IRC, the extra debug tables add up to 5%
to the debug info for C++ code (less than 4% to the total file size);
quite a bit less for C code. That's less than what we typically remove
from the text section with ICF, and quite a bit less than what we can
remove from text with GC + ICF together.

-cary

Attachment: gcc-icf-patch-3.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]