[MLton] Re: r6701
fluet at tti-c.org
Wed Aug 20 20:55:07 PDT 2008
On Tue, 19 Aug 2008, Wesley W. Terpstra wrote:
> I'm currently in paper-deadline-before-vacation-pressure-mode, so I haven't
> gotten to finishing the PIC for amd64 external calls or PIC of any kind for
> i386. The amd64 stuff seems easy and I'll get to it soon. Like I discussed
> with you earlier, i386 is quite a bit harder, particularly because %esp is
> not usable in MLton assembly.
For Cygwin and MinGW, which don't support sigaltstack, we can't use %esp
other than to point to the top of the C stack. Look for uses of
reserveEsp in x86-codegen/*.
> Why is %ebp used for the ML stack anyway? Since %esp gets pushed into
> c_stackP, I'd have thought %esp would be perfectly fine for use as the ML
> stack too.
for some comments about using %esp.
> Would it be safe to push 4 bytes to the ML stack, if %esp were
> pointing at it?
No. One issue is that the ML stack grows from low addresses to high
addresses, so the push and pop instructions don't move it in the right
> ie, could I do this:
> call tmp_label
> tmp_label: pop %eax
> mov gcState-tmp_label+someOffsetIntoGcState(%eax),%eax
> to load a value out of the gcState array into %eax? The concern is that I
> need to be sure that those 4 bytes at %esp are available. I don't really
> understand how the limit checking of the ML stack works.
I'm not sure exactly what the above code is meant to accomplish.
More information about the MLton