Week 9- Implementing Subprogram Flashcards
What are formal parameters?
Variables defined by a subprogram to accept values.
What is the general process of a subprogram call and return?
Save status, pass parameters, execute, restore status, and return.
What are actual parameters?
Real values passed to the subprogram.
What are stack-dynamic local variables?
Variables allocated/deallocated on the runtime stack.
What is an overloaded subprogram?
A subprogram with the same name but different parameter lists.
What is ad hoc polymorphism?
Subprograms operate on different types based on actual parameters.
What is a coroutine?
A subprogram with multiple entry points allowing cooperative multitasking.
What is in an activation record instance (ARI)?
Caller status, parameters, return address, return value, temporaries.
What are the two parts of a simple subprogram’s AR?
Code part and non-code part (local variables and data).
What is the first action a caller must perform in the linkage process?
Create an activation record instance.
What does the caller do to the current program unit’s execution status?
Saves it.
What is passed to the called subprogram after parameters?
The return address.
What is the first action in the callee’s prologue?
Save the old EP in the stack as the dynamic link.
What does the callee do to the execution status of the caller?
Restores it.
What happens to the local variables in the callee’s prologue?
They are allocated.
What happens to out-mode parameters during the callee’s epilogue?
Their values are moved to the corresponding actual parameters.
What happens to the stack pointer in the callee’s epilogue?
It is restored to the value of the current EP minus one.