Slim Binaries (1997)
This reminds me of a technique used by another language I read about in the early nineties, used by a language called (I think) &#x27;C@T&#x27; (don&#x27;t bother Googling that: I found nothing relevant, and the results seem to be mostly NSFW).<p>The technique was instruction interleaving.  They supported several very different architectures from <i>one</i> platform-independent binary.  I think they were x86, 68k, MIPS and SPARC.  Each executable started with a boilerplate header: a bit of black magic which worked on all of the platforms (more on that below).  When execution emerged at the end of the header, the instruction pointer was pointed at the entry point appropriate for the architecture it was executing on.  Each entry point (one for each architecture) made sure that the instruction pointer would always jump over parts with the other architectures, to the next applicable instruction in the correct architecture.<p>The boilerplate header worked something like this: the first few bytes, when interpreted on one particular architecture, would jump to the address immediately following the header, which was the starting point for <i>that</i> architecture&#x27;s thread-of-control.  All other architectures interpreted that instruction as something that was effectively a no-op for the purpose of flow control (like maybe added two registers into another register).  Consequently, the next instruction would only be seen by one of the remaining architectures, and a similar process would peel off the remaining architectures, one-by-one, directing each to the appropriate real entry point for that architecture.  As I recall they did not do something simple like have monolithic blocks of code separated by architecture: if there was a loop, the body of the loop had interleaved instructions for all architectures.  I&#x27;m sure this was in the days before instruction caches were a thing.<p>I think they were able to get some space savings with this, at least by sharing constant data segments (maybe).  At the time I read it I did not appreciate some of what they did, and now I could but I can&#x27;t find the article I read nor any papers about it.  I probably read it in <i>Computer Language</i> or <i>Dr. Dobbs</i> or something like that, probably in the early nineties.  If anyone else remembers this and can point me to a source, I&#x27;d love to revisit it.  I think it <i>might</i> have been a project out of AT&amp;T labs.