A New Scheme for Unification in WAM

Prolog spends about 50% of its execution time in unification. It is therefore worthwhile to investigate improvements to unification. The propagation of read-write mode in WAM is a candidate for improvement. We present a new translation scheme to deal with it. The scheme has the following advantages: there is no code explosion; for right sided structures the usual form lists take in Prolog programs there is no overhead in the propagation of the read-write mode; for left sided structures, the overhead is made very small by rearranging the order in which the arguments of the structure are treated; it uses the optimal structure creation code in thewrite mode. The scheme is particularly good for native code compilers. It is also shown how the method can take into account particularities of the underlying hardware. Test results show good speedup, making mode declarations for efficiency reasons almost unnecessary. In addition, we include an important improvement to temporary register allocation schemes.