615
|
1 ; class C {
|
|
2 ; public:
|
|
3 ; float m(int i) const { return float(i + 123); }
|
|
4 ; };
|
|
5 ;
|
|
6 ; extern "C" {
|
|
7 ; float f()
|
|
8 ; {
|
|
9 ; C c;
|
|
10 ; return c.m(27);
|
|
11 ; }
|
|
12 ; }
|
|
13
|
|
14
|
|
15
|
|
16 ; output from godbolt compiler explorer w/ msvc 19.0
|
|
17
|
|
18 _this$ = -12
|
|
19 tv68 = -8
|
|
20 tv67 = -4
|
|
21 _i$ = 8
|
|
22 float C::m(int)const PROC
|
|
23 push ebp ;
|
|
24 mov ebp, esp ;
|
|
25 sub esp, 12 ;
|
|
26 mov DWORD PTR _this$[ebp], ecx ;
|
|
27 mov eax, DWORD PTR _i$[ebp] ;
|
|
28 add eax, 123 ; |
|
|
29 mov DWORD PTR tv67[ebp], eax ; / in arg + 123, pushed onto stack
|
|
30 fild DWORD PTR tv67[ebp] ; \
|
|
31 fstp DWORD PTR tv68[ebp] ; | float cast and put return value in fp0
|
|
32 fld DWORD PTR tv68[ebp] ; |
|
|
33 mov esp, ebp ;
|
|
34 pop ebp ;
|
|
35 ret 4 ;
|
|
36 float C::m(int)const ENDP
|
|
37
|
|
38 _c$ = -1
|
|
39 _f PROC
|
|
40 push ebp ;
|
|
41 mov ebp, esp ;
|
|
42 push ecx ;
|
|
43 push 27 ; arg 1
|
|
44 lea ecx, DWORD PTR _c$[ebp] ; arg 0 (this ptr) via ecx
|
|
45 call float C::m(int)const ; call C::m()
|
|
46 mov esp, ebp ;
|
|
47 pop ebp ;
|
|
48 ret 0 ;
|
|
49 _f ENDP
|
|
50
|
|
51
|
|
52
|
|
53 ; output from reactos-0.3.15-x86 w/ mingw gcc 4.7.2 (uses MS thiscalls; according to
|
|
54 ; https://www.angelcode.com/dev/callconv/callconv.html MinGW has own thiscalls,
|
|
55 ; so maybe ROSBE's MinGW has different behaviour or the web page sources are wong)
|
|
56
|
|
57 00000000 <_f>:
|
|
58 0: 55 push %ebp ;
|
|
59 1: 89 e5 mov %esp,%ebp ;
|
|
60 3: 83 ec 14 sub $0x14,%esp ;
|
|
61 6: 8d 45 ff lea -0x1(%ebp),%eax ; this ptr -> eax
|
|
62 9: c7 04 24 1b 00 00 00 movl $0x1b,(%esp) ; arg 1 via stack
|
|
63 10: 89 c1 mov %eax,%ecx ; arg 0 (this ptr) via ecx
|
|
64 12: e8 00 00 00 00 call 17 <_f+0x17> ; call C::m()
|
|
65 17: 83 ec 04 sub $0x4,%esp ;
|
|
66 1a: c9 leave ;
|
|
67 1b: c3 ret ;
|
|
68
|
|
69 00000000 <__ZNK1C1mEi>:
|
|
70 0: 55 push %ebp ;
|
|
71 1: 89 e5 mov %esp,%ebp ;
|
|
72 3: 83 ec 08 sub $0x8,%esp ;
|
|
73 6: 89 4d fc mov %ecx,-0x4(%ebp) ;
|
|
74 9: 8b 45 08 mov 0x8(%ebp),%eax ;
|
|
75 c: 83 c0 7b add $0x7b,%eax ; | in arg + 123, pushed onto stack
|
|
76 f: 89 45 f8 mov %eax,-0x8(%ebp) ; |
|
|
77 12: db 45 f8 fildl -0x8(%ebp) ; float cast and put return value in fp0
|
|
78 15: c9 leave ;
|
|
79 16: c2 04 00 ret $0x4 ;
|
|
80
|
|
81
|
|
82
|
|
83 ; vim: ft=asm
|
|
84
|