home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / arch / 12022 < prev    next >
Encoding:
Text File  |  1993-01-01  |  1.1 KB  |  37 lines

  1. Newsgroups: comp.arch
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!saimiri.primate.wisc.edu!hp9000.csc.cuhk.hk!cucs5.cs.cuhk.hk!bmtong
  3. From: bmtong@cs.cuhk.hk (Tong Bo-Ming)
  4. Subject: No Last Call Optimization on Sparc and DECstation
  5. Message-ID: <1992Dec30.094352.4243@cucs5.cs.cuhk.hk>
  6. Sender: news@cucs5.cs.cuhk.hk
  7. Organization: Faculty of Engineering, The Chinese U. of Hong Kong
  8. Date: Wed, 30 Dec 1992 09:43:52 GMT
  9. Lines: 26
  10.  
  11. In the field of Logic Programming, we have a kind of optimization
  12. technique called the Last Call Optimization.  The idea is simple.
  13.  
  14.     p(a,b,c)
  15.     {    x(a);
  16.         y(b);
  17.         z(c);
  18.     }
  19.  
  20. In the above procedure, we may discard the current stack frame (or reg
  21. window in Sparc) before calling z.  We then replace the call z
  22. instruction by a jump instruction.
  23.  
  24.     p(a)
  25.     {    x(a);
  26.     }
  27.  
  28. In the above kind of procedure where there is only one call, no stack
  29. frame is necessary.  It can be optimized as if it were a leaf procedure.
  30.  
  31. It is a sad thing to notice that such a nice optimization is not
  32. implemented in languages other than Prolog and on RISC architectures.
  33.  
  34.                 Tong Bo-Ming
  35.                 Department of Computer Science
  36.                 The Chinese University of Hong Kong
  37.