这是一项昂贵的操作,因为可能会移动每个活动对象,每个经过移动的对象的指针都必须更新为新位置。
This is an expensive operation because every live object might be moved, and every pointer to a moved object must be updated to the new location.
这对函数了解自己的活动记录在什么地方提供了方便——它们可以使用堆栈指针的形式简单地进行定义。
This makes it easy for functions to know where their activation record is — they are simply defined in terms of the stack pointer.
如果一个函数正在执行,那么堆栈指针就会指向整个堆栈的顶部,这也是该函数活动记录的顶部。
If a function is executing, then the stack pointer is pointing to the top of the whole stack, which is also the top of that function's activation record.
应用推荐