Hello,
I compiled to GVM the following test program:
(declare (standard-bindings) (fixnum) (not safe)) (define mkadder (lambda (n) (lambda (x) (+ x n)))) (define add1 (mkadder 1)) (add1 1)
In the produced GVM code (below, slightly edited for mail posting), I see that the code of the lambda uses a closure in the register 4, but nowhere in the code I see an assigment to this register. What do I miss?
**** #<primitive | test2.o7|> = #line 2 "............" #1 0 entry-point 0 () ~#mkadder = '#<procedure ~#mkadder> #line 6 -1 = +0 +1 = '1 +0 = #3 -2 = . -3 = . -4 = . jump* 4 #2 #2 4 jump 4 ~#mkadder 1 #3 4 return-point ~#add1 = +1 #line 7 +1 = '1 +0 = -1 jump* 4 #4 #4 4 jump 0 ~#add1 1
**** #<procedure ~#mkadder> = #line 2 "................" #1 0 entry-point 1 () close -1 = (#2 +1) +1 = -1 jump 0 +0 #2 0 closure-entry-point 1 () +4 = +4(1) +1 = (##fx+ +1 +4) jump 0 +0