Kaffe stack bounds checks

Tim Wilkinson tim at transvirtual.com
Sun Aug 22 16:36:33 PDT 1999


The new JIT3 stuff (available in the CVS tree) uses a slightly different
mechanism to check the stack bounds - it still does an explict check on
function entry but this check is now *much* faster than before.  The
reason for doing an explicit check rather than using the MMU to do this
(which would indeed be faster) is largely because I'm not keen to force
the need for an MMU (some of our targets don't have them).

It might be possible to provide both scheme however which would be an
obvious plus.

There's also the issue of intefacing such a scheme with a native threading
scheme on some platforms - I've not looked in to this.


On Sun, 22 Aug 1999, William E. Cohen wrote:

> Has anyone looked at using the memory protection hardware available on
> most processors (i386, SPARC, and Alpha) to reduce the cost of method
> invocation in Kaffe?  Every time a function is invoked in Kaffe, the
> code in the prolog calls a function to check that the thread's stack
> limits have not be exceeded.  This check adds a significant overhead
> to every function invocation.  Given the frequency of method
> invocations, reducing the overhead of this operation should
> significantly improve the performance of Kaffe.
> It is possible to make the memory protection hardware in the processor
> perform the stack bounds check.  Before and after each stack have a
> page of memory marked as unaccessable.  If there is an stack access
> beyond the bounds of the stack it would fall on one of the
> unaccessible pages, a SIGSEGV signal would occur.  Linux, Solaris, and
> DEC Unix all have a function mprotect that can be used for that
> purpose.  This approach uses more memory, but I think that most people
> would be willing to trade memory for more speed.
> -Will Cohen
>  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>    William Cohen                                 cohen at ece.uah.edu
>    Assistant Professor
>    Electrical and Computer Engineering
>    College of Engineering
>    University of Alabama in Huntsville           voice: 256/890-6830
>    Huntsville, AL 35899                          fax:   256/890-6803
>    ECE Homepage: http://www.eb.uah.edu/ece/ecehome.html
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

More information about the kaffe mailing list