Direction of Stack Growth - DSP

This is a discussion on Direction of Stack Growth - DSP ; On Tue, 23 Oct 2007 12:57:31 -0800, glen herrmannsfeldt <gah@ugcs.caltech.edu> wrote: >Note that S/360 was implemented on processors with an eight >bit ALU and eight bit addressable memory (the 360/30), yet they >went for big-endian. It is just a small ...

+ Reply to Thread
Page 13 of 18 FirstFirst ... 3 11 12 13 14 15 ... LastLast
Results 121 to 130 of 174

Direction of Stack Growth

  1. Default Re: Direction of Stack Growth

    On Tue, 23 Oct 2007 12:57:31 -0800, glen herrmannsfeldt
    <gah@ugcs.caltech.edu> wrote:

    >Note that S/360 was implemented on processors with an eight
    >bit ALU and eight bit addressable memory (the 360/30), yet they
    >went for big-endian. It is just a small change in the
    >microcode when addressing memory. (Especially if you
    >don't allow unaligned access.)


    While one or two exclusive-or gates on the LSBit line(s) would be
    sufficient to perform the out of order fetch if unaligned access is
    not allowed, the thing gets nasty, if unaligned access if allowed.

    Assuming variable length instructions from 1 up to N bytes long
    (including immediate data or offsets/addresses) the constant can be on
    any byte border and hence a full adder would have to be used to
    perform the out of sequence fetch. Alternatively stepping the PC
    rapidly in increments of one and store all the intermediate results in
    temporary registers, until the PC has reached the last byte of the
    constant, before the address of the LSByte is sent out, followed by
    addresses stored in the temporary registers to access the MSbyte(s).

    Paul


  2. Default Re: Direction of Stack Growth

    On Tue, 23 Oct 2007 17:21:21 -0400, Jerry Avins <jya@ieee.org> wrote:

    >karthikbalaguru wrote:
    >
    > ...
    >
    >> Reading through this and thinking about heap mechanism. I got some
    >> query.
    >> Why do we need the stack as the heap appears flexible ?

    >
    >Manipulating a heap requires software. Some stacks are implemented
    >entirely in hardware (PUSH, POP; CALL, RETURN). It would be very hard to
    >create or maintain a heap on a machine with no stack.


    The stack simplifies many things, such as re-entrancy. There have been
    architectures without an ordinary stack mechanism as the IBM S/360
    mentioned in other posts. The TI TMS9900 had all the general purpose
    registers in the RAM and starting a subroutine could use a new
    register set, which included a link to the previous register set so
    you knew how to return.

    In the 1960's for instance the DDP516 (later Honeywell) stored the
    return address at the first word of the subroutine and the actual
    subroutine code started at the next word. To return from the
    subroutine, an indirect jump was performed through the first word of
    the routine (which now contained the return address). This required
    that the code space was writable and the routine was not re-entrant,
    so recursion had to implemented in different way 8if ever used those
    days).

    Paul


  3. Default Re: Direction of Stack Growth

    > Why do we need the stack as the heap appears flexible ?
    >

    A heap needs addresses, Variables om a stack is can be addressed
    automatically (e.g. with 1 byte commands on an x86).

    -Michael

  4. Default Re: Direction of Stack Growth


    In article <ccrth3d405s6q5r7moev12730d3i2dnrf4@4ax.com>,
    Paul Keinanen <keinanen@sci.fi> writes:
    |> On Tue, 23 Oct 2007 17:21:21 -0400, Jerry Avins <jya@ieee.org> wrote:
    |> >karthikbalaguru wrote:
    |> >
    |> >> Reading through this and thinking about heap mechanism. I got some
    |> >> query.
    |> >> Why do we need the stack as the heap appears flexible ?
    |> >
    |> >Manipulating a heap requires software. Some stacks are implemented
    |> >entirely in hardware (PUSH, POP; CALL, RETURN). It would be very hard to
    |> >create or maintain a heap on a machine with no stack.
    |>
    |> The stack simplifies many things, such as re-entrancy. There have been
    |> architectures without an ordinary stack mechanism as the IBM S/360
    |> mentioned in other posts. ...

    Not just that. During my spells at IBM, I tried very hard to persuade
    the Fortran people that using a stack would IMPROVE performance, based
    on my experiences on the System/370 with many languages.

    They were wedded to static allocation, because it enabled many of the
    address constants to be calculated by the compiler, which also eased
    pressure on the registers. This was Fortran 77, of course, and didn't
    support reentrancy. That argument is a good one, but I was arguing
    that the better locality properties of a stack gave MORE of a gain.

    As some people know, I have been banging on about double stacks for
    years. I first encountered them in Algol 68, was suspicious, but
    discovered that they need negligible extra code, stack space and
    register use, and vastly improve locality. Now, in these days of
    90% of performance being due to cachability, why does nobody pick
    them up again?

    It's insane.


    Regards,
    Nick Maclaren.

  5. Default Re: Direction of Stack Growth

    Nick Maclaren wrote:

    > As some people know, I have been banging on about double stacks for
    > years. I first encountered them in Algol 68, was suspicious, but
    > discovered that they need negligible extra code, stack space and
    > register use, and vastly improve locality. Now, in these days of
    > 90% of performance being due to cachability, why does nobody pick
    > them up again?


    If I've understood the "double stack" method correctly, it is like
    the "secondary stack" method that is used in some current Ada
    compilers, including the GNU Ada compiler GNAT, to manage
    dynamically sized stack-allocated objects.

    --
    Niklas Holsti
    Tidorum Ltd
    niklas holsti tidorum fi
    . @ .

  6. Default Re: Direction of Stack Growth


    In article <471f03bc$0$3501$39db0f71@news.song.fi>,
    Niklas Holsti <niklas.holsti@tidorum.invalid> writes:
    |>
    |> > As some people know, I have been banging on about double stacks for
    |> > years. I first encountered them in Algol 68, was suspicious, but
    |> > discovered that they need negligible extra code, stack space and
    |> > register use, and vastly improve locality. Now, in these days of
    |> > 90% of performance being due to cachability, why does nobody pick
    |> > them up again?
    |>
    |> If I've understood the "double stack" method correctly, it is like
    |> the "secondary stack" method that is used in some current Ada
    |> compilers, including the GNU Ada compiler GNAT, to manage
    |> dynamically sized stack-allocated objects.

    Yes, it is. I had forgotten about those. Thanks for the correction.
    The "nobody" should be "nobody except the Ada community"!


    Regards,
    Nick Maclaren.

  7. Default Re: Direction of Stack Growth

    Nick Maclaren wrote:

    ...

    > As some people know, I have been banging on about double stacks for
    > years. I first encountered them in Algol 68, was suspicious, but
    > discovered that they need negligible extra code, stack space and
    > register use, and vastly improve locality. Now, in these days of
    > 90% of performance being due to cachability, why does nobody pick
    > them up again?
    >
    > It's insane.


    Ayup! The Forths I use have three stacks.

    Jerry
    --
    Engineering is the art of making what you want from things you can get.
    ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

  8. Default Re: Direction of Stack Growth


    In article <_uGdnTqXWaEPHYLanZ2dnUVZ_hWdnZ2d@rcn.net>,
    Jerry Avins <jya@ieee.org> writes:
    |>
    |> > As some people know, I have been banging on about double stacks for
    |> > years. I first encountered them in Algol 68, was suspicious, but
    |> > discovered that they need negligible extra code, stack space and
    |> > register use, and vastly improve locality. Now, in these days of
    |> > 90% of performance being due to cachability, why does nobody pick
    |> > them up again?
    |> >
    |> > It's insane.
    |>
    |> Ayup! The Forths I use have three stacks.

    Up, down and sideways? I always knew that Forth was a bizarre
    language :-)


    Regards,
    Nick Maclaren.

  9. Default Re: Direction of Stack Growth

    nmm1@cus.cam.ac.uk (Nick Maclaren) writes:
    > Niklas Holsti <niklas.holsti@tidorum.invalid> writes:
    > |>
    > |> > As some people know, I have been banging on about double stacks for
    > |> > years. I first encountered them in Algol 68, was suspicious, but
    > |> > discovered that they need negligible extra code, stack space and
    > |> > register use, and vastly improve locality. Now, in these days of
    > |> > 90% of performance being due to cachability, why does nobody pick
    > |> > them up again?
    > |>
    > |> If I've understood the "double stack" method correctly, it is like
    > |> the "secondary stack" method that is used in some current Ada
    > |> compilers, including the GNU Ada compiler GNAT, to manage
    > |> dynamically sized stack-allocated objects.
    >
    > Yes, it is. I had forgotten about those. Thanks for the correction.
    > The "nobody" should be "nobody except the Ada community"!


    If you're talking about separate stacks for return addresses and data,
    there are C compilers extant using that method under the hood.

    While on the subject of return addresses, isn't the ARM a throwback
    to the old BALR days? It's granted that you can save a push operation
    for leaf functions, but otherwise you spend the same or more operations
    saving the return address than just having the hardware do it
    automagically.

  10. Default Re: Direction of Stack Growth


    In article <20071024.7937158.8D09@mojaveg.lsan.mdsg-pacwest.com>,
    mojaveg@mojaveg.lsan.mdsg-pacwest.com (Everett M. Greene) writes:
    |> nmm1@cus.cam.ac.uk (Nick Maclaren) writes:
    |> > Niklas Holsti <niklas.holsti@tidorum.invalid> writes:
    |> > |>
    |> > |> > As some people know, I have been banging on about double stacks for
    |> > |> > years. I first encountered them in Algol 68, was suspicious, but
    |> > |> > discovered that they need negligible extra code, stack space and
    |> > |> > register use, and vastly improve locality. Now, in these days of
    |> > |> > 90% of performance being due to cachability, why does nobody pick
    |> > |> > them up again?
    |> > |>
    |> > |> If I've understood the "double stack" method correctly, it is like
    |> > |> the "secondary stack" method that is used in some current Ada
    |> > |> compilers, including the GNU Ada compiler GNAT, to manage
    |> > |> dynamically sized stack-allocated objects.
    |> >
    |> > Yes, it is. I had forgotten about those. Thanks for the correction.
    |> > The "nobody" should be "nobody except the Ada community"!
    |>
    |> If you're talking about separate stacks for return addresses and data,
    |> there are C compilers extant using that method under the hood.

    No, we aren't. The method isn't much use for C89 or C++, but is
    for C99.


    Regards,
    Nick Maclaren.

+ Reply to Thread
Page 13 of 18 FirstFirst ... 3 11 12 13 14 15 ... LastLast

Similar Threads

  1. Optimizing stack access for a stack based VM
    By Application Development in forum Compilers
    Replies: 11
    Last Post: 10-01-2007, 10:15 AM
  2. Why stack overflow with such a small stack?
    By Application Development in forum RUBY
    Replies: 8
    Last Post: 08-31-2007, 11:21 PM
  3. How to push a stack on a stack without passing by value?
    By Application Development in forum c++
    Replies: 10
    Last Post: 05-21-2007, 12:00 AM
  4. Thread stack (not call stack)
    By Application Development in forum DOTNET
    Replies: 5
    Last Post: 07-14-2006, 04:19 PM
  5. Framed Stack vs. Two Stack Architecture
    By Application Development in forum Compilers
    Replies: 11
    Last Post: 05-03-2006, 07:02 PM