skumar@clash.rutgers.edu (Sanjeev Kumar) (08/04/88)
I have a doubt to clarify from an example that is given in the book mentioned above. This is an example on pages 470-471. The example has been given in the context of trimming environments for a clause. The whole example and the insruction in doubt are as follows: (WPE is another name for WAM) Prolog Source WPE Machine Code p(A,D) :- p: alloc q(A,B), r(B,C), getVar r2, 2 % D is first in frame s(C,D). putVar r2, 4 % B is last in frame call q:, 5 % space for D,C,B putUVal r1, 4 % B to r1 putVar r2, 3 % C is second in frame call r:, 4 % space for D,C /*****/ ----------> putVal r1, 3 % C to r1 putVal r2, 2 % D to r2 dealloc exec s: My objection is to the instruction marked by /*****/. I think it should be "putUVal r1, 3" for the same reason as putUVal has been used for B. C might still be unbound after the call to r, and since we are deallocating the frame for the clause before the call to s:, C becomes unsafe. All explanations are welcome. Apart from the doubt mentioned above, I found the section on the WAM (#11.8) very useful and well written. Sanjeev Kumar. -- Sanjeev Kumar. ( skumar@paul.rutgers.edu ) Phone: Off. (201)932-3766, Res. (201)878-1841. Dept. of Computer Science, RUTGERS, New Brunswick, NJ08903.
warren@sbcs.sunysb.edu (David Scott Warren) (08/05/88)
In message <Aug.4.02.26.38.1988.12838@clash.rutgers.edu> Sanjeev Kumar asks: >I have a doubt to clarify from an example that is given in the book (Computing with Logic, by Maier/Warren) >... This is an example on pages 470-471. >Prolog Source WPE Machine Code .... > call r:, 4 % space for D,C > /*****/ ----------> putVal r1, 3 % C to r1 > putVal r2, 2 % D to r2 ... > > My objection is to the instruction marked by /*****/. I think it >should be "putUVal r1, 3" ... Sanjeev is exactly correct for the reasons he cites. That should have been a putUVal instruction. Thank you for the correction. -David S. Warre