JDK-7154517 : Build error in hotspot-gc without precompiled headers
  • Type: Bug
  • Component: hotspot
  • Sub-Component: gc
  • Affected Version: hs24
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2012-03-16
  • Updated: 2013-09-04
  • Resolved: 2012-04-04
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7 JDK 8 Other
7u40Fixed 8Fixed hs24Fixed
Description
The other day I was debugging a solaris build failure (that was due to not supporting PCH on solaris) by building hotspot without PCH locally on my linux workstation.

I was working out of the hsx/hotspot-gc repo and ran into this build failure:
hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.inline.hpp: In member function ���oopDesc* PSPromotionManager::copy_to_survivor_space(oop)���:
hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.inline.hpp:131:37: error: invalid use of incomplete type ���struct PSOldGen���
hotspot/src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.hpp:38:7: error: forward declaration of ���struct PSOldGen���
hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.inline.hpp:136:43: error: invalid use of incomplete type ���struct PSOldGen���
hotspot/src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.hpp:38:7: error: forward declaration of ���struct PSOldGen���

This is due to the file using a forward declaration of this class, when in fact i needs to actually include a complete declaration.

Suggested fix is to do a direct include:
--- a/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.inline.hpp
+++ b/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.inline.hpp
@@ -25,6 +25,7 @@
 #ifndef SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PSPROMOTIONMANAGER_INLINE_HPP
 #define SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PSPROMOTIONMANAGER_INLINE_HPP
 
+#include "gc_implementation/parallelScavenge/psOldGen.hpp"
 #include "gc_implementation/parallelScavenge/psPromotionManager.hpp"
 #include "gc_implementation/parallelScavenge/psScavenge.hpp"
 
With that I can build with USE_PRECOMPILED_HEADER=0.

Comments
EVALUATION http://hg.openjdk.java.net/hsx/hotspot-gc/hotspot/rev/8a729074feae
21-03-2012