RFR: 8292972: Initialize fields if CodeBlobIterator shortcuts without heaps

Aleksey Shipilev shade at openjdk.org
Fri Aug 26 09:43:46 UTC 2022


SonarCloud reports that `CodeBlobIterator::_code_blob` is not initialized on shortcut path:


  CodeBlobIterator(LivenessFilter filter, T* nm = NULL)
    : _only_not_unloading(filter == only_not_unloading)
  {
    if (Filter::heaps() == NULL) {
      return; <---- here
    }


It seems that we don't have an actual bug here, as iterator shortcuts on `_heap == _end`, but it would be cleaner to avoid garbage anyway.

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

Commit messages:
 - Fix

Changes: https://git.openjdk.org/jdk/pull/10041/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=10041&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8292972
  Stats: 4 lines in 1 file changed: 4 ins; 0 del; 0 mod
  Patch: https://git.openjdk.org/jdk/pull/10041.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/10041/head:pull/10041

PR: https://git.openjdk.org/jdk/pull/10041


More information about the hotspot-compiler-dev mailing list