News for hackers. Stuff that matters.
Re:Bytecode VMs in surprising places (2024) by DonHopkins on Monday May 25, 2026 @07:48AM (#48265765)
Good call! (Whether it's a directly threaded, indirectly threaded, subroutine threaded, token threaded, Huffman threaded, or string threaded call.)

https://en.wikipedia.org/wiki/Threaded_code#Token_threading

Mitch Bradley created OpenFirmware, which was originally called ForthMacs or Sun Forth, running on Sun 68k, SPARC, and Amiga. It was based on Langton and Perry Forth 83, and has a metacompiler that can target and cross compile to many platforms, word sizes, cpus, and threading models, produce stripped ROMable images, etc.

The metacompiler made it possible to support different target platforms and interpreter styles (native CPU threaded code and bytecode simultaneously). So the core of the Forth system runs fast native code with 32 bit threaded code field address pointers, and it can also run bytecode on the ROMS of peripheral cards.

At the time the Forth bytecode was developed, Sun had different instruction sets (68k, SPARC, x86) that they wanted to support with the same peripherals (typically SBus). But later it became a standard that other platforms adopted, like PowerPC Macs, and the OLPC.

https://github.com/MitchBradley

https://github.com/MitchBradley/openfirmware

Interview with Mitch Bradley (he's like the Woz of Forth):

https://web.archive.org/web/20120118132847/http://howsoftwar...

Years before OpenFirmware bytecode, Mitch also developed an extremely portable C-Forth, which uses token threaded interpreter (16 or 32 bit configurable) using a switch statement + a small, hand-rolled FFI built around a fixed-arity argument-marshalling trampoline:

https://github.com/MitchBradley/cforth

OpenFirmware even has its own song:

https://www.youtube.com/watch?v=b8Wyvb9GotM

More on Mitch and OpenFirmware:

https://news.ycombinator.com/item?id=21822840

https://news.ycombinator.com/item?id=33681531

https://news.ycombinator.com/item?id=38689282

Re:Bytecode VMs in surprising places (2024) by anthk on Monday May 25, 2026 @08:50AM (#48266218)
I ran EForth under the Subleq from Howe R.J at https://github.com/howerj/muxleq (the subleq one) first at QuickJS (trivial tasks, almost a 1:1 map from the C code, made in a hurry) and under... jsinterp.py from the infamous yt-dlp but using arrays instead of printing functions. But... if yt-dlp's "mini-JS" implements some captcha input functions... you can add I/O with ease and run EForth with what they call (not me) a "Not totally functional interpreter".

Not totally... until people there run the 110 rule program, Conway's Life, Subleq+EForth...

Re:Bytecode VMs in surprising places (2024) by DonHopkins on Monday May 25, 2026 @09:18AM (#48266497)
You may need to write a WebGPU shader and run it in a Beowulf Cluster to make that run fast!
Re:Bytecode VMs in surprising places (2024) by anthk on Tuesday May 26, 2026 @09:03AM (#48279249)
I ran EForth under Muxleq (multiplexed subleq) under an n270 Atom (32 bits Intel) and was fast enough. Much slower than GForth or even PFE (which is slow compared to GForth), but usable even to do Algebra exercises. Rendering a Mandelbrot fractal (ASCII) lasted half a minute but it's amazing that few lines of C enable you to run a Forth with input composed of numbers. I even have a backup in paper.

https://sites.google.com/view/win32forth/win32forth-readme/m...

I did some syntax changes for floats and that's it.

Re:Bytecode VMs in surprising places (2024) by actionfromafar on Monday May 25, 2026 @03:49PM (#48270859)
Power Macs had an x86 emulator which ran the x86 ROM in PCI cards.
Re:Bytecode VMs in surprising places (2024) by mjg59 on Monday May 25, 2026 @04:18PM (#48271204)
I don't think that's true? Macs were running Open Firmware, they had an expectation of the same Forth code that Suns made use of, and several cards needed to be flashed with Apple firmware to be Mac compatible. Alphas definitely ran x86 video card init code under emulation, though.
Re:Bytecode VMs in surprising places (2024) by actionfromafar on Monday May 25, 2026 @05:51PM (#48272408)
I probably misremembered Alphas.
Re:Bytecode VMs in surprising places (2024) by mjg59 on Tuesday May 26, 2026 @12:14AM (#48274911)
Very easy things to confiate given we're talking about hardware that's on the order of 30 years old!
Re:Bytecode VMs in surprising places (2024) by BuildTheRobots on Tuesday May 26, 2026 @10:21AM (#48280249)
iirc, the OpenFirmware boot image was larger than the equivalent BIOS image - I've got half a memory of resoldering ROM chips on ATi cards so they could be cross-flashed to work in G3/G4 PoweMacs.
Re:Bytecode VMs in surprising places (2024) by yoz on Monday May 25, 2026 @05:10PM (#48271711)
This is FASCINATING, thank you!