{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# Ch7 - 1 Run-Time Environments Chapter 7 COP5621 Compiler...

This preview shows pages 1–5. Sign up to view the full content.

1 Run-Time Environments Chapter 7 COP5621 Compiler Construction Copyright Robert van Engelen, Florida State University, 2007-2011

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
2 Procedure Activation and Lifetime • A procedure is activated when called • The lifetime of an activation of a procedure is the sequence of steps between the Frst and last steps in the execution of the procedure body • A procedure is recursive if a new activation can begin before an earlier activation of the same procedure has ended
3 Procedure Activations: Example program sort(input, output) var a : array [0. .10] of integer; procedure readarray; var i : integer; begin for i := 1 to 9 do read(a[i]) end; function partition(y, z : integer) : integer var i, j, x, v : integer; begin … end procedure quicksort(m, n : integer); var i : integer; begin if (n > m) then begin i := partition(m, n); quicksort(m, i - 1); quicksort(i + 1, n) end end; begin a[0] := -9999; a[10] := 9999; readarray; quicksort(1, 9) end. Activations: begin sort enter readarray leave readarray enter quicksort(1,9) enter partition(1,9) leave partition(1,9) enter quicksort(1,3) leave quicksort(1,3) enter quicksort(5,9) leave quicksort(5,9) leave quicksort(1,9) end sort.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
4 Activation Trees: Example s q(1,9) q(1,3) p(1,3)
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 16

Ch7 - 1 Run-Time Environments Chapter 7 COP5621 Compiler...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online