| OCR Text |
Show 77 4.4.1 Stack Recovery on Backtracking When a Boplog process backtracks, it has no further use for any data which were created since the creation of the choice point to which it falls back. If it can be guaranteed that no process has a use for that data, then the memory occupied by the data can be over-written. Each Boplog process uses its current value of scp to determine whether any processes could have references to stack areas. If the choice point to which a process backtracks was created at the same time or later than the choice point referenced by scp, the heap and stack can be recovered to the levels stored in the choice point. If the choice point is earlier than the scp choice point, recovery must be delayed. Recovery of shared stack areas is accomplished by keeping a count of the number of choices in a choice point which have completed, and by linking each descendant process to its parent process with a migration point. A migration point is created by the descendant process on its stack when migration occurs. The migration point stores a reference to the choice point from which the choice was taken, and the value of the descendant process's scp. Figure 19a shows the stack of a process P1 which has just created a choice point now referenced by its scp. Process P 2 is idle and will migrate a choice from P1's new choice point. Figure 19b shows the state of the stacks immediately after the migration. P2 has created a migration point mp which links it to both its old scp choice point and P 1's new choice point. Both processes now continue executing, creating new choice points and changing their scp values (Figure 19c). Eventually, both processes backtrack and try to recover stack area. Let's assume that P 1 can recover as far as the choice point from which P 2 migrated a choice, and the P 2 can recover back to its migration point. P 2 now updates the choice point from which it migrated its choice. P 1 can then recover its stack again since the memory is now unshared. It resets its scp to reference the previous choice point (which may possibly be recoverable now, too). p2 resets its scp value from the value stored in the migration point, and recovers its |