This is the mail archive of the gcc@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: RFA: Use _Unwind_Ptr (Was: Re: RFC / RFA: dwarf2 unwinding for targets with call-part-clobbered registers)


> Hum.  I'm not thrilled.  And I think it may miss out on external
> users of _Unwind_GetGR etc.

I can't find any evidence of relevant external users.

bash-2.05$ find . -type f | xargs grep -c _Unwind_GetGR|grep -v :0
./gcc/ChangeLog:2
./gcc/libgcc-std.ver:1
./gcc/unwind-dw2.c:9
./gcc/unwind-libunwind.c:1
./gcc/unwind-sjlj.c:1
./gcc/unwind.h:2
./gcc/config/ia64/unwind-ia64.c:1
./gcc/doc/gccint.info-1:1
./gcc/doc/libgcc.texi:1

unwind.h has a declaration and an ia64-specific use.
unwind-libunwind.c has a different definition, but no use.

> I like the _Unwind_GetPtr, for sure, for internal use.  I think it
> should return void* instead of _Unwind_Ptr; all uses wind up casting
> anyway, and that's a nice cleanup.
> 
> However, can we do something like
> 
> _Unwind_Word
> _Unwind_GetGR (struct _Unwind_Context *context, int index)
> {
>   int uw_index = DWARF_REG_TO_UNWIND_COLUMN (index);
>   int size = dwarf_reg_size_table[index];
>   void *ptr = context->reg[uw_index];
> 
>   if (size == sizeof(_Unwind_Ptr))
>     return * (_Unwind_Ptr *) ptr;

I think you need a cast here to avoid a warning.

>   if (size == sizeof(_Unwind_Word))
>     return * (_Unwind_Word *) ptr;
> 
>   abort ();
> }
> 
> static inline void *
> _Unwind_GetPtr (struct _Unwind_Context *context, int index)
> {
>   return (void *)(_Unwind_Ptr) _Unwind_GetGR (context, index);
> }
> 
> Similar changes for _Unwind_SetGR.  We'll need to move the initialization
> of dwarf_reg_size_table, and I do recognize that this depends on your other
> patch to __builtin_init_dwarf_reg_size_table.

That would appear to give the right result - and even with more
functionality consistently available.
However, won't that kill unwinding performance?
If there are no performance concerns, I agree that your design is perferable
as the cleaner one.


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