-
Enhancement
-
Resolution: Won't Fix
-
P4
-
None
-
1.4.2
-
x86
-
windows_2000
Name: rmT116609 Date: 04/11/2003
FULL PRODUCT VERSION :
java version "1.4.1_02"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_02-b06)
Java HotSpot(TM) Client VM (build 1.4.1_02-b06, mixed mode)
java version "1.4.2-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-beta-b19)
Java HotSpot(TM) Client VM (build 1.4.2-beta-b19, mixed mode)
FULL OS VERSION :
Microsoft Windows 2000 [Version 5.00.2195]
EXTRA RELEVANT SYSTEM CONFIGURATION :
Generic
A DESCRIPTION OF THE PROBLEM :
This is a resurrection of bugs 4017848 and 4080908.
Quoting from bug 4017848:
"It is not necessary to generate code to initialize array
entries to the default value (zero). Not generating this code
substantially trims class files when there are large, sparse
constant arrays."
Apparently this bug was fixed in 1.2 and 1.1.5, but it happens again in 1.4.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile this code:
public class test {
private static final int[] ARRAY = { 0 };
}
and run "javap -c test" to disassemble the code.
EXPECTED VERSUS ACTUAL BEHAVIOR :
Method static {}
0 iconst_1
1 newarray int
3 putstatic #2 <Field int ARRAY[]>
6 return
NOTE: No code should be generated to initialize the array element.
NOTE: Four extraneous instructions (*) are generated to init the array element.
Method static {}
0 iconst_1
1 newarray int
* 3 dup
* 4 iconst_0
* 5 iconst_0
* 6 iastore
7 putstatic #2 <Field int ARRAY[]>
10 return
On Windows 2000 using J2SE 1.4.2-beta:
C:\>javap -c test
Compiled from "test.java"
public class test extends java.lang.Object{
public test();
Code:
0: aload_0
1: invokespecial #1; //Method java/lang/Object."<init>":()V
4: return
static {};
Code:
0: iconst_1
1: newarray int
3: dup
4: iconst_0
5: iconst_0
6: iastore
7: putstatic #2; //Field ARRAY:[I
10: return
}
REPRODUCIBILITY :
This bug can be reproduced always.
(Review ID: 183822)
======================================================================
FULL PRODUCT VERSION :
java version "1.4.1_02"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_02-b06)
Java HotSpot(TM) Client VM (build 1.4.1_02-b06, mixed mode)
java version "1.4.2-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-beta-b19)
Java HotSpot(TM) Client VM (build 1.4.2-beta-b19, mixed mode)
FULL OS VERSION :
Microsoft Windows 2000 [Version 5.00.2195]
EXTRA RELEVANT SYSTEM CONFIGURATION :
Generic
A DESCRIPTION OF THE PROBLEM :
This is a resurrection of bugs 4017848 and 4080908.
Quoting from bug 4017848:
"It is not necessary to generate code to initialize array
entries to the default value (zero). Not generating this code
substantially trims class files when there are large, sparse
constant arrays."
Apparently this bug was fixed in 1.2 and 1.1.5, but it happens again in 1.4.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile this code:
public class test {
private static final int[] ARRAY = { 0 };
}
and run "javap -c test" to disassemble the code.
EXPECTED VERSUS ACTUAL BEHAVIOR :
Method static {}
0 iconst_1
1 newarray int
3 putstatic #2 <Field int ARRAY[]>
6 return
NOTE: No code should be generated to initialize the array element.
NOTE: Four extraneous instructions (*) are generated to init the array element.
Method static {}
0 iconst_1
1 newarray int
* 3 dup
* 4 iconst_0
* 5 iconst_0
* 6 iastore
7 putstatic #2 <Field int ARRAY[]>
10 return
On Windows 2000 using J2SE 1.4.2-beta:
C:\>javap -c test
Compiled from "test.java"
public class test extends java.lang.Object{
public test();
Code:
0: aload_0
1: invokespecial #1; //Method java/lang/Object."<init>":()V
4: return
static {};
Code:
0: iconst_1
1: newarray int
3: dup
4: iconst_0
5: iconst_0
6: iastore
7: putstatic #2; //Field ARRAY:[I
10: return
}
REPRODUCIBILITY :
This bug can be reproduced always.
(Review ID: 183822)
======================================================================
- relates to
-
JDK-8061402 Constant pool entries for arrays
-
- Closed
-