RFR: 8328275: CodeCache::print_internals should not be called in PRODUCT code

Daniel Jeliński djelinski at openjdk.org
Sat Mar 16 22:34:21 UTC 2024


On Fri, 15 Mar 2024 16:01:01 GMT, Daniel Jeliński <djelinski at openjdk.org> wrote:

> Please review this trivial patch that fixes the compilation on Windows with `--enable-jvm-feature-link-time-opt`.

Without this patch, the build fails with:

java.obj : error LNK2001: unresolved external symbol "public: static void __cdecl CodeCache::print_internals(void)" (?print_internals at CodeCache@@SAXXZ)


The method is defined in codeCache.cpp, but only when `PRODUCT` is not defined.
`PrintCodeCache2` is a `develop` flag; when `PRODUCT` is defined, `PrintCodeCache` is declared as:

const bool PrintCodeCache = false;


When compiling with the default optimization level (O2), the call to `print_internals` is optimized away. However, when compiling with whole program optimization (GL), the optimization doesn't happen, and the linker complains about missing symbol.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/18330#issuecomment-1999993110


More information about the hotspot-runtime-dev mailing list