RFR(S/M): 8199472: Fix non-PCH build after JDK-8199319
Stefan Karlsson
stefan.karlsson at oracle.com
Mon Mar 12 19:41:41 UTC 2018
Looks good to me.
If you are open for suggestions, I would like to suggest that we move
allocate_instance_handle to instanceKlass.cpp instead of
instanceKlass.inline.hpp, and get rid of the extra added includes to
instanceKlass.inline.hpp.
Thanks,
StefanK
On 2018-03-12 20:34, Volker Simonis wrote:
> Hi,
>
> can I please have a review and a sponsor for the following fix:
>
> http://cr.openjdk.java.net/~simonis/webrevs/2018/8199472/
> https://bugs.openjdk.java.net/browse/JDK-8199472
>
> The number changes files is "M" but the fix is actually "S" :)
>
> Here come the gory details:
>
> Change "8199319: Remove handles.inline.hpp include from
> reflectionUtils.hpp" breaks the non-PCH build (at least on Ubuntu
> 16.04 with gcc 5.4.0). If you configure with
> "--disable-precompiled-headers" you will get a whole lot of undefined
> reference for "Handle::Handle(Thread*, oopDesc*)" - see bug report.
>
> It seems that newer versions of GCC (and possibly other compilers as
> well) don't emit any code for inline functions if these functions can
> be inlined at all potential call sites.
>
> The problem in this special case is that "Handle::Handle(Thread*,
> oopDesc*)" is not declared "inline" in "handles.hpp", but its
> definition in "handles.inline.hpp" is declared "inline". This leads to
> a situation, where compilation units which only include "handles.hpp"
> will emit a call to "Handle::Handle(Thread*, oopDesc*)" while
> compilation units which include "handles.inline.hpp" will try to
> inline "Handle::Handle(Thread*, oopDesc*)". If all the inlining
> attempts are successful, no instance of "Handle::Handle(Thread*,
> oopDesc*)" will be generated in any of the object files. This will
> lead to the link errors listed in the .
>
> The quick fix for this issue is to include "handles.inline.hpp" into
> all the compilation units with undefined references (listed below).
>
> The correct fix (realized in this RFR) is to declare
> "Handle::Handle(Thread*, oopDesc*)" inline in "handles.hpp". This will
> lead to warnings (which are treated as errors) if the inline
> definition is not available at a call site and will avoid linking
> error due to compiler optimizations. Unfortunately this requires a
> whole lot of follow-up changes, because "handles.hpp" defines some
> derived classes of "Handle" which all have implicitly inline
> constructors which all reference the base class
> "Handle::Handle(Thread*, oopDesc*)" constructor. So the constructors
> of the derived classes have to be explicitly declared inline in
> "handles.hpp" and their implementation has to be moved to
> "handles.inline.hpp". This change again triggers other changes for all
> files which relayed on the derived Handle classes having inline
> constructors...
>
> Thank you and best regards,
> Volker
More information about the hotspot-dev
mailing list