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: RFA: Use _Unwind_Ptr (Was: Re: RFC / RFA: dwarf2 unwinding for targets with call-part-clobbered registers)


On Thu, Jul 10, 2003 at 05:18:51PM +0100, Joern Rennecke wrote:
> 	* unwind.h (_Unwind_GetPtr): Declare.
>         * unwind-dw2.c (_Unwind_SavedPtr): Provide default definition.
> 	(_Unwind_GetPtr): New function.
>         (uw_update_context_1): Use it.  Use _Unwind_SavedPtr for type of
> 	tmp_sp.
>         (uw_update_context, uw_install_context_1): Use _Unwind_GetPtr.
>         (uw_init_context_1): Likewise.  Use _Unwind_SavedPtr for type of
> 	sp_slot.

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

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;

  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.


r~


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