JDK-8252494 : C2: TypeAryPtr::cast_to_autobox_cache does not use ptr_type
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 11,15,16
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2020-08-28
  • Updated: 2024-11-22
  • Resolved: 2020-09-11
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 16
16 b16Fixed
Related Reports
Relates :  
Description
CLion reports "ptr_type" is unused here:

const TypeAryPtr* TypeAryPtr::cast_to_autobox_cache(bool cache) const {
  ...
  // The pointers in the autobox arrays are always non-null.
  TypePtr::PTR ptr_type = cache ? TypePtr::NotNull : TypePtr::AnyNull;
  etype = etype->cast_to_ptr_type(TypePtr::NotNull)->is_oopptr();
  ...
}

I wonder if cast_to_ptr_type on the next line was supposed to use ptr_type? If not, then ptr_type definition can be just pruned (and this might be just the Enhancement, not bug).

Assigning to Vladimir, because that code is from JDK-8078629.
Comments
Changeset: 9687dcab Author: Roberto Castaneda Lozano <roberto.castaneda.lozano@oracle.com> Committer: Tobias Hartmann <thartmann@openjdk.org> Date: 2020-09-11 11:55:30 +0000 URL: https://git.openjdk.java.net/jdk/commit/9687dcab
11-09-2020

PR available: https://github.com/openjdk/jdk/pull/106
11-09-2020

Good catch. TypeAryPtr::cast_to_autobox_cache() is always called with cache=true, so there's no bug there. But I agree it should be cleaned up.
01-09-2020