A Novel Implementation Method of Delay.
Neng‐Fa Zhou · 1996
The efficiency of delay depends to a large extent on the following four basic operations: delay, wakeup, interrupt, and resume. Traditional implementations of delay in the WAM are slow because three out of the four basic operations need to save or restore the argument registers. In this paper, we present a novel method for implementing delay in a Prolog machine called ATOAM. The main idea is to store delayed calls as frames, called suspension frames, on the control stack rather than as records on the heap. Since delayed calls, after being woken, can be executed directly by using their suspension frames, the four basic operations become very simple. This method had been predicated to cost a large amount of control stack space. However, with tail-recursion elimination, the control stack space requirement can be reduced dramatically. This method has been implemented in the B-Prolog system. For several benchmark programs where delay is used, the experimental results show that B-Prolog is ...