Details
-
Type:
Bug
-
Status: Resolved
-
Priority:
P4
-
Resolution: Fixed
-
Affects Version/s: repo-valhalla
-
Fix Version/s: repo-valhalla
-
Component/s: tools
-
Labels:
-
Subcomponent:
-
CPU:generic
-
OS:generic
Description
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.
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.