JDK-8260250 : Duplicate check in DebugInformationRecorder::recorders_frozen
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 8,11,16,17
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2021-01-21
  • Updated: 2021-01-28
  • Resolved: 2021-01-22
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 17
17 b07Fixed
Related Reports
Relates :  
Description
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
Comments
Changeset: c5ad713e Author: Aleksey Shipilev <shade@openjdk.org> Date: 2021-01-22 17:19:33 +0000 URL: https://git.openjdk.java.net/jdk/commit/c5ad713e
22-01-2021

Moving from hotspot/runtime -> hotspot/compiler since the DebugInformationRecorder belongs to the JIT Compiler.
21-01-2021