"decompiled prolog"

Hello,

As i review the performance of my Prolog code, i noticed that I don’t really understand what happens under the hood (trying to get my head around “The Craft of Prolog” by O’Keefe - doesn’t yet help me shed light onto this).

When i work with C / C++ i usually can see assembly code side-by-side during debugging., which sometimes is instructive.

Wouldn’t it be great to have something like this as well in Prolog as well.

Dan

An actual answer to your question (without the Spanish Inquisition) is to use
vm_list(Predicate_name)

Hi Barb,

Thank you.

This is great.

It also lead me to a location in the manual I have never seen before.

Is there some documentation of the virtual machine instructions, and memory layout as well.

thank you,

Dan

Hi Eric,

Thank you,

Since I am looking into optimization; i am in the realm of machine, and must take the inner machine workings into account.

Once I understand that, I can try to revise my declarative code, to make it more efficient, which comes from such an understanding of what the machine does under the hood with each Prolog idiom i am using.

thanks,

Dan

Get the source and see pl-vmi.c. There you find VMI(Name, ...) and with some luck some explanation on what it does. You can also look at pl-comp.c, which provides the compiler that generates these things.

The VM started from _ Bowen et al. , 1983 D. L. Bowen, L. M. Byrd, and WF. Clocksin. A portable Prolog compiler. In L. M. Pereira, editor, Proceedings of the Logic Programming Workshop 1983 , Lisabon, Portugal, 1983. Universidade nova de Lisboa._ (pdf)

2 Likes