编译原理课程设计之函数调用分析(compiler theory, curriculum design, function call analysis)

编译原理课程设计之函数调用分析(compiler theory, curriculum design, function call analysis)

ID:14489502

大小:43.50 KB

页数:13页

时间:2018-07-29

编译原理课程设计之函数调用分析(compiler theory, curriculum design, function call analysis)_第1页
编译原理课程设计之函数调用分析(compiler theory, curriculum design, function call analysis)_第2页
编译原理课程设计之函数调用分析(compiler theory, curriculum design, function call analysis)_第3页
编译原理课程设计之函数调用分析(compiler theory, curriculum design, function call analysis)_第4页
编译原理课程设计之函数调用分析(compiler theory, curriculum design, function call analysis)_第5页
资源描述:

《编译原理课程设计之函数调用分析(compiler theory, curriculum design, function call analysis)》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库

1、编译原理课程设计之函数调用分析(Compilertheory,curriculumdesign,functioncallanalysis)Thereare3methodsforcallingfunctionsinWindowssystems:__stdcall,__cdecl,PASCALThefirsttwopassargumentsfromrighttoleft,andthelastistopassargumentsfromlefttoright__stdcallisthestandardwayforWindowssystemstocallAPI__cdeclisthes

2、tandardinvocationofANSI-CTherearesomedifferencesbetween__stdcalland__cdecl:1.__stdcallreturnstheEBPandESPpointersfromthecalledfunction,inthiscasef_stcall()2.__cdeclreturnstheEBPandESPpointersbycallingfunctions,inthiscasef_cdecl()======================================================#include

3、"stdio.h""Void,__stdcall,f_stdcall(int,a,int,b){Intc;C=a+b;}Voidf_cdeclr(int,a,int,b){Intc;C=a+b;}(main){Int,left,=1,right,=2;F_stdcall(left,right);F_cdeclr(left,right);Printf("%d,%d",1,2);}========================================================================1:#include"stdio.h""2:=======

4、==============================================================Disassemblyofthef_stdcall()function=====================================================================3:,void,__stdcall,f_stdcall(int,a,int,b)4:{004012F0pushEBP//main.ebpparentfunctionpreservationbase004012F1movEBP,esp//opensta

5、ckf_stdcall.ebp004012F3,sub,esp,44h,//40h,int,C,4H004012F6pushebx//initializethe44hspace,11cycles004012F7pushESI004012F8pushEDI004012F9,lea,EDI,[ebp-44h]004012FC,MOV,ECX,11h00401301,MOV,eax,0CCCCCCCCh00401306,Rep,STOs,DWORD,PTR,[edi]5:intc;6:c=a+b;00401308moveax,DWORDPTR[ebp+8]a//+8//parame

6、ters,thereasonintheabovesaid0040130Baddeax,DWORDPTR[ebp+0Ch]B//parameters0040130E,MOV,DWORD,PTR,[ebp-4],andeax//aresavedinC7:}00401311popEDI00401312popESI00401313popebx00401314,MOV,esp,EBP00401316popEBP//main.ebprecovery00401317RET8//[ebp-8]-8================================================

7、=====================Disassemblyofthef_cdecl()function=====================================================================8:9:,void,f_cdeclr(int,a,int,b)10:{Thebase00401070pushEBP//savemain.ebp00401071movEBP,esp//madetorunstackf_cdecl.ebp00401073subESP,

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。