关于C++ new的汇编
本来不太懂汇编,最近看看new实现的过程,看了下汇编有些不懂的地方。
MyClass cla;
008C3EC9 lea ecx,[cla]
008C3ECC call MyClass::MyClass (08C1050h)
008C3ED1 mov dword ptr [ebp-4],0
cla.num5 = 500;
008C3ED8 mov dword ptr [ebp-6Ch],1F4h
int b4 = cla.num4;
008C3EFB mov eax,dword ptr [cla]
008C3EFE mov dword ptr [b4],eax
int b5 = cla.num5;
008C3F04 mov eax,dword ptr [ebp-6Ch]
008C3F07 mov dword ptr [b5],eax
MyClass* cla2 = new MyClass();
008C3F0D push 8
008C3F0F call operator new (08C119Fh)
008C3F14 add esp,4
008C3F17 mov dword ptr [ebp-1FCh],eax
008C3F1D mov byte ptr [ebp-4],1
008C3F21 cmp dword ptr [ebp-1FCh],0
008C3F28 je wmain+0FDh (08C3F3Dh)
008C3F2A mov ecx,dword ptr [ebp-1FCh]
008C3F30 call MyClass::MyClass (08C1050h)
008C3F35 mov dword ptr [ebp-210h],eax
008C3F3B jmp wmain+107h (08C3F47h)
008C3F3D mov dword ptr [ebp-210h],0
008C3F47 mov eax,dword ptr [ebp-210h]
008C3F4D mov dword ptr [ebp-208h],eax
008C3F53 mov byte ptr [ebp-4],0
008C3F57 mov ecx,dword ptr [ebp-208h]
008C3F5D mov dword ptr [cla2],ecx