为什么参数存储在x86-64 Assembly中的寄存器中而不是堆栈中?

问题描述:

在x86-32组件中,参数存储在堆栈中,而在x86-64中,参数存储在寄存器中.是什么原因呢?

In x86-32 assembly, parameters are stored on the stack but in x86-64, parameters stored in registers. What is the reason for this?

访问CPU寄存器比访问RAM快很多.

It is (a lot) faster to access CPU registers than to access RAM.

由于64位CPU具有更多的通用寄存器(与64位无关,只是因为它们是更新/更大的),因此使用它们是有意义的.

Since 64bit CPU have a lot more general purpose registers (has nothing to do with being 64bit, it's just because they are newer/bigger), it makes sense to make use of them.