RFE: configuration for compiling HotSpot with Clang

Chris Lattner clattner at apple.com
Mon Feb 14 15:35:45 PST 2011

On Feb 14, 2011, at 6:23 AM, Volker Simonis wrote:
> That's a good point. Yes I used precompiled headers for both
> configurations - at least I thought I did it.
> I just reread the section about Precompiled Headers in the Clang Users
> Manual and stumbled about the following note: "Clang does not
> automatically use PCH files for headers that are directly included
> within a source file." This is a small GCC incompatibility which may
> have a considerable performance impact on compilation times (GCC
> automatically uses the .gch file for headers which are directly
> included from the source file, and this is exactly the way how PCH is
> implemented in HotSpot: there's one "precompiled.hpp" file which
> includes most of the other headers and which is precompiled at the
> beginning of the build. This "precompiled.hpp" file is than included
> in most of the .cpp files.).

Aha, that would explain it!

> @Chris: is there any, perhaps undocumented, command line option which
> changes this behavior? I think this may be a general issue for GCC
> projects with precompiled headers migrating to Clang.

We don't have direct support for this yet, but it is something we're considering adding.  A simple fix is to just pass "-include path/to/precompiled.hpp" to clang on the command line.  Assuming the header has #include guards, the redundant #include in the code won't cause any problems.

> So I plan to do a new series of measurements and take in to account
> all the other suggestions I got here and by private communication. But
> please be a little patient - this is just a hobby project for the
> evenings:)

Sounds great, thanks for doing this!


More information about the hotspot-dev mailing list