[virtmach] lambda (again)

Peter_Murray@allegiance.com.au Peter_Murray@allegiance.com.au
Mon, 13 Dec 1999 12:16:13 +1000


Sorry about the previous blank message.....

> I'm not sure what a 'lambda' instruction would do.  I suppose it would
> convert a sequence of data plus a function description into a sequence of
> instructions?  This seems to be a better task for a language than for
> a VM, although controlled dynamic code creation would be nice
> for a VM.

I mentioned previously a book describing a simple VM for scheme (Lisp In
Small Pieces).  With regards to the current lambda topic, I thought maybe
some of you would be interested (or maybe not) to see a dump of the
bytecodes generated for this VM from a couple of relevant scheme
statements.

((lambda () #t))

   [CREATE_ACTIVATION_FRAME0]
   [LINK_ENV]
   [LOAD_TRUE]
   [RETURN]

(let ((simpleFn (lambda () #t)))
  (simpleFn))

   [CREATE_CLOSURE_AND_SHORT_GOTO_FORWARD] 2
   [LOAD_TRUE]
   [RETURN]
   [PUSH_VALUE]
   [CREATE_ACTIVATION_FRAME1_AND_PUSH]
   [POP0_IN_FRAME]
   [LINK_ENV]
   [SHALLOW_REFERENCE0]
   [PUSH_VALUE]
   [CREATE_ACTIVATION_FRAME0]
   [POP_FUNCTION_AND_GOTO]