x64汇编函数(调用/返回vs推/弹出/跳转) [英] x64 assembly functions (call/return vs push/pop/jump)

查看:75
本文介绍了x64汇编函数(调用/返回vs推/弹出/跳转)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用内置的调用和返回指令与手动推入和弹出堆栈以及对函数使用跳转之间有什么区别?

Whats the difference between using the built-in call and return instructions vs manually pushing and popping the stack and using jumps for functions?

推荐答案

从功能上讲,如果正确执行操作,则不会执行任何操作.但是,使用 push / pop 模拟 call / ret 会花费更多指令和/或寄存器.当然,如果您真的想将其发挥到极致,还可以使用 lea mov :)

Functionally, if you do it correctly, nothing. However it takes more instructions and/or registers to emulate call/ret using push/pop. Of course if you really wanted to take it to the extreme, you could also emulate push/pop using lea and mov :)

此外,当前的处理器具有专门的硬件来处理用于分支预测目的的函数调用,这可能不适用于您的备用序列,因此会导致性能下降.

Also, current processors have specialized hardware to handle function calls for the purposes of branch prediction, which probably won't work for your alternate sequence so you will get performance penalty.

这篇关于x64汇编函数(调用/返回vs推/弹出/跳转)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆