News for hackers. Stuff that matters.
Re:The Legend of von Neumann [pdf] by ricksunny on Saturday October 03, 2026 @05:13AM (#49942598)
>The big lack in Von Neumann's architecture was index registers. He was into storing into the address part of instructions. The Manchester Mark I had the first index register (the "B box"), at which point programs could be read-only and still be able to index arrays. That completed the basic CPU architecture.

strikes me as gilding the lily (I earlier even imagined possibly even a claude-esque stock 'one caveat' flourish, but I know you wouldn't do that given your background). Addressable memory, where any given addressed memory register can contain not just conventional data to be operated on but can also contain an address of some other memory register to jump to. is what strikes me as the highly-enriched uranium of computer architecture. indexing an array is a feature bump by comparison.

Re:The Legend of von Neumann [pdf] by adrian_b on Saturday October 03, 2026 @08:07AM (#49943562)
The early computers that did not have index registers realized the equivalent of indexed addressing by modifying the address fields of the instructions before they were executed, e.g. during a loop.

In the early computers with non-pipelined execution and without cache memories, and also without security concerns, modifying the executable program during execution did not have disadvantages.

Nonetheless, pipelined execution became widely used and also cache memories appeared soon, and such performance-enhancing techniques could not work well with self-modifying programs, so index registers became absolutely necessary in fast CPUs.

Re:The Legend of von Neumann [pdf] by Animats on Saturday October 03, 2026 @04:48PM (#49947621)
Being able to store into the program was once considered much more important than it is now. Today we almost always load code, lock it read-only, and run it. Even JIT compilers don't patch much. They mostly generate code into empty memory. (There are exceptions. I think PyPy patches existing when a Python program replaces an existing function while running. You can do this in Python, but probably shouldn't.) Von Neumann considered self-modifying code important for somewhat philosophical reasons related to his self-replicating automata ideas.

Previous pre-computer programmable machines, back to the Jacquard loom, stored programs in a completely different medium than the data. Plugboards, chains of Jacquard cards, cams, etc. Von Neumann insisted that programs were just data and belonged in the same memory as the data. This was a conceptual advance. The hardware had to get there to make it work.

The next big innovation was the stack, in the modern sense. This came later than one might expect. Note that there are at least two types of stack computers. There are ones with a return point and context stack, which is the C view of the world. And there are ones where working storage is on the stack, like Forth machines and early Burroughs machines. The first kind seems to have been invented for ALGOL in 1957, because ALGOL allowed recursion. Stacks made a lot of people nervous back then, because how much memory to allocate for the stack was unclear, and there wasn't much memory. FORTRAN disallowed recursion and thus did not need stacks and stack frames.

So storing into the program hung on in some architectures. UNIVAC 1107 and later mainframes had a Store Location Jump (SLJ) instruction. This stored the return address into the beginning of a subroutine. Not into a stack frame; there was no stack by default. Into the first word of the subroutine's code. For non-recursive non-concurrent code, it worked.[1] But it was used less over time, with different constructs used instead.

Program in the same memory as data, yes. Program can create more program, yes. Program modifies itself while running, not so good. Index registers eliminate most needs for the third case.

[1] https://www.fourmilab.ch/documents/univac/instructions.html