On Apr 9, 5:41 am,
an...@mips.complang.tuwien.ac.at (Anton Ertl)
wrote:
> "Elizabeth D. Rather" <
erat...@forth.com> writes:
>
> >>>>> Back in the day, FORTH, Inc. ITC
> >>>>> Forths were as much as 10x faster than FigForths on the same processor.
>
> >> The second coming of Jeff Fox? Please name the processor and the
> >> benchmark. I remember you claiming that fig-Forth's NEXT contained
> >> subroutine calls, which is false.
>
> >It was an 80's PC. Someone wrote an article in Byte claiming a "faster
> >NEXT" for the PC. It cut the "standard" FigForth NEXT from 12
> >instructions to about 8. FORTH, Inc's was 2. So we ran some more
> >benchmarks at that time.
>
> Here are the number of instructions in fig-Forth's NEXT for a number of
> CPUs:
>
> 12 6502
> 8 6800
> 11 8085
> 11 Z80
> 2 6809
> 5 8086
> 2 PDP-11
>
> So presumably you had a 2-instruction ITC NEXT on the 6502. I don't
> think that's possible, but if it is, I would be highly interested to see
> that.
A 2-instruction NEXT on the 6502? That is just more of Elizabeth
Rather's baloney. Considering that the 6502 had 8-bit registers, and
the xt is 16-bit, the 6502 was really the worst possible candidate for
a threaded Forth system (that is why it has the most-expensive NEXT in
your list above).
I also used a language called Promal, that was similar to Pascal, and
it had a pretty short NEXT --- it accomplished this by having only 128
primitives and an 8-bit xt. I don't remember how Promal worked
(although I did buy the complete source-code at the time). If I were
to write something like that now, I would do this:
macro next
{
lda (ip),y
iny
tax
jmp (table,x)
}
This requires every threaded word to fit inside of a page, so the
upper byte of IP never rolls over (the users won't be allowed to write
lengthy words, and if they write a lot of short words they will waste
memory, but if their words are all slightly less than 256 bytes long
then they are doing well). I would just encourage everybody to write
short words, and then I would automatically macro-expand sub-words as
necessary to fill out words so they are just short of the 256 byte
boundary. Also, I would have a few primitives that do a second jump
through another table --- this way I can have many hundreds of words
(secondaries) written in assembly language, although less than 128 of
them (the primitives) would be fast.
I did write a 65c02 cross-compiler, and it was STC --- so NEXT was a
JSR --- one instruction (3 bytes, compared to 2 bytes for a threaded
system). That was a lot less complicated, and a lot faster, and it
required only a little bit more memory.
Mine was derived from ISYS Forth for the Apple-II. The clever part was
the use of a split parameter stack. The low bytes were in one stack,
and the high bytes were in another stack. The two stacks were $40
bytes apart. I could address the low byte of the TOS with $0,x and the
high byte of the TOS with $40,x. DROP compiled into a single INX
instruction. I could make room on the stack for a new datum with a
single DEX instruction. Also, I had a peephole-optimizer that removed
INX DEX pairs, and also converted a JSR followed by a RTS into a
single JMP. There may have been some other minor optimizations as well
--- it was pretty simple, but it generated code that was better than
any commercial Forth or C system.
The guy who wrote ISYS Forth was pretty smart! There were a lot of
smart people doing innovative work with Forth in the 1980s. Elizabeth
Rather wasn't one of them. There was nothing innovative coming out of
Forth Inc. --- Forth Inc. largely ruined Forth's reputation with their
grossly inefficient systems.
Nowadays there are a lot of people with their own Forth, which they
claim to have written themselves. Almost all of these are just warmed
over cadavers of 1970s-vintage Forths. Win32Forth and CIForth are two
examples. SwiftForth is also, as Forth Inc. has just been keeping
Chuck Moore's old work running all of these years, porting it to new
processors, but not adding anything significant --- the Forth world is
like that movie, "Frankenweenie," in which the kid had to periodically
jolt his dead dog with electricity to get it to go again, and also sew
body parts back on that had fallen off due to wear and tear. There are
quite a lot of Forth "experts" (mad-scientist types) who have managed
to get an old Forth system to work on modern hardware and have
exclaimed: "Its alive! Its alive!"
I'm writing CAMForth from scratch though --- it is not derived from
anything --- doing it this way is a lot more time-consuming, but it
will be something that I can call my own. My programming in Forth is
motivated almost entirely by the desire to have something that I can
be proud of.