Open RuifengFu opened 3 months ago
It looks like there are a pair of System.arraycopy
calls in Test6892265.test()
, and the code after the first call is removed by Value Propagation, as it thinks that an ArrayCopyBNDCHK
operation will fail.
IL before Value Propagation:
n260n istore <auto slot 0>[#361 Auto] [flags 0x3 0x0 ] [ 0x119398100] bci=[-1,413,-] rc=0 vc=35 vn=- li=- udi=- nc=1
n259n iconst 0x20000000 (X!=0 X>=0 ) [ 0x1193980b0] bci=[-1,411,-] rc=4 vc=35 vn=- li=- udi=- nc=0 flg=0x104
n267n treetop [ 0x119398330] bci=[-1,423,-] rc=0 vc=35 vn=- li=- udi=- nc=1
n266n call java/lang/System.arraycopy(Ljava/lang/Object;ILjava/lang/Object;II)V[#372 final native static Method] [flags 0x20500 0x0 ] () [ 0x1193982e0] bci=[-1,423,-] rc=1 vc=35 vn=- li=- udi=- nc=5 flg=0x20
n261n aload Test6892265.src2 [I[#365 Static] [flags 0x307 0x0 ] [ 0x119398150] bci=[-1,414,-] rc=1 vc=35 vn=- li=- udi=- nc=0
n262n iconst 0 (X==0 X>=0 X<=0 ) [ 0x1193981a0] bci=[-1,417,-] rc=2 vc=35 vn=- li=- udi=- nc=0 flg=0x302
n263n aload Test6892265.dst2 [I[#366 Static] [flags 0x307 0x0 ] [ 0x1193981f0] bci=[-1,418,-] rc=1 vc=35 vn=- li=- udi=- nc=0
n259n ==>iconst 0x20000000
n265n iconst 1 (X!=0 X>=0 ) [ 0x119398290] bci=[-1,422,-] rc=2 vc=35 vn=- li=- udi=- nc=0 flg=0x104
n274n treetop [ 0x119398560] bci=[-1,435,-] rc=0 vc=35 vn=- li=- udi=- nc=1
n273n call java/lang/System.arraycopy(Ljava/lang/Object;ILjava/lang/Object;II)V[#372 final native static Method] [flags 0x20500 0x0 ] () [ 0x119398510] bci=[-1,435,-] rc=1 vc=35 vn=- li=- udi=- nc=5 flg=0x20
n268n aload Test6892265.dst2 [I[#366 Static] [flags 0x307 0x0 ] [ 0x119398380] bci=[-1,426,-] rc=1 vc=35 vn=- li=- udi=- nc=0
n259n ==>iconst 0x20000000
n270n aload Test6892265.src2 [I[#365 Static] [flags 0x307 0x0 ] [ 0x119398420] bci=[-1,430,-] rc=1 vc=35 vn=- li=- udi=- nc=0
n262n ==>iconst 0
n265n ==>iconst 1
n278n treetop [ 0x1193986a0] bci=[-1,442,-] rc=0 vc=35 vn=- li=- udi=- nc=1
n277n icall JITFuzzing/Check.checksum(II)I[#364 static Method] [flags 0x500 0x0 ] [ 0x119398650] bci=[-1,442,-] rc=2 vc=35 vn=- li=- udi=- nc=2
n275n iload Test6892265.CHECKSUM I[#356 Static] [flags 0x303 0x0 ] [ 0x1193985b0] bci=[-1,438,-] rc=1 vc=35 vn=- li=- udi=- nc=0
n259n ==>iconst 0x20000000
n279n istore Test6892265.CHECKSUM I[#356 Static] [flags 0x303 0x0 ] [ 0x1193986f0] bci=[-1,445,-] rc=0 vc=35 vn=- li=- udi=- nc=1
n277n ==>icall
n280n return [ 0x119398740] bci=[-1,448,-] rc=0 vc=35 vn=- li=- udi=- nc=0
n4n BBEnd </block_4> ===== [ 0x1193083a0] bci=[-1,448,-] rc=0 vc=35 vn=- li=- udi=- nc=0
then after Local Value Propagation:
[ 143] 25.5 O^O VALUE PROPAGATION: Changing call call [00000001193982E0] to arraycopy
[ 144] 25.6 O^O VALUE PROPAGATION: Removing rest of block after ArrayCopyBNDCHK [000000011939A4F0]
...
n1n BBStart <block_4> (freq 10000) [ 0x1193082b0] bci=[-1,411,-] rc=0 vc=37 vn=- li=- udi=- nc=0
n260n istore <auto slot 0>[#361 Auto] [flags 0x3 0x0 ] [ 0x119398100] bci=[-1,413,-] rc=0 vc=37 vn=- li=- udi=- nc=1
n259n iconst 0x20000000 (X!=0 X>=0 ) [ 0x1193980b0] bci=[-1,411,-] rc=2 vc=37 vn=- li=- udi=- nc=0 flg=0x104
n369n NULLCHK on n261n [#32] [ 0x11939a310] bci=[-1,414,-] rc=0 vc=37 vn=- li=- udi=- nc=1
n368n arraylength (stride 4) (X>=0 cannotOverflow ) [ 0x11939a2c0] bci=[-1,414,-] rc=2 vc=37 vn=- li=- udi=- nc=1 flg=0x1100
n261n aload Test6892265.src2 [I[#365 Static] [flags 0x307 0x0 ] [ 0x119398150] bci=[-1,414,-] rc=1 vc=37 vn=- li=- udi=- nc=0
n371n NULLCHK on n263n [#32] [ 0x11939a3b0] bci=[-1,418,-] rc=0 vc=37 vn=- li=- udi=- nc=1
n370n arraylength (stride 4) (X>=0 cannotOverflow ) [ 0x11939a360] bci=[-1,418,-] rc=2 vc=37 vn=- li=- udi=- nc=1 flg=0x1100
n263n aload Test6892265.dst2 [I[#366 Static] [flags 0x307 0x0 ] [ 0x1193981f0] bci=[-1,418,-] rc=1 vc=37 vn=- li=- udi=- nc=0
n373n ArrayCopyBNDCHK [#1] [ 0x11939a450] bci=[-1,414,-] rc=0 vc=37 vn=- li=- udi=- nc=2
n372n isub (cannotOverflow ) [ 0x11939a400] bci=[-1,414,-] rc=1 vc=37 vn=- li=- udi=- nc=2 flg=0x1000
n368n ==>arraylength
n265n iconst 1 (X!=0 X>=0 ) [ 0x119398290] bci=[-1,422,-] rc=2 vc=37 vn=- li=- udi=- nc=0 flg=0x104
n262n iconst 0 (X==0 X>=0 X<=0 ) [ 0x1193981a0] bci=[-1,417,-] rc=1 vc=37 vn=- li=- udi=- nc=0 flg=0x302
n375n ArrayCopyBNDCHK [#1] [ 0x11939a4f0] bci=[-1,418,-] rc=0 vc=37 vn=- li=- udi=- nc=2
n374n isub (cannotOverflow ) [ 0x11939a4a0] bci=[-1,418,-] rc=1 vc=37 vn=- li=- udi=- nc=2 flg=0x1000
n370n ==>arraylength
n265n ==>iconst 1
n259n ==>iconst 0x20000000
n376n return [ 0x11939a540] bci=[-1,418,-] rc=0 vc=37 vn=- li=- udi=- nc=0
n4n BBEnd </block_4> ===== [ 0x1193083a0] bci=[-1,448,-] rc=0 vc=36 vn=- li=- udi=- nc=0
I strongly suspect that this is a duplicate of issue #19247.
@dylanjtuttle, as I mentioned above, I suspect this is a duplicate of issue #19247. May I ask you to look at these two issues together?
Java -version output
Summary of problem
I got wrong execute outputs in 8.0, 11.0, 21.0 with -Xcomp option, but got the right result in 17.0.
Dagnostic files
Expect Result:
Actual Result:
Reproduce step:
Test6892265.zip