13.07.2015 Views

Lecture 13 Slides - Suraj @ LUMS

Lecture 13 Slides - Suraj @ LUMS

Lecture 13 Slides - Suraj @ LUMS

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

The General Semantics of Callsand Returns• Def: The subprogram call and returnoperations of a language are together calledits subprogram linkageImplementing “Simple”Subprograms• Call Semantics:1. Save the execution status of the caller2. Carry out the parameter-passing process3. Pass the return address to the callee4. Transfer control to the calleeImplementing “Simple”Subprograms• Return Semantics:1. If pass-by-value-result parameters are used,move the current values of those parameters totheir corresponding actual parameters2. If it is a function, move the functional value toa place the caller can get it3. Restore the execution status of the caller4. Transfer control back to the callerImplementing “Simple”Subprograms• Required Storage: Status information of thecaller, parameters, return address, andfunctional value (if it is a function)• The format, or layout, of the noncode partof an executing subprogram is called anactivation record• An activation record instance is a concreteexample of an activation record (thecollection of data for a particularsubprogram activation)3

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!