JDK-8280473 : CI: Support unresolved JVM_CONSTANT_Dynamic constant pool entries
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 11,17,18,19
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2022-01-21
  • Updated: 2024-10-11
  • Resolved: 2022-02-14
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 19
19 b10Fixed
Related Reports
Duplicate :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Description
Support unresolved dynamic constants in CI.

ciConstant ciEnv::get_constant_by_index_impl(const constantPoolHandle& cpool,
                                             int pool_index, int cache_index,
                                             ciInstanceKlass* accessor) {
...
  } else if (tag.is_dynamic_constant()) {
    return ciConstant();
...

Right now, unresolved JVM_CONSTANT_Dynamic CP entries bail out compilations (both C1 and C2):

   201     410   91    b  1       compiler.runtime.TestConstantsInError$Test_CD_9/0x0000000800c11000::test (3 bytes)
   202 compilation bailout: could not resolve a constant
   203     410   91    b  1       compiler.runtime.TestConstantsInError$Test_CD_9/0x0000000800c11000::test (3 bytes)   COMPILE SKIPPED: could not resolve a constant (retry at different tier)


    296   64    b        Test_CD/0x0000000800c0a400::test (3 bytes)
    296   64    b        Test_CD/0x0000000800c0a400::test (3 bytes)   COMPILE SKIPPED: cannot parse method (retry at different tier)


src/hotspot/share/c1/c1_GraphBuilder.cpp:
void GraphBuilder::load_constant() {
  ciConstant con = stream()->get_constant();
  if (con.basic_type() == T_ILLEGAL) {
    // FIXME: an unresolved Dynamic constant can get here,
    // and that should not terminate the whole compilation.
    BAILOUT("could not resolve a constant");

src/hotspot/share/ci/ciTypeFlow.cpp:
// ciTypeFlow::StateVector::do_ldc
void ciTypeFlow::StateVector::do_ldc(ciBytecodeStream* str) {
  ciConstant con = str->get_constant();
  if (con.is_valid()) {
    ...
  } else {
    if (str->is_unresolved_klass_in_error()) {
      trap(str, NULL, Deoptimization::make_trap_request(Deoptimization::Reason_unhandled,
                                                        Deoptimization::Action_none));
    } else {
      // OutOfMemoryError in the CI while loading constant
      push_null();
      outer()->record_failure("ldc did not link");
    }

 
Comments
Changeset: 88fc3bfd Author: Vladimir Ivanov <vlivanov@openjdk.org> Date: 2022-02-14 18:46:46 +0000 URL: https://git.openjdk.java.net/jdk/commit/88fc3bfdff7f89a02fcfb16909df144e6173c658
14-02-2022

A pull request was submitted for review. URL: https://git.openjdk.java.net/jdk/pull/7423 Date: 2022-02-10 11:37:18 +0000
10-02-2022

ILW = Performance limitation due to missing support of unresolved dynamic constants in CI, medium?, no workaround = MMH = P3
26-01-2022

Also, JDK-8270928 which I was unaware of.
25-01-2022

https://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/2022-January/053132.html
25-01-2022

It looks like it is a source of serious performance issues for those who depend on ConstantDynamic. Turning it into a bug.
25-01-2022