真 C 之二
by thinker
最後更新時間:
2008-06-19 17:52:26 CST |
引用
查詢:
COMMENTS:
on 2008-06-19 22:05:47 CST
jclin said ..
Does this work on x86-64 arch or MacOS?
As I known, x86-64 GCC omits the frame pointer and passes arguments in registers by default.
on 2008-06-19 22:58:37 CST
Thinker said ..
to jclin,
不好意思,我窮苦,沒有 x86-64 的機器可用,所以我也不知道。如果有 pass by registers 的情況,我猜想能 pass 更多 arguments 而非一個 argument ,並計算第 n 個 argument,將這個問題避掉。 omit-frame-pointer 應該不是個問題,因為我們是計算第一個 argument 的位置。
on 2008-06-20 00:13:42 CST
jclin said ..
在 x86-64 因為會有大量的 registers,即使是很多參數,一樣會部份放在 registers,部份放在 stacks。
on 2008-06-20 00:27:58 CST
Thinker said ..
既然 register 數量是有限的,我們能透過增加 dummy() 的 argument 數量,計算第 n 個 argument 的位址,以解決這個問題。詳細情況容後另文專述。話說回來,能借能 x86-64 來試嗎? :p
on 2008-06-20 11:34:15 CST
jclin said ..
:) I have no personal x86-64 machine. I tested it in the company.
It is perfect when gcc -m32. It got segmentation faults in native x86-64. Also, got Bus error on MacOSX 10.5.3.
Because there are some assumptions on the model of calling conversion, it becomes machine dependent.