Related articles |
---|
P-Code and virtual machines ghmilmei@iiic.ethz.ch (1994-03-23) |
Threaded code (was Re: P-Code and virtual machines) mark@godzilla.Quotron.COM) (1994-03-26) |
Threaded code (was Re: P-Code and virtual machines) bevan@cs.man.ac.uk (Stephen J Bevan) (1994-03-27) |
Re: Threaded code (was Re: P-Code and virtual machines) pardo@cs.washington.edu (1994-03-29) |
Re: Threaded code (was Re: P-Code and virtual machines) uho@informatik.uni-kiel.d400.de (Ulrich Hoffmann) (1994-03-30) |
Newsgroups: | comp.compilers |
From: | pardo@cs.washington.edu (David Keppel) |
Keywords: | interpreter |
Organization: | Computer Science & Engineering, U. of Washington, Seattle |
References: | 94-03-104 94-03-148 |
Date: | Tue, 29 Mar 1994 04:37:27 GMT |
mark@godzilla.Quotron.COM (Mark T. Price (sg)) writes:
>[What's threaded code? What's a reference for threaded code?]
The general idea is that code for
foo (10);
foo (11);
foo (12);
is encoded as an array of words/bytes/whatever such as:
&foo
10
&foo
11
&foo
12
Initially, a variable `tp' is set to point at the first word (&foo) and
there is a jump to address pointed to by tp; in this case `foo'. Each
code fragment performs some processing and also increments `tp' past any
arguments (e.g., 10). Finally, the code fragment ends by performing
another indirect branch through the value of `tp'.
References include:
%A James R. Bell
%T Threaded Code
%J Communications of the ACM (CACM)
%V 16
%N 2
%D June 1973
%P 370-372
%A Richard H. Eckhouse Jr.
%A L. Robert Morris
%T Minicomputer Systems Organization, Programming, and Applications
(PDP-11). 2nd Ed.
%I Prentice-Hall, Inc.
%D 1979
%P 290-298
%A Peter M. Kogge
%T An Architectural Trail to Threaded Code Systems
%J IEEE Computer
%P 22-33
%D March 1982
The second one ([EM79]) includes a cute variation on threaded code called
`knotted code' for use where certain routines are invoked in series e.g.,
the above example is encoded as
&foo2
10
11
12
sentinel
where `foo2' is like `foo' but it iterates until it reaches the
sentinel.
There is also something called `indirect threaded code' which is described
in
%A B. K. Dewar
%T Indirect Threaded Code
%J CACM
%D June 1975
%V 18
%N 6
%P 330-331
(Unfortunately there's an error in the example, so don't expect it to make
total sense; I spoke with the author a few years ago and he didn't have a
quick'n'ready patch to fix it.)
There is also a discussion of threaded code in the `comp.compilers'
archives from some time in 1991.
;-D on ( What was that about user-level threads? ) Pardo
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.