[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: P-Source: A Guide to the Apple Pascal System



On Dec 4, 1:12 pm, "Michael J. Mahon" <mjma...@aol.com> wrote:

> > While this is a greater optimisation than a hot-spot compiler can
> > manage (at least for now), I've always preferred this approach to
> > programming and am confident with some extensions Dave's work will
> > result in a very interesting new 'platform' for the Apple II
>
> That's interesting!

I've had a bit of a fascination with code generators ever since...

> In 1974, when the portable Pascal (p-code) compiler first became
> available, some folks a Burroughs became interested enough to write
> an interpreter for p-code to run it on our machines (B3500-B4500 at the
> time).
>
> The problem is that it took over an hour to compile the compiler
> using the interpreter.
>
> So I decided to write a "back-end" that would read p-code and generate
> machine code.  Needless to say, this resulted in substantial code
> expansion!  But it compiled the compiler in about a minute--so overnight
> the code generator became the only way to run p-code on our machines.
> ;-)
>
> Considering that the target machines were *very* distant from the
> original target machine (CDC6400), with BCD data and addresses and
> a variable-size memory-to-memory architecture, I found the code
> generation problem to be quite interesting and rewarding.  Ironically,
> one of the issues that had to be left to a one-time "thunk" at run
> time was pointer arithmetic--p-code made an assumption that an integer
> was one "storage unit", which made pointers essentially integers.  On
> a digit-addressed machine, that was *not* true, so I had to determine
> that an arithmetic operator was actually working on a pointer, not an
> integer, at run time--which back-patched the generated code for future
> use.

Very nice!