Home

[This page is auto-generated; please prefer to read the article’s PDF Form.]



[Prev]   [Up]   [Next]   

Resume-Points for Resuming

Whenever any general function call returns, the execution resumes in the caller just after that point of call. It happens with the help of program-counter saved on the program-stack during each call. But for resuming our virtual-calls, our implementation needs to figure out at which code location should the execution resume. We will refer to such locations as “resume-point”. If there is only one place in the method recur() where recursive call is made, there is only one possible resume-point, and so during every time we resume, we can start execution at that resume-point.

But if there are more than one such recursive calls and hence multiple resume-points, it may not be trivial to figure out where to resume the execution. For this, we can number these resume-points uniquely, and keep a numeric variable res_pt (“resume point”) in each vc_frame. Whenever a recursive virtual-call is being made, this variable is set in the current call’s frame indicating where to resume this call later. Optionally, a special value 0 of res_pt can be used for a frame which is just being pushed to start a new virtual call, and so it will indicate a fresh call (not resuming).

[Prev]   [Up]   [Next]