tail call optimizations
Jeffrey A Law
Wed Mar 22 17:32:00 GMT 2000
In message < firstname.lastname@example.org >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.
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
More information about the Gcc-patches