Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8238713

[lworld] C2 compiled method triggers infinite number of uncommon traps for interface array store

XMLWordPrintable

      Vector[] covariance; // Vector is an interface
      ....
      covariance = new Ref1[size]; // Ref1 is concrete class implementing Vector.

      (So we have static type array of interface, but runtime type is array of exact type).

      Method 'covariance':

      public Object covariance() {
              Vector[] values = covariance;
              for (int i = 0; i < size; i++) {
                  values[i] = new Ref1(i);
              }
              return values;
          }

      Method 'covariance' can't be compiled due to large set on uncommon trap events:

      <uncommon_trap thread='2522' reason='none' action='none' debug_id='0' compile_id='869' compiler='c2' level='4' count='202' stamp='9.514'>
      <jvms bci='24' method='oracle.micro.set.Set1 covariance ()Ljava/lang/Object;' bytes='33' count='119752' backedge_count='130953375' iicount='119752' decompiles='202' none_traps='202' profile_predicate_traps='4' predicate_traps='1'/>
      </uncommon_trap>
      <uncommon_trap thread='2522' reason='none' action='none' debug_id='0' compile_id='869' compiler='c2' level='4' count='202' stamp='9.514'>
      <jvms bci='24' method='oracle.micro.set.Set1 covariance ()Ljava/lang/Object;' bytes='33' count='119752' backedge_count='130953875' iicount='119752' decompiles='202' none_traps='202' profile_predicate_traps='4' predicate_traps='1'/>
      </uncommon_trap>
      <uncommon_trap thread='2522' reason='none' action='none' debug_id='0' compile_id='868' compile_kind='osr' compiler='c2' level='4' count='202' stamp='9.514'>
      <jvms bci='24' method='oracle.micro.set.Set1 covariance ()Ljava/lang/Object;' bytes='33' count='119752' backedge_count='130953924' iicount='119752' decompiles='202' none_traps='202' profile_predicate_traps='4' predicate_traps='1'/>
      </uncommon_trap>
      <uncommon_trap thread='2522' reason='none' action='none' debug_id='0' compile_id='869' compiler='c2' level='4' count='202' stamp='9.514'>
      <jvms bci='24' method='oracle.micro.set.Set1 covariance ()Ljava/lang/Object;' bytes='33' count='119752' backedge_count='130954375' iicount='119752' decompiles='202' none_traps='202' profile_predicate_traps='4' predicate_traps='1'/>
      </uncommon_trap>
      <uncommon_trap thread='2522' reason='none' action='none' debug_id='0' compile_id='869' compiler='c2' level='4' count='202' stamp='9.514'>
      <jvms bci='24' method='oracle.micro.set.Set1 covariance ()Ljava/lang/Object;' bytes='33' count='119752' backedge_count='130954875' iicount='119752' decompiles='202' none_traps='202' profile_predicate_traps='4' predicate_traps='1'/>
      </uncommon_trap>
      <uncommon_trap thread='2522' reason='none' action='none' debug_id='0' compile_id='868' compile_kind='osr' compiler='c2' level='4' count='202' stamp='9.514'>
      <jvms bci='24' method='oracle.micro.set.Set1 covariance ()Ljava/lang/Object;' bytes='33' count='119752' backedge_count='130954948' iicount='119752' decompiles='202' none_traps='202' profile_predicate_traps='4' predicate_traps='1'/>
      </uncommon_trap>
      <uncommon_trap thread='2522' reason='none' action='none' debug_id='0' compile_id='869' compiler='c2' level='4' count='202' stamp='9.514'>
      <jvms bci='24' method='oracle.micro.set.Set1 covariance ()Ljava/lang/Object;' bytes='33' count='119752' backedge_count='130955375' iicount='119752' decompiles='202' none_traps='202' profile_predicate_traps='4' predicate_traps='1'/>
      </uncommon_trap>
      ======

      Note: The issue doesn't depend on options +-EnableValhalla, but doesn't exist in the main jdk repo (only in valhalla-repo).
      =====
      Reproduce:
      Benchmark: 'org.openjdk.bench.valhalla.baseline.arrays.Set1.covariance' from Valhalla microbenchmarks.
      (and many many others with the similar behavior).

            thartmann Tobias Hartmann
            skuksenko Sergey Kuksenko
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: