On Jan 8, 8:13 am, Albert van der Horst <alb...@[EMAIL PROTECTED]
>
wrote:
> In article <flus86$36...@[EMAIL PROTECTED]
>,
>
>
>
> Rod Pemberton <do_not_h...@[EMAIL PROTECTED]
> wrote:
>
> >"Stephen Pelc" <stephen...@[EMAIL PROTECTED]
> wrote in message
> >news:478201e9.1788292609@[EMAIL PROTECTED]
> >> For Forth to Forth translation look at Timbre by Rob Chapman. Others
> >> have used it for host and embedded compilation.
>
> >Actually, you may have referred me to the works of the correct person.
It
> >appears that Rob Chapman's "Stack Quarks" Sept. 15, 1995 are the
solution to
> >optimizing FORTH stack words for x86 assembly. He defines six words:
>
> > DIP DRIP NUP NIP TUCK TAKE
>
> >Each of these corresponds 1:1 to x86 assembly instructions, as the C
> >versions in "Script.3" shows, i.e., they correspond to mov, push, or
pop.
>
> Interesting idea!
Only if your data stack is the machine stack (SP or ESP). The NCC/STC
development version of Win32Forth uses the stack as the rstack, and
the data stack is emulated on EBP. The overhead is non-existent impact
to better performance, as PUSH/POP often take longer than explicit EBP
based operations. The downside is code size; PUSH and POP are very
short instructions. Not using the ESP based stack as a data stack also
allows calls to Windows APIs without requiring stack-switching or
explicitly stating the number of parameters to be passed. For
Win32Forth, with its dependence on lots of different API calls, that
simplifies things enormously.
>
> >NIP and TUCK appear to be the standard definitions. DROP, DUP, SWAP,
OVER,
> >are defined in terms of the six. I don't see definitions for ROT, or
-ROT.
> >From the article, it seems he has/had a Timbre script for converting
FORTH
> >stack instructions similar to the java app. The results using that app
> >showed that DUP,DROP,OVER correspond 1:1 to x86 assembly, but that
SWAP, or
> >another stack ****ft instruction (ROT,-ROT,ROLL) was im****tant.
Relocating
> >the physical stack from location 0 to 2 of the virtual stack does
wonders...
>
> Isn't that dangerous in the situation of the x86 where the stack is
> used by interrupts too?
No, the registers are saved/restored across interrupts. The x86 chip
also provides OS sup****t for floating point save; if a task doesn't
use the FP regs, then the OS can choose not to save them, reducing
task switch time.
It's quite common to buffer TOS in a register; Win32Forth (ITC) does
it for the top stack entry and Anton Ertl has a paper somewhere on his
site on the performance implications of caching none to several of the
stack entries. I seem to remember that more than 2 gave very little,
if any, performance advantage. There's also the downside of stack
underflow; it's more difficult to detect with stack entries in
registers, and for Win32Forth, caching one register simplifies the
interfacing to the Windows API. Caching lots of registers requires
more saves and restores across CALL boundaries.
>
>
>
>
>http://www.compusmart.ab.ca/rc/Timbre/ContentPages/Timbre/SQP/StackQu...
>
> >Oddly, I see no discussion of this paper or his FORTH words in the
archives
> >of c.l.f. (?!?!) Or, on usenet in general...
>
> >Rod Pemberton
>
> Groetjes Albert
>
> --
> --
> Albert van der Horst, UTRECHT,THE NETHERLANDS
> Economic growth -- like all pyramid schemes -- ultimately falters.
> albert@[EMAIL PROTECTED]
&=nhttp://home.hccnet.nl/a.w.m.van.der.horst
--
Regards
Alex McDonald


|
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 |
|