public class Test { static final int arrsz = 64; private static int[] tbuf = new int[arrsz]; private static int[] tbuf2 = new int[arrsz]; private static void test(int iter) { for (int i = 0; i < iter; i++) { System.arraycopy(tbuf, 0, tbuf2, 0, 32); } } public static void main(String[] args) { for (int i = 0; i < arrsz; i++) { tbuf[i] = i; } for (int i = 0; i < 5; i++) { test(10000); } } } gamma -Xbatch -XX:+PrintCompilation -XX:+PrintOptoAssembly -XX:-CICompileOSR Test 1cc B29: # B40 B30 <- B5 B6 Freq: 0.026448 1cc + MOV R_O0,R_L0 ! spill 1d0 + MOV #0,R_O1 1d4 MOV R_O2,R_L2 ! spill 1d8 + MOV #0,R_O3 1dc MOV #32,R_O4 1e0 CALL,static ; NOP ==> wrapper for: slow_arraycopy # Test::test @ bci:17 L[0]=R_I0 L[1]=R_L3 STK[0]=R_L0 STK[1]=#0 STK[2]=R_L2 STK[3]=#0 STK[4]=#32 # L0=Oop L2=Oop L4=Oop 1e8 1e8 B30: # B8 <- B29 Freq: 0 # Block is sole successor of call 1e8 + BA B8 1e8 ======================================================= An other case. test/closed/compiler/6563987/Test.java .hotspot_compiler print Test testc gamma -Xbatch -XX:LoopUnrollLimit=0 -XX:CICompilerCount=1 -XX:+PrintCompilation -XX:+PrintOptoAssembly -XX:-CICompileOSR Test 3c0 B47: # B50 B48 <- B10 B17 Loop: B47-B17 inner stride: not constant Freq: 0.181598 3c0 movl [rsp + #28], RBX # spill 3c4 movq RSI, [rsp + #8] # spill 3c9 xorl RDX, RDX # int 3cb movq RCX, RSI # spill 3ce movl R8, [rsp + #0] # spill 3d2 movl R9, [rsp + #4] # spill 3d7 call,static wrapper for: slow_arraycopy # Test::testc @ bci:19 L[0]=rsp + #8 L[1]=rsp + #0 L[2]=rsp + #4 L[3]=rsp + #28 L[4]=rsp + #16 L[5]=rsp + #24 L[6]=rsp + #160 L[7]=rsp + #32 L[8]=_ L[9]=RBP L[10]=_ STK[0]=rsp + #8 STK[1]=#0 STK[2]=rsp + #8 STK[3]=rsp + #0 STK[4]=rsp + #4 # AllocatedObj(0xfffffd7f73f70088) AllocatedObj(0xfffffd7f73f70088) 3dc 3dc B48: # B17 B49 <- B47 Freq: 0.181595 # Block is sole successor of call 3dc 3dc incl RBP # int 3de cmpl RBP, [RSP + #28 (32-bit)] 3e2 jlt B17 # loop end P=0.999999 C=996701.000000 3e2 3e8 B49: # B14 <- B48 Freq: 0 3e8 jmp B14 3e8 3ed B50: # B64 <- B47 Freq: 1.81598e-06 3ed # exception oop is in rax; no code emitted 3ed jmp B64 3ed
|