It's done in hardware so it's cheap (2012)
yosefk.com
yosefk.com
Growing segments from 64KB to 4GB was enough to allow the 386 to finally run the same C software as other processors like the VAX or 68000.
Yosef must be using a different definition of RISC from Jim Keller, because in Jim’s interviews he says that modern ARM is essentially a CISC processor.
Today's machines aren't CISC or RISC internally - they're ginormous out-of-order execution engines doing stuff that really can't be expressed in a linear machine language, and if there's an overhead for CISC, it's a tiny additional amount of real estate per core. Note that this is not a constant factor - as the rest of the CPU gets more complex, any CISC-related overhead becomes a smaller and smaller fraction of the whole. You can probably take the same set of execution units, forwarding paths, branch predictors, etc. and slap several different ISAs over it - I've seen CPU architects show experiments where (for x86 and ARM at least) two chips with the same number and type of these internal features will perform the same regardless of the instruction set.
There are a lot of factors involved other than the now-tiny technical advantage of RISC. There's a strong business incentive for the largest CPU design team in the world (i.e. Intel) to continue to produce x86 CPUs, rather than switching to another ISA. (for that matter, they tried once, with Itanic^H^H^HItanium, and it didn't work out so well)
Ecosystem effects mean that CPUs with non-dominant ISAs incur a bunch of various costs for their users, because everything from software through hardware just gets harder when you're not on the dominant commodity platform. (don't get me started on my experience with some POWER9 machines over the last few years...) A non-x86 CPU that's marginally faster/$ than an x86 isn't good enough - it needs to be substantially faster before it's worth the expense of switching, plus some more just to be sure that things won't swing the other way far enough to force you to switch back and pay that price all over again.
Most of the other observations in the post are spot-on, though...
Isn’t this what Transmeta was trying to do back in the day? I remember they famously employed Linus Torvalds for a while, but I never learned anything about the technical details of their ISA front-ends.
These days the IMO most interesting ISA from a JIT point of view is WASM as it's the one that offers the most information (context) and the fewest constraints on the implementation.
The execution units don't know what `01 C0` (add eax, eax) means; only the decoder does. The decoder turns those bytes into something like `eax := ADD_DSZ32(eax, eax)` that the execution unit understands.
For example, `01 01 00 00` (add [ecx], ebx) is probably translated by the PLAs into 3 uops similar to these:
tmp0 := LOAD_DSZ32(ecx)
tmp0 := ADD_DSZ32(tmp0, eax)
STORE_DSZ32(ecx, tmp0)
But any operation requiring four or more uops (such as "complex addressing") would go to either the "long" decoders or the microcode ROMHorizontal microcode is the execution unit control lines being toggled directly by the PLA. Vertical microcode (of the P5 and up) is more in line with what people understand "microcode" to be, but it's still internal uops, never "raw" x86 instructions. The encoding of the actual uop can usually be roughly correlated with the external ISA encoding, but that's just to ease work on the decoder.
Realistically, with CISC, you'll always have a microcode sequencer of some sort. More broadly, short of a TTA, there's going to be a PLA somewhere.
[0]: https://en.wikipedia.org/wiki/Transport_triggered_architectu...
AFAIK the whole RISC vs CISC thing has always been more about the software-visible instruction set than the implementation.
If the compiler could emit that microcode directly, it would be easier to optimize and the CPU wouldn't have the task of decoding and translating the CIS.
Perhaps, although ARMv8 is fixed 4 bytes and x86-64 averages more than 4 bytes an instruction despite each x86 instruction mapping to more than 1.0 uops on average. Oops.
reduced instruction sets don’t have any advantage, because if I recall what he said correctly, decoding and translating are a very small part of the transistor and latency budget. Missed branch prediction, cache and memory access are what matters for a modern CPU. Fetching from main memory has a cost, just like fetching off spinning rust used to, so hoops are jumped through to avoid memory stalls.
But, yes, compilers rarely are told the right architectural generation to target.
Still the claim that x86 implementations are RISC internally is not really true.
> ARM (stylised in lowercase as arm, formerly an acronym for Advanced RISC Machines and originally Acorn RISC Machine) is a family of reduced instruction set computer (RISC) instruction set architectures for computer processors, configured for various environments.
[1]: https://en.m.wikipedia.org/wiki/ARM_architecture_family
“It's done in hardware so it's cheap” (2012) - https://news.ycombinator.com/item?id=19340667 - March 2019 (38 comments)
"It’s done in hardware so it’s cheap" - https://news.ycombinator.com/item?id=4339024 - Aug 2012 (29 comments)
Deciding if a 32 bit value is an integer or not is awkward in software, which is why Smalltalk and similar VMs use other encodings. In hardware it is a single exclusive or gate.
Small integers (up to some small number of bits shorter than machine size) are stored as their value, everything else has other bits set to indicate a pointer, index into object space, or some other thing, is a very common dynamic language data representation in software VMs. XOR is cheap in softwate, too.
"Reduceron is designed to run Haskell, and focuses on an optimization problem I wasn't even aware of, that of graph reduction. [...] I think I'll look into this whole business some more. Pure functional languages are a weak spot of mine; for now, I can only say three things for sure: (1) side effects are a huge source of bugs, (2) although they get in the way of optimizers, side effects are a poor man's number one source of optimizations, so living without them isn't easy, and (3) the Reduceron is a pretty cool project."