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]

Re: tail call optimizations



  In message <u98zzaecu9.fsf@yorick.cygnus.com>you write:
  > This breaks many x86 EH tests when I run the testsuite with 
  > --tool_opts '-g -O2'.  This seems to be because the pointer to the
  > exception object is a SAVE_EXPR around a call to __eh_alloc; the sibcall
  > code causes us to expand that call twice, so the pointer passed to
  > __cp_push_exception is not the pointer to the object we just initialized.
  > 
  > Seems to me that it doesn't make sense for a SAVE_EXPR around a call (or
  > indeed, anything else with side effects) to be considered safe_for_unsave.
  > Thoughts?
In general, if a particular call might throw, then we can not perform
tail call optimizations.

Why?  Because we'll have no way to know the proper return pointer since the
callee returns directly to the parent of the caller.  And without the proper
return pointer, how are we supposed to know where to vector the exception?

I don't know if this is related to your problem, but it is the primary
reason why (IMHO) tail calls optimizations are not particularly useful
for C++.

jeff



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