On Wed, Aug 06, 2008 at 01:25:40PM -0400, Paul Koning
wrote:
By the way, I meant to mention another compiler
that did something
like P-code: RT-11 Fortran. The actual scheme was called "threaded
code" because it was basically a stream of function pointers. (Come
to think of it, that's a common Forth encoding as well.) That's about
as fast as straight code if most of what you need is calls to support
functions, and more compact because you're not including the opcode
word.
That scheme sort of reminds me of FORTRAN IV for the PDP-8 - IIRC, the
compiler produces, mostly, a stream of FPP instructions that either get
executed by a real FPP-12 (or FPP-8?) _or_, lacking math hardware, get
emulated by wads of PDP-8 instructions.
The difference is rather than a stream of function pointers, it's a
stream of math co-processor instructions that are either executed by
real hardware or by an emulator library. In either environment, though,
the object code is the same.
And this all is similar to what compilers did in the 50s. The ACT-V
compiler (ACT-I and ACT-III, too) simply generates a stream of runtime
system calls (the runtime system is called 'basic subroutines'). You can
even compile your program by hand since these subroutine calls are
documented in the manual.
Christian