Fixes the following linker errors (simplified): ld: in function `G1CMOopClosure::do_oop(oopDesc**)': undefined reference to `void G1CMOopClosure::do_oop_work(oopDesc**)' ld: in function `G1CMOopClosure::do_oop(unsigned int*)': undefined reference to `void G1CMOopClosure::do_oop_work(unsigned int*)' ld: in function `G1RootRegionScanClosure::do_oop(oopDesc**)': undefined reference to `void G1RootRegionScanClosure::do_oop_work(oopDesc**)' This is probably caused by devirtualization adding calls to these template functions--as undefined, when only the declaration is visible in a compilation unit; and since the definitions are marked inline they may be not emitted in other compilation units either. There are more undefined symbols from the same missing #include in some object files that happen to be emitted in others, but that may change any time when the optimizer decides to inline them, too. The full list is: _ZN14G1CMOopClosure11do_oop_workIP7oopDescEEvPT_ _ZN14G1CMOopClosure11do_oop_workIjEEvPT_ _ZN22G1RebuildRemSetClosure11do_oop_workIP7oopDescEEvPT_ _ZN22G1RebuildRemSetClosure11do_oop_workIjEEvPT_ _ZN23G1RootRegionScanClosure11do_oop_workIP7oopDescEEvPT_ _ZN23G1RootRegionScanClosure11do_oop_workIjEEvPT_ _ZN25G1ScanEvacuatedObjClosure11do_oop_workIP7oopDescEEvPT_ _ZN25G1ScanEvacuatedObjClosure11do_oop_workIjEEvPT_ _ZN28G1ConcurrentRefineOopClosure11do_oop_workIP7oopDescEEvPT_ _ZN28G1ConcurrentRefineOopClosure11do_oop_workIjEEvPT_ _ZN29G1ScanObjsDuringScanRSClosure11do_oop_workIP7oopDescEEvPT_ _ZN29G1ScanObjsDuringScanRSClosure11do_oop_workIjEEvPT_ _ZN31G1ScanObjsDuringUpdateRSClosure11do_oop_workIP7oopDescEEvPT_ _ZN31G1ScanObjsDuringUpdateRSClosure11do_oop_workIjEEvPT_ This patch adds the missing #include statement to pull in the definitions of the functions listed above to the sources of the objects where I found undefined references to these functions. Signed-off-by: Alexander Miller --- jdk11u-jdk-11.0.14-ga/src/hotspot/share/gc/g1/g1CodeBlobClosure.cpp +++ jdk11u-jdk-11.0.14-ga/src/hotspot/share/gc/g1/g1CodeBlobClosure.cpp @@ -26,6 +26,7 @@ #include "code/nmethod.hpp" #include "gc/g1/g1CodeBlobClosure.hpp" #include "gc/g1/g1CollectedHeap.inline.hpp" +#include "gc/g1/g1OopClosures.inline.hpp" #include "gc/g1/heapRegion.hpp" #include "gc/g1/heapRegionRemSet.hpp" #include "oops/access.inline.hpp" --- jdk11u-jdk-11.0.14-ga/src/hotspot/share/gc/g1/g1HeapVerifier.cpp +++ jdk11u-jdk-11.0.14-ga/src/hotspot/share/gc/g1/g1HeapVerifier.cpp @@ -28,6 +28,7 @@ #include "gc/g1/g1CollectedHeap.inline.hpp" #include "gc/g1/g1ConcurrentMarkThread.hpp" #include "gc/g1/g1HeapVerifier.hpp" +#include "gc/g1/g1OopClosures.inline.hpp" #include "gc/g1/g1Policy.hpp" #include "gc/g1/g1RemSet.hpp" #include "gc/g1/g1RootProcessor.hpp" --- jdk11u-jdk-11.0.14-ga/src/hotspot/share/gc/g1/g1StringDedupQueue.cpp +++ jdk11u-jdk-11.0.14-ga/src/hotspot/share/gc/g1/g1StringDedupQueue.cpp @@ -25,6 +25,7 @@ #include "precompiled.hpp" #include "classfile/javaClasses.inline.hpp" #include "gc/g1/g1CollectedHeap.hpp" +#include "gc/g1/g1OopClosures.inline.hpp" #include "gc/g1/g1StringDedup.hpp" #include "gc/g1/g1StringDedupQueue.hpp" #include "logging/log.hpp"