我正在將我的程序移植到ml64,一半用於運動,一半用於查看我可以獲得多少性能。瞭解快速調用堆棧幀
不管怎麼說,我目前正試圖瞭解堆棧幀的設置,在這個例子中,據我所知:
push rbp ; inherited, base pointer of caller, pushed on stack for storage
mov rbp, rsp ; inherited, base pointer of the callee, moved to rbp for use as base pointer
sub rsp, 32 ; intel guide says each frame must reserve 32 bytes for the storage of the
; 4 arguments usually passed through registers
and spl, -16 ; 16 byte alignment?
mov rsp, rbp ; put your base pointer back in the callee register
pop rbp ; restore callers base pointer
的2周的事情,我沒有得到的
從RSP中減去32怎麼做呢?據我所知,除了從一個堆棧幀到另一個堆棧幀的職責之外,它只是另一個寄存器,對吧?我懷疑它進入另一個堆棧框架而不是用於當前的框架。
什麼是SPL,爲什麼掩蓋它使16個字節對齊?
1)它分配空間(因爲棧頂指向由定義RSP)2)SPL是可吸入懸浮粒子的低8位,所以你可以儘管通常使用RSP – Jester
您可能還需要考慮使用用於對齊[爲什麼這個C++代碼比我手寫的程序集更快?](https://stackoverflow.com/questions/40354978/why-is-this-c-code-faster-than-my-hand-written-assembly-for -testing-the-collat):-) –