Charles Moore: From Forth to Stack Processors and Beyond (2013)
cpushack.com
cpushack.com
https://www.youtube.com/watch?v=SASQMl0rvYg
The sound is terrible at the beginning, it gets a little bit better later on. You can watch his demo if you want more details:
C started as a language that was designed to take advantage of an existing processor to produce fast code. That has worked spectacularly.
It seems, however, going the other way by first designing a language and then making a processor to make it fast does not work out. Other examples are the Lisp Machines and Java Processors.
Java processors, I'm still not sure what the target market there was. It's easy to imagine at least an academic market for lisp machines, particularly during the 1980s and perhaps the early 1990s. But, particularly in a post-1995 software environment, it's hard to imagine a large-scale (as in, not embedded) computing project that can reasonably commit itself to Java, and it's also hard for me to imagine an embedded application where Java would be preferable to a low-level language. Which is also more of an economic problem - they might have worked really well from a technical perspective, but that doesn't mean they weren't a solution in search of a problem.
I believe that the challenge of Forth is not to learn it, but to unlearn the rest. It is difficult to forget what you know. It's difficult to forget about dynamic memory allocation, classes, local variables, type checking... And frustrating too.
It's like video games. When I was a kid/teen, I could do over and over again a level until I succeeded. Not today. I would lose patience and bitch about the poor game/level design because I think I know better. I am more often wrong than right on this.
Adult programmers and engineers are like that. They think they know better, so when something is difficult for them, they blame it on the language. They don't have the really open mind kids have. If there's a barrier to entry, it is not in Forth.
Hey, an economic failure's a failure. The technically perfect machine that doesn't exist because no market would buy it... doesn't exist.
At any rate, what we run these days are for all practical purposes C machines...
RISCs are very good C processors, but it is possible to do even better: https://en.wikipedia.org/wiki/AT%26T_Hobbit
But it's more specifically focused on virtual machines than physical hardware.
If you examine any stack language code, you should consider any stack manipulation to be a NOP type of inefficiency. And when a virtual stack machine is implemented on non-stack hardware, these inefficiencies are compounded.
We've switched to RISC (despite the above I'm a big fan have built several) these days largely because there came a point where we could push everything onto a chip, RISC started to make sense at about the time where cache went on-chip (or was SRAM closely coupled to a single die) - and for the record I think x86 has survived because its ISA was the most RISCy of it's original stable-mates (68k, 32k, z8k etc) - x86 instructions make at most 1 memory access (with one exception) with simple operands
Stack machines made more sense when memory was limited (small opcodes) and there were no hardware multiplies, but these days they make no sense.
I don't understand all the vague nostalgia for something that never could have panned out outside of the creaky old Apollo flight computer or something.
I'd kinda like to see a machine with a intermediate, one-operand style of instructions. Eg:
add tos stN # *sp += sp[N]
add stN pop # sp[N] += *sp++
ld [stN] # *--sp = mem[sp[N]]http://users.ece.cmu.edu/~koopman/stack_computers/index.html
My memory of the conclusion is that register machines are a bit faster for general programs. Stack machines are better in some special niches. (High volume/rapid Interrupt handling comes to mind)
I should read the book again myself...
That was a great deal for only 35$.
The only option now is to buy the evaluation board for close to 500$ or 10 chips for 200$ and do QFN soldering which can be a PITA.
[1] https://schmartboard.com/schmartboard-ez-qfn-88-pins-0-4mm-p...