Mercurial > pub > dyncall > dyncall
comparison doc/disas_examples/x86.cdecl.disas @ 614:b74d7a249642
disas example for explicit cdecl declared thiscall
author | Tassilo Philipp |
---|---|
date | Sat, 01 Oct 2022 16:04:40 +0200 |
parents | 585dcb68f55d |
children |
comparison
equal
deleted
inserted
replaced
613:3c3e321875f7 | 614:b74d7a249642 |
---|---|
788 1c000988: c9 leave ; | 788 1c000988: c9 leave ; |
789 1c000989: c3 ret ; | 789 1c000989: c3 ret ; |
790 | 790 |
791 | 791 |
792 | 792 |
793 ; ---------- cdecl-declared (explicit) C++ thiscall w/ msvc ----------> | |
794 ; | |
795 ; class C { | |
796 ; public: | |
797 ; float __cdecl m(int i) const { return float(i + 123); } | |
798 ; }; | |
799 ; | |
800 ; extern "C" { | |
801 ; float f() | |
802 ; { | |
803 ; C c; | |
804 ; return c.m(27); | |
805 ; } | |
806 ; } | |
807 | |
808 | |
809 | |
810 ; output from godbolt compiler explorer w/ msvc 19.0 | |
811 | |
812 tv68 = -8 | |
813 tv67 = -4 | |
814 _i$ = 12 | |
815 float C::m(int)const PROC | |
816 push ebp ; | |
817 mov ebp, esp ; | |
818 sub esp, 8 ; | |
819 mov eax, DWORD PTR _i$[ebp] ; | |
820 add eax, 123 ; | | |
821 mov DWORD PTR tv67[ebp], eax ; / in arg + 123, pushed onto stack | |
822 fild DWORD PTR tv67[ebp] ; \ | |
823 fstp DWORD PTR tv68[ebp] ; | float cast and put return value in fp0 | |
824 fld DWORD PTR tv68[ebp] ; | | |
825 mov esp, ebp ; | |
826 pop ebp ; | |
827 ret 0 ; | |
828 float C::m(int)const ENDP | |
829 | |
830 _c$ = -1 | |
831 _f PROC ; | |
832 push ebp ; | |
833 mov ebp, esp ; | |
834 push ecx ; | |
835 push 27 ; arg 1 | |
836 lea eax, DWORD PTR _c$[ebp] ; | | |
837 push eax ; | arg 0 (this ptr) | |
838 call float C::m(int)const ; call C::m() | |
839 add esp, 8 ; | |
840 mov esp, ebp ; | |
841 pop ebp ; | |
842 ret 0 ; | |
843 _f ENDP | |
844 | |
845 | |
846 | |
793 ; vim: ft=asm | 847 ; vim: ft=asm |
794 | 848 |