Kazu Hirata writes: > Hi, > > I see that the implementation of LANG_HOOKS_GET_CALLEE_FNDECL in Java > always returns NULL (at least for the time being). > > static tree > java_get_callee_fndecl (tree call_expr) > { > tree method, table, element, atable_methods; > > HOST_WIDE_INT index; > > /* FIXME: This is disabled because we end up passing calls through > the PLT, and we do NOT want to do that. */ > return NULL; > > : > : > > Is anybody planning to fix this?
Yes. The problem is that I want to expose opportunities for inlining but I do not want calls to global functions to go through the PLT as required by C semantics. To do that causes endless problems. We now generate local aliases for all global functions, so my intention is to call those aliases, rather than the global functions themselves. But I do need to give inlining a chance to work, and for that to happen the middle end needs to see the _real_ function decl. > If not, I'm thinking about removing this language hook. The reason > is not just clean up. Rather it is because I need to change the > prototype of get_callee_fndecl and > LANG_HOOKS_GET_CALLEE_FNDECL.. Currently, fold_ternary has the > following call tree. > > fold_ternary > get_callee_fndecl > java_get_callee_fndecl > > If I change fold_ternary to take components of CALL_EXPR like the > address expression of CALL_EXPR and the argument list, instead of > CALL_EXPR itself, I would have to change java_get_callee_fndecl to > take the first operand of a CALL_EXPR, instead of a CALL_EXPR. So do that. > It's not that the change is so involved, but it doesn't make much > sense to keep something dead up to date. It's not dead, it's resting. > In other words, when I posted the following patch > > http://gcc.gnu.org/ml/gcc-patches/2005-03/msg02038.html > > Roger Sayle requested to keep the call to get_callee_fndecl so that we > can "fold" the first operand of a CALL_EXPR to a FUNCTION_DECL. That's a good thing to do. > FYI, the above FIXME comes from > > http://gcc.gnu.org/ml/java-patches/2004-q2/msg00083.html Andrew.