> "Jenny Brien" <jennybrien@[EMAIL PROTECTED]
> wrote in message
news:5b263ec7-3ae3-4c0c-b123-b9eab109e191@[EMAIL PROTECTED]
> On Jan 8, 3:57 am, "Rod Pemberton" <do_not_h...@[EMAIL PROTECTED]
> wrote:
>
> > Oddly, I see no discussion of this paper or his FORTH words in the
archives
> > of c.l.f. (?!?!) Or, on usenet in general...
> >
>
> Interesting, but limited to two stack items.
Yes, I'm looking for a single stack (just data, no rstack) implementation
of
FORTH style stack operators. SWAP was the original problem, but ROT seems
to be the problem now. Koopman's Dynamic Instruction Frequencies (which
is
a bit out of date today...) shows DUP, ROT, SWAP as high usage with SWAP
as
the highest. I'm assuming Koopman's >R and R> are components of other
stack
operator words.
With zero registers (all stack), SWAP is relatively expensive for x86.
With
two registers for the top two stack items, all operations seem fairly well
balanced and seem to have good pairing. Instruction pairing on x86 should
get a SWAP operation to 1.5 cycles using 2 stack items in registers,
versus
7 cycles with no registers, since the x86 XCHG instruction can't be paired
and (like other x86 instructions) doesn't work memory-to-memory.
> There is, for example, no way to make ROT.
> For a complete set of operators you also need to be
> able to push and pop between both registers and the rstack.
Yes, you're correct. With Chapman's solution, SWAP is fast but ROT is
unimplemenable without an "rstack". The key feature of his solution is
the
elimination of the rstack for "most" operators. ROT apparently wasn't
presented because it (and probably -ROT,ROLL) needs a single tem****ary
location, i.e., >R, R>. The tem****ary location happens to be on the
rstack
for FORTH, but could be an available register or memory location for
x86...
Since I like the other perceived advantages, a pure x86 solution for ROT
might be the best choice.
> For a complete set of operators you also need to be
> able to push and pop between both registers and the rstack.
What do you consider "a complete set of operators"? Or, a good set of
FORTH
stack operators?
> For a complete set of operators you also need to be
> able to push and pop ...[to] the rstack.
If you know of some other common operation(s) that requires R> and >R
besides the ones mentioned, let me know.
> For a complete set of operators
DUP,DROP,SWAP,OVER,NIP and TUCK were presented in the article. Isn't ROT
(or -ROT, ROLL) the only one really missing?
My own experiments with the java app in my first post showed many common
FORTH stack operators, including the 2DUP, 2DROP, etc. can be reduced to
either 1) combinations of DUP,DROP and one of ROT,-ROT,ROLL, 2) native x86
instructions or 3) instructions using >R and R> for a single location on
the
rstack. A few could be written using multiple items on the rstack
(inefficient...). E.g., this abomination for ROT:
:ROT >R OVER R> OVER >R >R DROP >R DROP R> R> R>;
Anyway, it appeared that set 3) seemed to completely overlap 1) and 2)
except for SWAP which needed >R and R>. With the two top stack items in
registers, AFAICT, no rstack (>R and R>) are needed for most of the common
operations, except those that require a stack ****ft: ROT,-ROT,ROLL, and
those only need a single tem****ary location (>R and >R), not a full stack
(rstack).
Except for the issue with ROT, I like Chapman's solution. It comes the
closest to many features I desire, although it comes with the price of
consuming two more registers...
Rod Pemberton


|
53 Posts in Topic:
|
"Rod Pemberton" |
2008-01-06 00:26:01 |
|
mhx@[EMAIL PROTECTED]
(M |
2008-01-06 09:22:17 |
|
"Rod Pemberton" |
2008-01-06 04:37:47 |
|
mhx@[EMAIL PROTECTED]
(M |
2008-01-06 11:00:53 |
|
"Rod Pemberton" |
2008-01-06 06:10:48 |
|
"Rod Pemberton" |
2008-01-06 06:24:17 |
|
mhx@[EMAIL PROTECTED]
(M |
2008-01-06 12:58:34 |
|
foxchip <fox@[EMAIL PR |
2008-01-06 08:27:20 |
|
Coos Haak <chforth@[EM |
2008-01-06 21:16:07 |
|
"Ed" <nospam |
2008-01-07 17:51:08 |
|
Albert van der Horst < |
2008-01-07 17:22:03 |
|
foxchip <fox@[EMAIL PR |
2008-01-06 13:00:32 |
|
none <""jan\ |
2008-01-06 14:07:31 |
|
mhx@[EMAIL PROTECTED]
(M |
2008-01-06 15:27:04 |
|
foxchip <fox@[EMAIL PR |
2008-01-06 08:32:53 |
|
foxchip <fox@[EMAIL PR |
2008-01-06 08:05:30 |
|
stephenXXX@[EMAIL PROTECT |
2008-01-06 13:42:55 |
|
"Rod Pemberton" |
2008-01-06 06:09:25 |
|
stephenXXX@[EMAIL PROTECT |
2008-01-06 13:46:06 |
|
"Rod Pemberton" |
2008-01-06 18:25:08 |
|
stephenXXX@[EMAIL PROTECT |
2008-01-07 10:58:44 |
|
"Rod Pemberton" |
2008-01-07 21:39:25 |
|
"Rod Pemberton" |
2008-01-07 22:57:58 |
|
Albert van der Horst < |
2008-01-08 08:13:03 |
|
"Rod Pemberton" |
2008-01-08 05:07:03 |
|
Albert van der Horst < |
2008-01-08 18:26:32 |
|
Alex McDonald <blog@[E |
2008-01-08 03:04:52 |
|
Roelf Toxopeus <these3 |
2008-01-06 15:24:29 |
|
winston19842005 <bjjly |
2008-01-06 10:13:11 |
|
foxchip <fox@[EMAIL PR |
2008-01-06 08:01:26 |
|
foxchip <fox@[EMAIL PR |
2008-01-06 08:52:02 |
|
foxchip <fox@[EMAIL PR |
2008-01-06 08:54:01 |
|
Bernd Paysan <bernd.pa |
2008-01-06 18:34:43 |
|
helmwo@[EMAIL PROTECTED]
|
2008-01-06 10:27:48 |
|
foxchip <fox@[EMAIL PR |
2008-01-06 13:26:05 |
|
Bernd Paysan <bernd.pa |
2008-01-06 23:02:25 |
|
kenney@[EMAIL PROTECTED]
|
2008-01-07 09:47:13 |
|
foxchip <fox@[EMAIL PR |
2008-01-06 13:43:00 |
|
Jenny Brien <jennybrie |
2008-01-08 14:06:38 |
|
Bill <bill@[EMAIL PROT |
2008-01-08 21:20:47 |
|
"Rod Pemberton" |
2008-01-09 04:57:34 |
|
Jenny Brien <jennybrie |
2008-01-10 09:50:29 |
|
"Rod Pemberton" |
2008-01-11 03:34:02 |
|
"Jenny Brien" & |
2008-01-11 17:49:07 |
|
"Rod Pemberton" |
2008-01-12 04:31:21 |
|
astrobe <fdubois76@[EM |
2008-01-14 09:31:33 |
|
foxchip <fox@[EMAIL PR |
2008-01-19 10:11:10 |
|
stephenXXX@[EMAIL PROTECT |
2008-01-20 15:33:32 |
|
ygrek <ygrek@[EMAIL PR |
2008-01-06 12:31:47 |
|
"Rod Pemberton" |
2008-01-06 17:58:45 |
|
anton@[EMAIL PROTECTED]
|
2008-01-06 18:22:00 |
|
"Rod Pemberton" |
2008-01-06 18:18:56 |
|
ygrek <ygrek@[EMAIL PR |
2008-01-07 09:05:18 |
|