Hello Marc,
On Thu, 18 Nov 2010 09:56:42 -0500 Marc Feeley feeley@iro.umontreal.ca wrote:
...
The setting of register 4 (i.e. "+4" in the GVM code) is a side effect of the jump instruction when a closure is being jumped to.
Thanks! Is it documented somewhere?
Note that register 4 is unused at the moment of the jump because parameters are passed in 4 registers (+0=return address, +1=1st param, +2=2nd param, +3=3rd param).
My test shows that 4rd etc param is located on the stack, and therefore there is no register 5 or more.
However, if I understand "A parallel virtual machine for efficient scheme compilation" correctly, a backend can specify a number N of registers. I suppose that in this case the closure register will be the last register, number N. Right?
...
What is your interest in the GVM code generated by Gambit?
Short-term goal: compile Scheme code to PHP.
Instead implementing a backend for Gambit, I'd like to start with an independent tool, which parses the GVM code.
By the way, is there an easy way to dump the internal representation for easy parsing? An optimistic try of "pretty-print" instead of "virtual.dump" is failed.
More global experiment: use of Scheme as a new portable Assembler or virtual machine:
http://uucode.com/blog/2010/09/28/r5rs-scheme-as-a-virtual-machine-i/ http://uucode.com/texts/genxml/genxml.html
Marc