JDK-8337251 : C1: Improve Class.isInstance intrinsic
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 24
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2024-07-26
  • Updated: 2025-02-20
  • Resolved: 2025-02-07
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 25
25 b10Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Description
Reflective case for Class::isInstance(Object) is backed by Runtime1::is_instance_of() which uses oopDesc::is_a() to do the job.

Consider improving the implementation based on backend functionality introduced by JDK-8331341.


hotspot/src/share/vm/c1/c1_LIRGenerator.cpp:
// Example: clazz.isInstance(object)
void LIRGenerator::do_isInstance(Intrinsic* x) {
...
  // TODO could try to substitute this node with an equivalent InstanceOf
  // if clazz is known to be a constant Class. This will pick up newly found
  // constants after HIR construction. I'll leave this to a future change.

  // as a first cut, make a simple leaf call to runtime to stay platform independent.
  // could follow the aastore example in a future change.


Comments
Changeset: b40f8eef Branch: master Author: Andrew Haley <aph@openjdk.org> Date: 2025-02-07 17:39:10 +0000 URL: https://git.openjdk.org/jdk/commit/b40f8eef98dac066816d4d548b2304276a76d5e0
07-02-2025

[~vlivanov] https://github.com/openjdk/jdk/pull/22491 is ready for review. Thank you.
06-12-2024

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk/pull/22491 Date: 2024-12-02 17:16:22 +0000
02-12-2024