Java: Local function pointer aliases for method metadata
Bryce McKinlay
mckinlay@redhat.com
Wed Aug 18 21:27:00 GMT 2004
This patch changes the function pointer (ncode) entry in libjava's
_Jv_Method struct to use a local alias decl rather than refer directly
to the public decl for the function. Without this, the method pointers
can in some circumstances end up pointing at PLT entries, which makes
stack traces fail. The problem still exists for CNI functions, but this
patch solves it for the common cases. We'll eventually fix it for CNI
also with a change to the way CNI methods are registered as part of the
BC-ABI. make_local_function_alias is based on make_alias_for_thunk from
the C++ front end.
Making this change revealed problems with the way anonymous class
constructors are emitted when compiling source code. At -O3, we'd get a
link error because the anonymous constructor would be removed after
inlining, but the alias wasn't. This was because layout_class_method was
not being called on the synthetic constructor created for the anonymous
class - it might not be created until after the anonymous class is laid
out (thanks to aph for helping to track this down). The solution is to
simply call layout_class_method as soon as the constructor is created.
This also allows us to remove some special handling for anonymous
constructors that had appeared elsewhere.
Bootstrapped/tested on i686. No regressions. OK to commit?
Regards
Bryce
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gcj-local-alias-2.patch
Type: text/x-patch
Size: 4200 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/java-patches/attachments/20040818/17a812ac/attachment.bin>
More information about the Java-patches
mailing list