RFR: 8260250: Duplicate check in DebugInformationRecorder::recorders_frozen

Aleksey Shipilev shade at openjdk.java.net
Thu Jan 21 19:00:37 UTC 2021


SonarCloud instance reports the bug here:
  Identical sub-expressions on both sides of operator "||".

bool DebugInformationRecorder::recorders_frozen() {
  return _oop_recorder->is_complete() || _oop_recorder->is_complete();
}

It seems to be this way since JDK-6964458. I don't see why it is this way. I think the intent was to check and freeze these two recorders:

class OopRecorder : public ResourceObj {
 private:
  ValueRecorder<jobject> _oops;
  ValueRecorder<Metadata*> _metadata;

...but they are in `OopRecorder` already, and so we already get what we want with a single call:

#ifdef ASSERT
  bool is_complete() {
    assert(_oops.is_complete() == _metadata.is_complete(), "must agree");
    return _oops.is_complete();
  }
#endif

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

Commit messages:
 - 8260250: Duplicate check in DebugInformationRecorder::recorders_frozen

Changes: https://git.openjdk.java.net/jdk/pull/2187/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=2187&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8260250
  Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
  Patch: https://git.openjdk.java.net/jdk/pull/2187.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/2187/head:pull/2187

PR: https://git.openjdk.java.net/jdk/pull/2187


More information about the hotspot-compiler-dev mailing list