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

[lworld] Duplicate/redundant CONSTANT_Class_info entry in constant pool

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • repo-valhalla
    • repo-valhalla
    • tools
    • generic
    • generic

      Given this program:

      public primitive class X {
          Object o = new X.ref[0];
      }

      javac generates redundant Constant_Class_info entries as shown
      by this extract of the constant pool:

      Constant pool:
         #1 = Class #2 // X
         #2 = Utf8 X
         #3 = Class #2 // X
         #4 = Fieldref #1.#5 // X.o:Ljava/lang/Object;
         #5 = NameAndType #6:#7 // o:Ljava/lang/Object;
         #6 = Utf8 o

      ...

      The entry at index is referred to by

      this_class: #1 // X

      while the entry at 3 is referenced by

      anewarray #3 // class X

      Basically, com.sun.tools.javac.jvm.PoolWriter#putClass(com.sun.tools.javac.code.Type) fails to recognize that there is no need to emit different
      Constant_info entries for X.ref and X.val types - these entries are indistinguishable at the level of a Constant_info structure and so can be shared.

            sadayapalam Srikanth Adayapalam (Inactive)
            sadayapalam Srikanth Adayapalam (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: