java version "1.7.0"
Java(TM) SE Runtime Environment (build 1.7.0-b147)
Java HotSpot(TM) Client VM (build 21.0-b17, mixed mode, sharing)
The main method will be compiled into native code when count is greater or equal to 170,000 (more or less, i didn't try to get a more accurate result)
>> jdk1.7.0/bin/java -XX:+PrintCompilation -XX:+UnlockDiagnosticVMOptions -XX:+PrintAssembly t5
public class t5 {
public static void main(String[] args) {
int count = 170000;
int sum = 3;
int A = 4;
int B = 5;
for(int i=0; i
}
}
}
Native code printed:
Code:
[Disassembling for mach='i386']
[Entry Point]
[Verified Entry Point]
[Constants]
# {method} 'main' '([Ljava/lang/String;)V' in 't5'
0x02ccd480: mov %eax,0xffffd000(%esp)
0x02ccd487: push %ebp
0x02ccd488: sub $0x28,%esp ;*ldc ; - t5::main@0 (line 6)
0x02ccd48b: mov $0x0,%esi
0x02ccd490: mov $0x5,%edi
0x02ccd495: mov $0x4,%ebx
0x02ccd49a: mov $0x3,%eax
0x02ccd49f: mov $0x29810,%edx
0x02ccd4a4: jmp 0x02ccd4bb ;*iload
; - t5::main@13 (line 10)
0x02ccd4a9: xchg %ax,%ax
0x02ccd4ac: mov %ebx,%ecx
0x02ccd4ae: add %edi,%ecx
0x02ccd4b0: add %eax,%ecx
0x02ccd4b2: inc %esi ; OopMap{off=51}
;*goto
; - t5::main@29 (line 10)
0x02ccd4b3: test %eax,0x1c0100 ; {poll}
0x02ccd4b9: mov %ecx,%eax ;*goto
; - t5::main@29 (line 10)
0x02ccd4bb: cmp %edx,%esi
0x02ccd4bd: jl 0x02ccd4ac ;*if_icmpge
; - t5::main@16 (line 10)
0x02ccd4bf: add $0x28,%esp
0x02ccd4c2: pop %ebp
0x02ccd4c3: test %eax,0x1c0100 ; {poll_return}
0x02ccd4c9: ret ;*return
; - t5::main@32 (line 16)
0x02ccd4ca: mov %eax,0xffffd000(%esp)
0x02ccd4d1: push %ebp
0x02ccd4d2: sub $0x28,%esp
0x02ccd4d5: mov 0x10(%ecx),%esi
0x02ccd4d8: mov 0xc(%ecx),%edi
0x02ccd4db: mov 0x8(%ecx),%ebx
0x02ccd4de: mov 0x4(%ecx),%eax
0x02ccd4e1: mov (%ecx),%edx
0x02ccd4e3: mov %ecx,(%esp)
0x02ccd4e6: mov %esi,0x20(%esp)
0x02ccd4ea: mov %edi,0x1c(%esp)
0x02ccd4ee: mov %ebx,0x18(%esp)
0x02ccd4f2: mov %eax,0x14(%esp)
0x02ccd4f6: mov %edx,0x10(%esp)
0x02ccd4fa: call 0x636aad50 ; {runtime_call}
0x02ccd4ff: mov 0x10(%esp),%edx
0x02ccd503: mov %edx,%esi
0x02ccd505: mov 0x14(%esp),%eax
0x02ccd509: mov %eax,%edi
0x02ccd50b: mov 0x18(%esp),%ebx
0x02ccd50f: mov 0x1c(%esp),%eax
0x02ccd513: mov 0x20(%esp),%edx
0x02ccd517: jmp 0x02ccd4bb
0x02ccd519: nop
0x02ccd51a: nop
0x02ccd51b: mov %fs:0x0,%esi
0x02ccd523: mov 0xfffffff4(%esi),%esi
0x02ccd526: mov 0x184(%esi),%eax
0x02ccd52c: movl $0x0,0x184(%esi)
0x02ccd536: movl $0x0,0x188(%esi)
0x02ccd540: add $0x28,%esp
0x02ccd543: pop %ebp
0x02ccd544: jmp 0x02c9ba40 ; {runtime_call}
0x02ccd549: hlt
0x02ccd54a: hlt
0x02ccd54b: hlt
0x02ccd54c: hlt
0x02ccd54d: hlt
0x02ccd54e: hlt
0x02ccd54f: hlt
[Exception Handler]
[Stub Code]
0x02ccd550: call 0x02ccbb80 ; {no_reloc}
0x02ccd555: push $0x638dcd40 ; {external_word}
0x02ccd55a: call 0x02ccd55f
0x02ccd55f: pusha
0x02ccd560: call 0x637cf5f0 ; {runtime_call}
0x02ccd565: hlt
[Deopt Handler Code]
0x02ccd566: push $0x2ccd566 ; {section_word}
0x02ccd56b: jmp 0x02c8c930 ; {runtime_call}
No comments:
Post a Comment