public void test(){
TestB bp = new TestB();
a = bp.fun1();
a = bp.fun5();
}
public class TestB{
public int fun1(){
return 1;
}
public int fun5()
{
return TestC.fun4(10, 12);
}
}
TestB bp = new TestB();
0x00213800: f940ea5e ldr x30, [x18, #464] //new-instance and construct method
0x00213804: b90063e0 str w0, [sp, #96] //save w0
0x00213808: aa1403e1 mov x1, x20
0x0021380c: 52807f80 movz w0, #0x3fc
0x00213810: d63f03c0 blr x30
a = bp.fun1();
0x00213934:
aa0003f7 mov x21, x0
//the object address save in x21 return from x0
0x00213938:
aa1703e1 mov x1, x21
//pass the object as arg2 (this)
0x0021393c:
b940002a ldr w13, [x1]
0x00213940:
aa1403e0 mov x0, x20
0x00213944:
b9400c00 ldr
w0, [x0, #12]
0x00213948:
d2907f11 movz x12, #0x83e0 //different
method has different offset value
0x0021394c:
b8716800 ldr
w0, [x0, x12]
0x00213950:
f940141e ldr
x30, [x0, #40]
0x00213954:
d63f03c0 blr x30
public int fun5()
{
return TestC.fun4(10, 12);
}
0x00285d30:
d100c3ff sub sp, sp, #0x30 (48) //allocate the stack space
0x00285d34:
a901d7f4 stp x20, x21, [sp, #24] //save x20,x21 to stack
0x00285d38:
f90017fe str x30, [sp, #40] //save x30 to stack
0x00285d3c:
aa0003f5 mov x21, x0 //save arg x0 to x21, what's the x0?
0x00285d40:
b90003e0 str w0, [sp]
0x00285d44:
b90037e1 str w1, [sp, #52]
0x00285d48:
52800154 movz w20, #0xa //w20 = 10
0x00285d4c:
52800182 movz w2, #0xc //w2 = 12
0x00285d50:
b90013e2 str w2, [sp, #16]
TestB bp = new TestB();
0x00213800: f940ea5e ldr x30, [x18, #464]
0x00213804: b90063e0 str w0, [sp, #96]
0x00213808: aa1403e1 mov x1, x20
0x0021380c: 52807f80 movz w0, #0x3fc
0x00213810: d63f03c0 blr x30