CW 300

B. Demoen and Phuong-Lan Nguyen
On the impact of argument passing on the performance of the WAM and B-Prolog

Abstract

B-Prolog deviates from WAM mainly by its parameter passing mechanism: parameters are pushed on the control stack instead of being passed through argument registers. Also, the B-Prolog emulator has a quite high performance on the classical benchmark set despite its being ANSI-C compliant. It is therefore tempting to attribute its performance to the parameter passing convention. This issue is investigated here in more detail. Instruction compression was a key issue in this study, so we discuss issues related to it. We next show with a set of artificial deterministic and backtracking programs that the WAM and B-Prolog can outperform each other arbitrarily, indicating that - at least for emulators - neither has a systematic advantage over the other. Moreover, we show that whenever the WAM parameter passing schema is worse, a very simple program transformation can be applied which gives WAM the benefits of B-Prologs argument passing schema, and this without leaving the WAM framework. Finally, as B-Prolog also offers an efficient implementation of delayed goals, we describe how the same efficiency can be obtained in a WAM environment. All empirical results are obtained with dProlog.

report.pdf / mailto: B. Demoen