"Rodney M. Bates" <[EMAIL PROTECTED]> writes:

> I don't understand this.  A pointer to anywhere in an activation record
> (or even outside it, if outside by a fixed offset) allows access to
> exactly the same set of things as any other, including the value the base
> register holds when the activation record is current.  That set is everything
> in the AR, using different but still fixed displacements, and nothing more,
> since everything else is not necessarily at a fixed displacement from the
> AR.

OK, let me reset.

It seemed to me that you were suggesting that the static link pointer
should always be a constant offset from the frame pointer.

gcc doesn't work that way, though.  Here is a simple counter-example.

int
foo (int x, int y)
{
  int
  s1 ()
  {
    if (--y == 0)
      return 0;
    return x + s1 ();
  }

  return s1 ();
}

If you compile this code, you will see that the static link pointer is
passed down unchanged through the recursive calls.  The frame pointer
is, of course, different for each call.  You can't compute the static
link pointer from the frame pointer.  It's completely independent.

If this is not a counter-example for what you want, then I think we
need a clearer explanation of what you want.

Ian

Reply via email to