看板 ASM 關於我們 聯絡資訊
man了一下 dont keep the frame pointer in a register for functions that dont need one 我要問 frame pointer是不是就是指ebp?? 還有frame pointer 跟stack pointer不是都會存在register裡嗎? 如果不在register那就是在memory裡嘍~ 這樣存取的速度不就變慢了? 而且在memory 是不是pointer就可以把他的value改掉了嗎? 什麼樣的function可以不需要frame pointer在register裡呢?? 感謝 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 118.168.109.232
SILee:他的意思應該是如果不需要用到fp就不要多此一舉去動它 12/19 00:17
SILee:因為function如果需要動用到fp時必須先把原先的fp放到stack 12/19 00:18
SILee:而且function return時還要再pop出來 會浪費掉很多時間 12/19 00:19
SILee:某一些小function如果不需動用到很多local variable的話 12/19 00:20
SILee:是可以不使用到fp的 因為local variables全部放在register裡 12/19 00:22
SILee:fp的存在是為了方便fetch到存在stack中的local variables 12/19 00:23
SILee:當你不需要利用stack來暫存一些intermediate value時 12/19 00:24
SILee:去存取fp這個動作就是redundancy的instructions 12/19 00:25