[Larceny-users] compiling using the twobit heap

Felix Klock felixluser at pnkfx.org
Mon Apr 27 08:31:17 EDT 2009


Dimitris-

On Apr 25, 2009, at 5:28 PM, Dimitris Vardoulakis wrote:

> which file in the source code shows what happens when I type a
> definition in the repl?

Note that what happens when you type a definition in the repl depends  
on what evaluator you are using, which differs between larceny.heap  
and twobit.heap.  In particular, the twobit heap uses an interpreter  
as its evaluator, so it may be misleading to compare output of its  
evaluator with the output of the composition of compile and assemble.

At the end of this message, I have included some interactions [1] that  
may make this concrete; note how different (e.g. longer) the machine  
code in slot 0 is for the interpreted identity than for the compiled  
identity.

> So, what else is happening when I send sth to the repl directly, vs
> calling "assemble" and "compile" myself?


For the larceny.heap, the evaluator is defined in src/Build/iasn- 
larceny-heap.sch; see the internal definition of the twobit procedure  
in that file.  There you will see a direct invocation of the link-lop- 
segment procedure that Will discussed in his message..

For the twobit.heap, the evaluator is defined in src/Lib/Interpreter/ 
interp.sch; the comments at the top of that file are helpful for  
understanding the implementation therein.

-Felix

[1] Some interactions illustrating the difference between the larceny  
and twobit heaps:

% ./larceny -heap twobit.heap
Larceny v0.97a4 (alpha test) (Apr 15 2009 15:44:34, precise:Posix  
Unix:unified)
twobit.heap, built on Mon Apr 27 08:13:46 EDT 2009

 > (evaluator)
#<PROCEDURE interpret>

 > (procedure-ref (lambda (x) x) 0)
#vu8(131 251 4 116 17 199 69 44 4 0 0 0 255 149 0 2 0 0 144 144 235  
234 139 94 13 139 123 255 187 8 0 0 0 247 195 3 0 0 128 116 13 49 192  
255 85 4 163 0 0 0 144 144 235 235 137 157 196 0 0 0 131 195 4 137 200  
255 149 216 1 0 0 144 139 133 196 0 0 0 193 224 8 13 162 0 0 0 137 3  
131 195 3 137 218 49 201 247 199 1 0 0 0 116 13 137 248 137 211 255  
149 236 1 0 0 144 144 144 137 124 10 1 139 94 9 137 223 139 69 12 5 8  
1 0 0 57 224 118 5 255 85 16 235 239 45 0 1 0 0 137 69 12 137 80 248  
137 120 252 141 72 249 139 70 5 139 88 13 255 77 8 116 22 141 67 249  
168 7 117 15 139 64 4 137 222 187 4 0 0 0 131 192 255 255 224 255 149  
248 1 0 0 144 144 235 224)

 > ^D
% ./larceny -heap larceny.heap
Larceny v0.97a4 (alpha test) (Apr 15 2009 15:44:34, precise:Posix  
Unix:unified)
larceny.heap, built on Wed Apr 15 15:50:02 EDT 2009

 > (evaluator)
#<PROCEDURE twobit>

 > (procedure-ref (lambda (x) x) 0)
#vu8(131 251 4 116 17 199 69 44 4 0 0 0 255 149 0 2 0 0 144 144 235  
234 137 203 195)

 > (evaluator interpret)
#<PROCEDURE interpret>

 > (evaluator)
#<PROCEDURE interpret>

 > (procedure-ref (lambda (x) x) 0)
#vu8(131 251 4 116 17 199 69 44 4 0 0 0 255 149 0 2 0 0 144 144 235  
234 139 94 13 139 123 255 187 8 0 0 0 247 195 3 0 0 128 116 13 49 192  
255 85 4 163 0 0 0 144 144 235 235 137 157 196 0 0 0 131 195 4 137 200  
255 149 216 1 0 0 144 139 133 196 0 0 0 193 224 8 13 162 0 0 0 137 3  
131 195 3 137 218 49 201 247 199 1 0 0 0 116 13 137 248 137 211 255  
149 236 1 0 0 144 144 144 137 124 10 1 139 94 9 137 223 139 69 12 5 8  
1 0 0 57 224 118 5 255 85 16 235 239 45 0 1 0 0 137 69 12 137 80 248  
137 120 252 141 72 249 139 70 5 139 88 13 255 77 8 116 22 141 67 249  
168 7 117 15 139 64 4 137 222 187 4 0 0 0 131 192 255 255 224 255 149  
248 1 0 0 144 144 235 224)

 > ^D
%




More information about the Larceny-users mailing list