Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #19620

Re: Creating a new stack from an exisiting one.

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From "Pascal J. Bourguignon" <pjb@informatimago.com>
Newsgroups comp.lang.java.programmer, comp.programming
Subject Re: Creating a new stack from an exisiting one.
Date Sun, 04 Nov 2012 14:41:30 +0100
Organization Informatimago
Lines 62
Message-ID <87mwyxlc39.fsf@informatimago.com> (permalink)
References <f6d6cbfd-8152-4d92-92b5-89a18ac989a5@tr7g2000pbc.googlegroups.com> <0.73472d82415d5353822e.20121103155132GMT.87mwyyvg57.fsf@bsb.me.uk> <b227ba50-ccbc-4da0-9f6a-31bb809f329d@ah9g2000pbd.googlegroups.com> <0.898697c4e5f8819c7fa0.20121104004445GMT.878vaiurgi.fsf@bsb.me.uk> <87vcdllg3u.fsf@informatimago.com> <0.96b4857ea7d651ed53b3.20121104124839GMT.87txt5tty0.fsf@bsb.me.uk>
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
X-Trace individual.net 1oIKnrpS3e4C8hoS6t56gAx6taJI/8CV2xvYvkl6XrFzW4g3BJUD88HrKJYEavu4W7
Cancel-Lock sha1:YzRmZTE5ZDgzYTUxNjQyYmY2MjQzYjA5MThjYzg3ZDQyNTc1ZmRjMg== sha1:pVPaTkcwF9lE+stJuJxbW1mtF5U=
Face iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAQMAAABtzGvEAAAABlBMVEUAAAD///+l2Z/dAAAA oElEQVR4nK3OsRHCMAwF0O8YQufUNIQRGIAja9CxSA55AxZgFO4coMgYrEDDQZWPIlNAjwq9 033pbOBPtbXuB6PKNBn5gZkhGa86Z4x2wE67O+06WxGD/HCOGR0deY3f9Ijwwt7rNGNf6Oac l/GuZTF1wFGKiYYHKSFAkjIo1b6sCYS1sVmFhhhahKQssRjRT90ITWUk6vvK3RsPGs+M1RuR mV+hO/VvFAAAAABJRU5ErkJggg==
X-Accept-Language fr, es, en
User-Agent Gnus/5.13 (Gnus v5.13) Emacs/23.4 (darwin)
Xref csiph.com comp.lang.java.programmer:19620 comp.programming:2462

Cross-posted to 2 groups.

Show key headers only | View raw


Ben Bacarisse <ben.usenet@bsb.me.uk> writes:

> "Pascal J. Bourguignon" <pjb@informatimago.com> writes:
> <snip>
>> Well, I don't know of any processor that uses a separate stack for the
>> frame pointers.
>
> No, me neither.  The description also lacked any mention of the return
> address so I don't think this is about hardware.  Maybe it's coursework,
> and the separate stacks are there to keep the concepts clear?  I don't
> know.

That said, in early Fortran and Pascal compilers, they used a "display
record" vector, which would point to the visible frames.  While such a
"display record" could be managed as a stack, static analysis allows
for a fixed size and direct updating.


So for example:

    function f (x:integer)
      function g (y:integer)
      begin
         if x>y then
            g:=x+y+f(x-y)-g(y+1)
         else
            g:=x+y;
      end;
    begin
      if x<0
         f:=1
      else
         f:=g(x-1)
    end;

while one could need an unbounded number of stack frames (depending on
the value of the parameters),  the invocations of the function g see
only the frame of one invocation of the function f, so we need a
"display record" of size 2.


          stack:
   -------------------
    stack frame for f
    stack frame for g
    stack frame for g
    stack frame for g
    stack frame for f
    stack frame for g
    stack frame for g
    stack frame for f <----+     display:
    stack frame for g      |     ---------
    stack frame for g      +------- f
    stack frame for g <------------ g

The display record is a kind of stack of lexical scopes.  If we get
outside of f, and enter another embedding of lexical scopes, another set
of stack frame pointers may be "stacked" into the display record.

-- 
__Pascal Bourguignon__
http://www.informatimago.com

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Creating a new stack from an exisiting one. Chad <cdalten@gmail.com> - 2012-11-03 07:45 -0700
  Re: Creating a new stack from an exisiting one. Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-11-03 15:51 +0000
    Re: Creating a new stack from an exisiting one. Chad <cdalten@gmail.com> - 2012-11-03 09:22 -0700
      Re: Creating a new stack from an exisiting one. markspace <-@.> - 2012-11-03 11:20 -0700
      Re: Creating a new stack from an exisiting one. "BartC" <bc@freeuk.com> - 2012-11-03 18:58 +0000
      Re: Creating a new stack from an exisiting one. "Pascal J. Bourguignon" <pjb@informatimago.com> - 2012-11-04 00:49 +0100
      Re: Creating a new stack from an exisiting one. Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-11-04 00:44 +0000
        Re: Creating a new stack from an exisiting one. "Pascal J. Bourguignon" <pjb@informatimago.com> - 2012-11-04 13:14 +0100
          Re: Creating a new stack from an exisiting one. Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-11-04 12:48 +0000
            Re: Creating a new stack from an exisiting one. Thomas Richter <thor@math.tu-berlin.de> - 2012-11-04 14:14 +0100
              Re: Creating a new stack from an exisiting one. Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-11-04 15:38 +0000
            Re: Creating a new stack from an exisiting one. "Pascal J. Bourguignon" <pjb@informatimago.com> - 2012-11-04 14:41 +0100
          Re: Creating a new stack from an exisiting one. "BartC" <bc@freeuk.com> - 2012-11-04 14:11 +0000
            Re: Creating a new stack from an exisiting one. "Pascal J. Bourguignon" <pjb@informatimago.com> - 2012-11-04 16:00 +0100
          Re: Creating a new stack from an exisiting one. markspace <-@.> - 2012-11-04 11:02 -0800
          Re: Creating a new stack from an exisiting one. Martin Gregorie <martin@address-in-sig.invalid> - 2012-11-04 19:56 +0000
    Re: Creating a new stack from an exisiting one. Jeff Higgins <jeff@invalid.invalid> - 2012-11-03 16:46 -0400
      Re: Creating a new stack from an exisiting one. Jeff Higgins <jeff@invalid.invalid> - 2012-11-04 08:22 -0500
        Re: Creating a new stack from an exisiting one. Jeff Higgins <jeff@invalid.invalid> - 2012-11-04 11:30 -0500
          Re: Creating a new stack from an exisiting one. Jeff Higgins <jeff@invalid.invalid> - 2012-11-04 19:40 -0500
  Re: Creating a new stack from an exisiting one. Lew <lewbloch@gmail.com> - 2012-11-03 16:02 -0700

csiph-web