Github user kiszk commented on the issue:
https://github.com/apache/spark/pull/19518
First of all, I have to share sad news with you. `janino` does not use
`sipush` for values from 128 to 32767. Current `janino` 3.0.7 uses `iconst...`,
`bipush`, or `ldc`. `javac` uses `sipush` for values from 128 to 32767. In
other words, if index is greater than 127, one constant pool is used by
bytecode compiled by `janino`. It should be fixed.
```
public class Array {
int[] a = new int[1000000];
void access() {
a[5] = 0;
a[6] = 0;
a[127] = 0;
a[128] = 0;
a[1023] = 0;
a[16383] = 0;
a[32767] = 0;
a[32768] = 0;
}
static public void main(String[] argv) {
Array a = new Array();
a.access();
}
}
```
```
void access();
descriptor: ()V
flags:
Code:
stack=3, locals=1, args_size=1
0: aload_0
1: getfield #12 // Field a:[I
4: iconst_5
5: iconst_0
6: iastore
7: aload_0
8: getfield #12 // Field a:[I
11: bipush 6
13: iconst_0
14: iastore
15: aload_0
16: getfield #12 // Field a:[I
19: bipush 127
21: iconst_0
22: iastore
23: aload_0
24: getfield #12 // Field a:[I
27: ldc #13 // int 128
29: iconst_0
30: iastore
31: aload_0
32: getfield #12 // Field a:[I
35: ldc #14 // int 1023
37: iconst_0
38: iastore
39: aload_0
40: getfield #12 // Field a:[I
43: ldc #15 // int 16383
45: iconst_0
46: iastore
47: aload_0
48: getfield #12 // Field a:[I
51: ldc #16 // int 32767
53: iconst_0
54: iastore
55: aload_0
56: getfield #12 // Field a:[I
59: ldc #17 // int 32768
61: iconst_0
62: iastore
63: return
Constant pool:
#1 = Utf8 Array
#2 = Class #1 // Array
#9 = Utf8 a
#10 = Utf8 [I
#11 = NameAndType #9:#10 // a:[I
#12 = Fieldref #2.#11 // Array.a:[I
#13 = Integer 128
#14 = Integer 1023
#15 = Integer 16383
#16 = Integer 32767
#17 = Integer 32768
```
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]