RFR: 8364296: Set IntelJccErratumMitigation flag ergonomically

Aleksey Shipilev shade at openjdk.org
Thu Jul 31 10:39:54 UTC 2025


On Thu, 31 Jul 2025 08:55:10 GMT, Oli Gillespie <ogillespie at openjdk.org> wrote:

> It actually seems like that's a pattern across the codebase

Yeah, we have not been consistent about this. I believe it would be busy work to change `FLAG_SET_DEFAULT` -> `FLAG_SET_ERGO` everywhere. But the new code should go `FLAG_SET_ERGO`, see for example just a few lines below:


  assert(supports_clflush(), "Always present");
  if (X86ICacheSync == -1) {
    // Auto-detect, choosing the best performant one that still flushes
    // the cache. We could switch to CPUID/SERIALIZE ("4"/"5") going forward.
    if (supports_clwb()) {
      FLAG_SET_ERGO(X86ICacheSync, 3);
    } else if (supports_clflushopt()) {
      FLAG_SET_ERGO(X86ICacheSync, 2);
    } else {
      FLAG_SET_ERGO(X86ICacheSync, 1);
    }


Plus, we have this macro that does the similar thing:


#define FLAG_SET_ERGO_IF_DEFAULT(name, value) \
  do {                                        \
    if (FLAG_IS_DEFAULT(name)) {              \
      FLAG_SET_ERGO(name, value);             \
    }                                         \
  } while (0)

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

PR Comment: https://git.openjdk.org/jdk/pull/26560#issuecomment-3139412386


More information about the hotspot-dev mailing list