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


Groups > comp.lang.forth > #41546

Re: Registers..

From anton@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups comp.lang.forth
Subject Re: Registers..
Date 2015-08-26 08:06 +0000
Organization Institut fuer Computersprachen, Technische Universitaet Wien
Message-ID <2015Aug26.100649@mips.complang.tuwien.ac.at> (permalink)
References <cd067e03-cb33-41ff-aaf1-6b770ae946aa@googlegroups.com>

Show all headers | View raw


Mux <Yvo.Zoer@gmail.com> writes:
>In sort of a follow up on my previous question (machine-forth !=3D forth?) =
>how do fine people feel about registers? Particularly curious about having =
>one or more address registers.

With registers, you always have to worry about whether they are
caller-saved, callee-saved, used as parameters or return values.  The
stack provides a nice abstraction from these worries nonsense; if the
stack is too limited (requires too much stack juggling), then locals
are a solution that does not have the problems of registers and are
therefore preferable.

That's the programming POV.  From a hardware POV, the address
registers of Chuck Moore's recent chips allow to write stuff like MOVE
efficiently at little hardware cost that would be written in CODE in
Forths on other hardware, so implementing it in hardware is ok.  But I
think exposing it as a feature for higher-level programming makes
programming harder.

Hmm, if we want address thingies for the programmers, we could turn
the address registers into address stacks; the return stack is already
a stack, so only the A register would be turned into a stack.  That
would solve the saving issues; for parameters one could have the
convention that addresses are passed on the A stack.  One would
probably need to add ADUP ASWAP etc.  Are the benefits worth the
costs, or should we better stick with the data stack for passing
addresses around?

The A stack and D stack would be the stack machine equivalence of the
68000's A and D registers: a generalization of the 6800's index (X)
and accumulator (A); in contrast, standard Forth's data stack is the
stack equialent of the general-purpose registers of the PDP-11.

>While it makes things easier in the sense that memory instructions become m=
>ore atomic, it strays away from the fact that you're now encroaching into t=
>he realm of register based machines IMO.

So what?  Purity is for gurus.

- anton
-- 
M. Anton Ertl  http://www.complang.tuwien.ac.at/anton/home.html
comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
     New standard: http://www.forth200x.org/forth200x.html
   EuroForth 2015: http://www.rigwit.co.uk/EuroForth2015/

Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Registers.. Mux <Yvo.Zoer@gmail.com> - 2015-08-25 13:35 -0700
  Registers.. Mark Wills <markwills1970@gmail.com> - 2015-08-25 15:20 -0700
    Re: Registers.. Mux <Yvo.Zoer@gmail.com> - 2015-08-25 16:19 -0700
      Re: Registers.. "Elizabeth D. Rather" <erather@forth.com> - 2015-08-25 14:54 -1000
      Re: Registers.. rickman <gnuarm@gmail.com> - 2015-08-26 00:37 -0400
      Re: Registers.. Mat <dambere@web.de> - 2015-08-26 02:35 -0700
      Re: Registers.. hughaguilar96@gmail.com - 2015-08-26 10:24 -0700
        Re: Registers.. rickman <gnuarm@gmail.com> - 2015-08-26 23:56 -0400
    Re: Registers.. rickman <gnuarm@gmail.com> - 2015-08-26 00:35 -0400
  Re: Registers.. "Rod Pemberton" <boo@fasdfrewar.cdm> - 2015-08-25 22:32 -0400
    Re: Registers.. Mux <Yvo.Zoer@gmail.com> - 2015-08-25 19:58 -0700
      Re: Registers.. rickman <gnuarm@gmail.com> - 2015-08-26 00:43 -0400
  Re: Registers.. anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-08-26 08:06 +0000
    Re: Registers.. Mux <Yvo.Zoer@gmail.com> - 2015-08-26 07:36 -0700
  Re: Registers.. Mat <dambere@web.de> - 2015-08-26 02:07 -0700
    Re: Registers.. rickman <gnuarm@gmail.com> - 2015-08-26 09:58 -0400
      Re: Registers.. Mat <dambere@web.de> - 2015-08-26 13:50 -0700
        Re: Registers.. rickman <gnuarm@gmail.com> - 2015-08-27 00:13 -0400
          Re: Registers.. Mat <dambere@web.de> - 2015-08-29 02:30 -0700
            Re: Registers.. rickman <gnuarm@gmail.com> - 2015-08-29 09:29 -0400
              Re: Registers.. Mat <dambere@web.de> - 2015-08-29 12:50 -0700
                Re: Registers.. rickman <gnuarm@gmail.com> - 2015-08-30 11:13 -0400
                Re: Registers.. Mat <dambere@web.de> - 2015-08-30 09:19 -0700
                Re: Registers.. rickman <gnuarm@gmail.com> - 2015-08-30 15:44 -0400
                Re: Registers.. hughaguilar96@gmail.com - 2015-08-30 14:06 -0700
                Re: Registers.. Greg <abiforth@gmail.com> - 2015-08-30 21:07 -0700
                Re: Registers.. Mat <dambere@web.de> - 2015-08-31 01:51 -0700
                Re: Registers.. "Alex McDonald" <blog@rivadpm.com> - 2015-09-01 09:23 +0100
                Re: Registers.. Mat <dambere@web.de> - 2015-08-30 10:08 -0700
                Re: Registers.. rickman <gnuarm@gmail.com> - 2015-08-30 16:01 -0400

csiph-web