Re: Prolog to WAM Register Allocation?

anton@mips.complang.tuwien.ac.at (Anton Ertl)
17 Jan 2006 21:38:42 -0500

          From comp.compilers

Related articles
Prolog to WAM Register Allocation? sender_001@hotmail.com (Ludwig Wittgenstein) (2006-01-12)
Re: Prolog to WAM Register Allocation? anton@mips.complang.tuwien.ac.at (2006-01-17)
Re: Prolog to WAM Register Allocation? jjk@acm.org (Jens Kilian) (2006-01-17)
Re: Prolog to WAM Register Allocation? ik@unicals.com (Ivan A. Kosarev) (2006-01-17)
Re: Prolog to WAM Register Allocation? kym@ukato.freeshell.org (russell kym horsell) (2006-01-19)
| List of all articles for this month |

From: anton@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups: comp.compilers
Date: 17 Jan 2006 21:38:42 -0500
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
References: 06-01-040
Keywords: prolog

"Ludwig Wittgenstein" <sender_001@hotmail.com> writes:
> I'm currently studying how Prolog compiles its source into Warren
>Abstract Machine code and I was wondering what kind of algorithm does
>Prolog use to assign variables and constants to X and Y registers?


Depends on the Prolog implementation. One thing that I remember is
that it is a good idea to arrange the "registers" that actually reside
on the stack (IIRC the Y registers) by lifetime, with the ones dying
last having the smallest number; on calls the stack depth is reduced
to keep only those "registers" that survive the call; this reduces the
stack requirements on recursion (I guess similar things are done in
functional languages).


- anton
--
M. Anton Ertl
anton@mips.complang.tuwien.ac.at
http://www.complang.tuwien.ac.at/anton/home.html



Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.