[Yhc] some initial questions

Tom Shackell shackell at cs.york.ac.uk
Fri Mar 3 11:11:26 EST 2006

> How do you detect when a process runs out of stack?  Do you calculate  
> the max stack usage from the bytecode and check before you push a new  
> stack frame?

That's pretty much exactly right.

The maximum stack usage for each function is statically calculated by 
the compiler anyway, see FunObj at:

The runtime doesn't quite check every time it pushes a new stack frame 
(it pushes stack frames for lots of reasons, for example because it's 
about to GC) so it always ensures that all times it has enough stack 
space for one stack frame (they're not very big anyway).

When the runtime performs an EVAL function it checks that there is 
enough stack space for two frames and the called function's maximum 
stack usage (one for the frame it's going to create and another as the 

> How do you deal with OS threads portably?  I assume you use pthreads  
> for *nix.  Does windows know pthreads or did you create some thin  
> wrapper over OS specific threading?

A wrapper over OS specific threading, the *nix implementation does 
indeed use pthreads, and Neil's going to write the windows one since I 
know nothing about it ;-)

Cheers :-)


More information about the Yhc mailing list