JDK-8160942 : Unused code in GraphKit::record_profiled_receiver_for_speculation
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 9
  • Priority: P5
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2016-07-07
  • Updated: 2016-09-29
  • Resolved: 2016-08-30
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 9
9 b138Fixed
Related Reports
Relates :  
Description
JDK-8031755 introduced a "return n" in GraphKit::record_profiled_receiver_for_speculation() which is never executed and an assignment to 'maybe_null' that has no effect:
http://hg.openjdk.java.net/jdk9/hs-comp/hotspot/rev/37023a7f1e1b#l7.99

+  bool maybe_null = true;
+  if (java_bc() == Bytecodes::_checkcast ||
+      java_bc() == Bytecodes::_instanceof ||
+      java_bc() == Bytecodes::_aastore) {
+    ciProfileData* data = method()->method_data()->bci_to_data(bci());
+    bool maybe_null = data == NULL ? true : data->as_BitData()->null_seen();
+  }
+  return record_profile_for_speculation(n, exact_kls, maybe_null);
+  return n;
Comments
Fix is trivial. However, the fact that these two faults (or their kind) are present in code committed to the JDK repository is outright embarrassing. Both errors are trivially detected by any C/C++ compiler and it is evident that the warning level used is not sufficient, i.e. it should be strict. (There should be a work package to rectify the lack of use of contemporary C/C++ compiler diagnostics.)
12-07-2016

I think the code should look like this: bool maybe_null = true; if (java_bc() == Bytecodes::_checkcast || java_bc() == Bytecodes::_instanceof || java_bc() == Bytecodes::_aastore) { ciProfileData* data = method()->method_data()->bci_to_data(bci()); maybe_null = data == NULL ? true : data->as_BitData()->null_seen(); } return record_profile_for_speculation(n, exact_kls, maybe_null);
07-07-2016

ILW = never executed statements / potentially losing type information, affects type speculation, no workaround = LMH = P5
07-07-2016

This issue was reported by Rados��aw Smogura: http://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/2016-July/023658.html
07-07-2016