home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.arch
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!saimiri.primate.wisc.edu!hp9000.csc.cuhk.hk!cucs5.cs.cuhk.hk!bmtong
- From: bmtong@cs.cuhk.hk (Tong Bo-Ming)
- Subject: No Last Call Optimization on Sparc and DECstation
- Message-ID: <1992Dec30.094352.4243@cucs5.cs.cuhk.hk>
- Sender: news@cucs5.cs.cuhk.hk
- Organization: Faculty of Engineering, The Chinese U. of Hong Kong
- Date: Wed, 30 Dec 1992 09:43:52 GMT
- Lines: 26
-
- In the field of Logic Programming, we have a kind of optimization
- technique called the Last Call Optimization. The idea is simple.
-
- p(a,b,c)
- { x(a);
- y(b);
- z(c);
- }
-
- In the above procedure, we may discard the current stack frame (or reg
- window in Sparc) before calling z. We then replace the call z
- instruction by a jump instruction.
-
- p(a)
- { x(a);
- }
-
- In the above kind of procedure where there is only one call, no stack
- frame is necessary. It can be optimized as if it were a leaf procedure.
-
- It is a sad thing to notice that such a nice optimization is not
- implemented in languages other than Prolog and on RISC architectures.
-
- Tong Bo-Ming
- Department of Computer Science
- The Chinese University of Hong Kong
-