比较弱智,呵呵。
源程序如下:
class Program {
static int i;
static int j;
static boolean b;
static void Main() {
i = 3 * 5;
j = i + 10;
func();
print(j);
}
static void func() {
print(i);
}
}
翻译成汇编码:
.section .rodata format: .string "%dn" .text .globl main .type main, @function main: pushl %ebp movl %esp, %ebp subl $8, %esp movl $3, %eax movl %eax, %ebx movl $5, %eax imull %ebx, %eax movl %eax, i movl i, %eax movl %eax, %ebx movl $10, %eax addl %ebx, %eax movl %eax, j call func movl j, %eax movl %eax, 4(%esp) movl $format, (%esp) call printf leave ret .globl func .type func, @function func: pushl %ebp movl %esp, %ebp subl $8, %esp movl i, %eax movl %eax, 4(%esp) movl $format, (%esp) call printf leave ret .local i .comm i, 4, 4 .local j .comm j, 4, 4 .local b .comm b, 4, 4
This entry was posted
on Saturday, March 18th, 2006 at 12:45 am and is filed under Programming.
You can follow any responses to this entry through the RSS 2.0 feed.
You can leave a response, or trackback from your own site.