From: bryce@kampjes.demon.co.uk> Date: Thu, 26 Jul 2007 11:43:43 +0100> To: exupery@lists.squeakfoundation.org> Subject: RE: Dynamically choosing a register> > > Do you mean for the cond to be evaluated at compile time in the> following?> > (def store-to-register (reg val)> (cond (reg)> ((number-that-means-eax) (store eax val)No, it can't be compile time since val will live in a field in instances of MethodContext. I can't know what val is until runtime. What I really want is a way to store in memory or another register some kind of reference to a register so that I would have the option in my VM that a caller can request the answer put right into the literal register of his choice.> If so you could just generate:> (mov t1 eax)> > Then the register allocator will try to allocate t1 in eax> and remove that move.> > BryceIs there any documentation on your mid and low level code generator? I would like to make a lisp-like language that targets it. This way I wouldn't have to make a compiler for every processor type, but I would have full power of the CPU and no dependencies on C.
_________________________________________________________________ See what you’re getting into…before you go there. http://newlivehotmail.com
On Thu, 26 Jul 2007 20:24:06 +0200, J J wrote:
From: bryce@kampjes.demon.co.uk> Date: Thu, 26 Jul 2007 11:43:43 +0100> To: exupery@lists.squeakfoundation.org> Subject: RE: Dynamically choosing a register> > > Do you mean for the cond to be evaluated at compile time in the> following?> > (def store-to-register (reg val)> (cond (reg)> ((number-that-means-eax) (store eax val)
No, it can't be compile time since val will live in a field in instances of MethodContext. I can't know what val is until runtime. What I really want is a way to store in memory or another register some kind of reference to a register so that I would have the option in my VM that a caller can request the answer put right into the literal register of his choice.
If you use some form of the traditional call/return sequence, have the caller reserve a #return slot at a fixed location (offset). There the callee can store its return value (you mentioned a way to store in memory). Then the caller can pop/move the value into any register it likes, dynamically and independent of the callee.
Cheers Klaus
If so you could just generate:> (mov t1 eax)> > Then the register allocator will try to allocate t1 in eax> and remove that move.> > BryceIs there any documentation on your mid and low level code generator? I would like to make a lisp-like language that targets it. This way I wouldn't have to make a compiler for every processor type, but I would have full power of the CPU and no dependencies on C.
See what you’re getting into…before you go there. http://newlivehotmail.com
J J writes:
From: bryce@kampjes.demon.co.uk> Date: Thu, 26 Jul 2007 11:43:43 +0100> To: exupery@lists.squeakfoundation.org> Subject: RE: Dynamically choosing a register> > > Do you mean for the cond to be evaluated at compile time in the> following?> > (def store-to-register (reg val)> (cond (reg)> ((number-that-means-eax) (store eax val)No, it can't be compile time since val will live in a field in instances of MethodContext. I can't know what val is until runtime. What I really want is a way to store in memory or another register some kind of reference to a register so that I would have the option in my VM that a caller can request the answer put right into the literal register of his choice.> If so you could just generate:> (mov t1 eax)> > Then the register allocator will try to allocate t1 in eax> and remove that move.> > BryceIs there any documentation on your mid and low level code generator? I would like to make a lisp-like language that targets it. This way I wouldn't have to make a compiler for every processor type, but I would have full power of the CPU and no dependencies on C.
The best documentation about Exupery's internals is:
http://www.kampjes.demon.co.uk/articles/exuperyDesign.pdf
Beyond that you're best looking at the source. If you're planning on running your Lisp inside Squeak then I'd probably subclass and adapt IntermediateSimplifier as it contains useful code to access the object memory.
I'd also recommend writing test first using the Mocks provided, the learning curve will be a little steeper initially but testing pays of surprising quickly.
Bryce
exupery@lists.squeakfoundation.org