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


Groups > comp.lang.forth > #41532

Re: Registers..

Path csiph.com!eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail
From "Rod Pemberton" <boo@fasdfrewar.cdm>
Newsgroups comp.lang.forth
Subject Re: Registers..
Date Tue, 25 Aug 2015 22:32:28 -0400
Organization Aioe.org NNTP Server
Lines 53
Message-ID <op.x3yeoeaqyfako5@localhost> (permalink)
References <cd067e03-cb33-41ff-aaf1-6b770ae946aa@googlegroups.com>
NNTP-Posting-Host n4wpt9zq8xR26Ttf9mo2BA.user.speranza.aioe.org
Mime-Version 1.0
Content-Type text/plain; charset=iso-8859-1; format=flowed; delsp=yes
Content-Transfer-Encoding 7bit
X-Complaints-To abuse@aioe.org
User-Agent Opera Mail/12.16 (Linux)
X-Notice Filtered by postfilter v. 0.8.2
Xref csiph.com comp.lang.forth:41532

Show key headers only | View raw


On Tue, 25 Aug 2015 16:35:43 -0400, Mux <Yvo.Zoer@gmail.com> wrote:

> In sort of a follow up on my previous question (machine-forth
> != forth?) how do fine people feel about registers?

I've programmed a few assembly languages and many high level
languages.  So, I feel fine with them.  How about you?  ...

> Particularly curious about having one or more address registers.

Oh, you meant registers in Forth ...  We'll call you "Mr. Vague."
:-)

Charles Moore used a temporary register in his Machine Forth called
the 'a' register.  The ability to move one stack or one return
stack item out of the way of a stack sequence or stack operation
can be useful, especially when implementing Forth system words
and using an interpreted Forth.

Some Forths keep the first and sometimes the second stack item in
registers.  These were known as TOS as top-of-stack and NOS as
next-on-stack, or somesuch ...  Someone with more in-depth Forth
history should be able to clarify.

The problem with stack items in registers is that the stack
implementation is split between a register or two and an actual
stack.  So, stack operations can be become more complicated
to implement, i.e., longer, slower.  E.g., think SWAP with one
item in register and the next on the stack.  Compare with both
items in register and both items on stack.  Even if two items
are in registers, this split-stack can affect other stack
operations that cross the boundary, e.g., ROT, ROLL, or which
add or remove stack items, e.g., DROP, DUP.  However, having
one or two stack items in register can allow for faster
fetch @ and store ! operations.  Since Forth uses many of these
to perform it's tasks, this may be advantageous enough to be
worthwhile even with the extra overhead added to stack
manipulation words.  I don't recall seeing any specific timing
data on one method versus the other.  If you trace your Forth
words, you could simply perform a count of how many @ and !
there are versus other stack words, DROP DUP SWAP OVER R> >R .
If @ and ! vastly outnumber the other words, then having TOS
and NOS in register would be advantageous.

You can also look at Rob Chapman's Stack Quarks for more insight
into this issue.


Rod Pemberton

--
Scientists now say we'll experience a mini-ice age in 2030.
So, I guess we need more global warming today ...

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