CVS Commit

Matthew Fluet Matthew Fluet <fluet@CS.Cornell.EDU>
Wed, 12 Sep 2001 17:54:19 -0400 (EDT)


> I'm  very  happy  still  with my 400 MHz, but at least it has 512 meg of ram,
> which is way way better than 192.  Memory is really cheap these  days  (about
> 25 cents per meg, so 512 meg is only $256).

Yeah, I ordered a 512 meg DIMM yesterday, but the shipment has been
understandably delayed.

> Talking  about  registers, I was talking with Blume on Saturday on the way to
> Babel.  I was asking him how long C calls took in SML/NJ, because  they  have
> to set up a stack, and he said that they always have a stack (only pointed to
> by the frame pointer) with negative offsets being used to get access  to  the
> faked  register.   Do  we do that or do we actually use full memory addresses
> for the faked registers.  The point is that offsets from the fp register  are
> very  compact  so  just from the point of the i-cache it might be worth while
> dedicating a register.
> 
> If we aren't doing this, would it be easy to hack it in just to see  what  it
> does in terms of speed and code size?

I'm not exactly sure what's going on in SML/NJ.  What do you mean by
"faked registers"?  

Here's how it currently works in MLton.  As we jump from the C-stub to the
initGlobals_0 label in the assembly, we copy %esp to a static memory
location (c_stackP).  

Now, whenever I want to do a C call:

movl c_stackP,%esp
pushl arg1
...
pushl argn
<save callee save registers>
call c_function
addl $N,%esp   # only if there are more C calls in this block
               # otherwise, we just let %esp die

Seems to be as fast as we can be without dedicating %esp to the C stack.