The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
From: Dan Cross <>
To: Dan Stromberg <>
Cc: TUHS main list <>
Subject: Re: [TUHS] Compilation "vs" byte-code interpretation, was Re: Looking back to 1981 - what pascal was popular on what unix?
Date: Sun, 30 Jan 2022 17:51:47 -0500	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

[-- Attachment #1: Type: text/plain, Size: 4248 bytes --]

On Sun, Jan 30, 2022 at 1:08 PM Dan Stromberg <> wrote:

> On Sun, Jan 30, 2022 at 8:58 AM David Barto <> wrote:
>> Yes, the UCSD P-code interpreter was ported to 4.1 BSD on the VAX and it
>> ran natively there. I used it on sdcsvax in my senior year (1980).
> This reminds me of a question I've had percolating in the back of my mind.
> Was USCD Pascal "compiled" or "interpreted" or both?

As others have mentioned, both. The compiler generated P-code, which was a
specialized bytecode representation of the compiled Pascal source.

The beauty of this is that it makes porting the system fairly easy; one
need only write a P-code interpreter. Assuming the system ships with a
p-code "binary" representation of the compiler in addition to the sources,
one could make it self-hosting very easily. With a threaded P-code
interpreter, it can also be quite small, making constrained 8-bit
microcomputers (like the Apple II) reasonable targets for Pascal.

This sort of representation also has some interesting properties with
respect to the actual bytecode used; it could, for example, have some
understanding of the semantics of types in the programming language. The
Dis virtual machine for the Limbo programming language used with the
Inferno virtual operating system did this; Dis understood Limbo strings,
whereas this isn't true on most machine architectures.

And is Java?  They both have a byte code interpreter.  Yes, modern Java is
> JIT-compiled, but does that make Java a compiled language in the Oracle
> implementation, or is it an interpreter with a pretty good runtime?

Again, both. The compiler emits java bytecodes, which the JVM interprets.

Wasn't Java referred to as "compiled" even back before the JIT compiler was
> added?


Granted, gcj is compiled.

Well, gcj (optionally) compiles to native machine code and comes with a
library that implements the functionality usually provided by the JVM; that
is, it can target a platform other than the JVM and give mostly the same
functionality. But javac and gcj are both very much compilers.

But Oracle's implementation of Java is commonly referred to as a
> "Compiler".  And what about back before Java's JIT compiler was added -
> ISTR recall Java was referred to as a compiled language before the JIT
> addition.

This is correct. A compiler simply transforms some representation of data
into a different representation of that same data, possibly with some
semantic loss; the canonical example is textual "source code" for some
programming language translated into object code for some target hardware
architecture, but this need not be the case. We were discussing troff and
TeX the other day; both of these are compilers, in that they take some
high-level source representation of a document and transform it into a
typeset representation. (Note: I mean "semantic loss" in the sense that,
say, we may lose details about types or the organization of data in the
compiled artifact.)

And then there's the CPython implementation of Python.  It too uses a byte
> code interpreter, but it's commonly referred to as "interpreted".  But is
> it really?  Granted, it has an implicit, cached compilation step, but is it
> less compiled for that?

I think that "interpreted" in this context means the load-and-go nature of
the system and the transience of the bytecode: the text is internally
compiled and then executed, but these steps are often linked and, while one
can coax the Python "interpreter" to emit .pyc and/or .pyo files, usually
one does not: the compiled bytecodes are lost as soon as the program is
done executing.

Is there consistency here?

Not really. As an interesting aside, before Java became widespread I heard
folks mention "P-code" as a generic term for what most folks mean when they
say "bytecode." Now we often just say "bytecode." Similarly with JIT in
lieu of "load and go", though Java's JIT is a bit different (it's
converting from bytecode to native machine code on the fly; it's even more
elaborate when things like hot-spot are taken into account, where the
runtime has a kind of built-in profiler and will optimize particularly
expensive bits of the code over time).

        - Dan C.

[-- Attachment #2: Type: text/html, Size: 6507 bytes --]

  parent reply	other threads:[~2022-01-30 22:52 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-28 23:07 [TUHS] " Will Senn
2022-01-28 23:18 ` Dan Cross
2022-01-28 23:31   ` Will Senn
2022-01-29  0:03     ` Rob Pike
2022-01-29  0:40     ` Will Senn
2022-01-29 19:05       ` John Cowan
2022-01-29 19:36         ` arnold
2022-01-29 19:59 ` Clem Cole
2022-01-29 20:02   ` Jon Steinhart
2022-01-29 20:13   ` Bakul Shah
2022-01-29 20:30     ` Clem Cole
2022-01-29 20:34     ` Larry McVoy
2022-01-29 21:03       ` Al Kossow
2022-01-29 21:38         ` Larry McVoy
2022-01-29 22:06       ` Bakul Shah
2022-01-29 22:48         ` GREEN
2022-01-30  3:27           ` Larry McVoy
2022-01-30 16:57   ` David Barto
2022-01-30 18:07     ` [TUHS] Compilation "vs" byte-code interpretation, was " Dan Stromberg
2022-01-30 20:09       ` David Barto
2022-01-31  7:59         ` WEB
2022-01-30 22:51       ` Dan Cross [this message]
2022-01-30 23:57         ` Dan Stromberg
2022-01-31  0:23         ` Nemo Nusquam
2022-01-31  0:45           ` Steve Nickolas
2022-01-31 17:16             ` Paul Winalski
2022-01-31 20:00               ` Erik E. Fair
2022-01-31 22:45               ` Steve Nickolas
2022-02-02  4:53               ` Adam Thornton
2022-01-31  1:41       ` Phil Budne
2022-02-07  3:04   ` [TUHS] " Rob Gingell
     [not found] <>
2022-01-30 20:09 ` [TUHS] Compilation "vs" byte-code interpretation, was " silas poulson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).