中央计算机系统英文翻译,深入理解计算机系统外文文献翻译.doc

外文原文

From:《J2EE in the Real World》

Author:Jack Joney

Computer Systems A programmer's Perspective

深入理解计算机系统

原文:

Stack Frame for

calling procedure

+8 +8

+4 +4

%ebp 0 %ebp 0

Stack Frame for

fib_rec

-20 -20

%esp -24 -24

%esp -40

After set up Before first recursive call

Figure 3.21: Stack Frame for Recursive Fibonacci Function. State of frame is shown after initial set up (left), and just before the first recursive call (right).

For the nonterminal condition, instructions 10 to 12 set up the first recursive call. This involves allocating12 bytes on the stack that are never used, and then pushing the computed value n-2. At this point, the stack frame will have the form shown on the right side of Figure 3.21. It then makes the recursive call, which will trigger a number of calls that allocate stack frames, perform operations on local storage, and so on. As each call returns, it deallocates any stack space and restores any modified callee save registers. Thus, when we return to the current call at line 14 we can assume that register %eax contains the value returned by the recursive call, and that register %ebx contains the value of function parameter n. The returned value (local variable prev_val in the C code) is stored in register %esi (line 14). By using a callee save register, we can be sure that this value will still be available after the second recursive call.

Instructions 15 to 17 set up the second recursive call. Again it allocates

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值