Chapter 6: Runtime System

Parameter Passing .

. Copy restore (copy-in copy-out, call by value result)

- actual parameters are evaluated, rvalues are passed by call by value, lvalues are determined before the call

- when control returns, the current rvalues of the formals are copied into lvalues of the locals

This is a hybrid form between call-by-value and call-by-reference (also known as copy-in copy-out or value-result).

1. Before control flows to the called procedure, the actual parameters are evaluated. The r-values of the actuals are passed to the called procedure as in call-by-value. In addition, however, the l-values of those actual parameters having l-values are determined before the call.

2. When the control returns, the current r-values of the formal parameters are copied back into the l-values of the actuals, using the l-values computed before the call. Only the actuals having l-values are copied.