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.
[1]
Micha Meier.
Compilation of Compound Terms in Prolog
,
1990,
NACLP.
[2]
Ehud Shapiro,et al.
Third International Conference on Logic Programming
,
1986
.
[3]
Peter Van Roy,et al.
Can Logic Programming Execute as Fast as Imperative Programming?
,
1990
.
[4]
Bart Demoen,et al.
Improving the register allocation in WAM by reordering unification
,
1988
.
[5]
Zerksis D. Umrigar.
Finding Advantageous Orders for Argument Unification for the Prolog WAM
,
1990,
NACLP.
[6]
Andrew K. Turk.
Compiler Optimizations for the WAM
,
1986,
ICLP.
[7]
Shigeo Abe,et al.
A New Optimization Technique for a Prolog Computer
,
1986,
COMPCON.
[8]
Saumya K. Debray.
Register Allocation in a Prolog Machine
,
1986,
SLP.
[9]
Mats Carlsson.
Design and implementation of an or-parallel Prolog engine
,
1990,
RIT / KTH / TRITA-CS.