home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.arch
- Path: sparky!uunet!mcsun!Germany.EU.net!news.netmbx.de!zrz.tu-berlin.de!math.fu-berlin.de!news.th-darmstadt.de!rs5.hrz.th-darmstadt.de!graef
- From: graef@rs5.hrz.th-darmstadt.de (Ulrich Graef)
- Subject: Re: Threaded Code
- Sender: news@news.th-darmstadt.de (The Usenet-News System)
- Message-ID: <1992Aug17.135955.6903@news.th-darmstadt.de>
- Date: Mon, 17 Aug 1992 13:59:55 GMT
- References: <55535@mentor.cc.purdue.edu> <13910@goanna.cs.rmit.oz.au> <GLEW.92Aug7185506@pdx007.intel.com> <1992Aug10.141731.10007@email.tuwien.ac.at> <martin.713808550@bert> <34301@cbmvax.commodore.com>
- Nntp-Posting-Host: rs5.hrz.th-darmstadt.de
- Organization: TU Darmstadt
- Lines: 42
-
- In article <34301@cbmvax.commodore.com>, jesup@cbmvax.commodore.com (Randell Jesup) writes:
- > martin@math.rwth-aachen.de ( Martin Schoenert) writes:
- > >Subroutine threading (sub.c):
- > > For each instruction there is a (C) function which implements this
- > > instruction. The instructions are encoded with the addresses of
- > > those functions. Each function returns after it has done its work,
- > > and there is a central dispatcher in 'main', which looks as follows
- > > 'while (1) (**pc++)();'
- >
- > This is not what I would call "subroutine threading". Subroutine
- > threading (at least from my perspective of having written a subroutine-
- > threaded forth) means that you do not have an array of function addresses,
- > you have an array of "jsr <address>". On top of that, the code that
- > generates the instructions can inline when appropriate (a big win in forth
- > on modern processors, since many simple operations are smaller than an
- > instruction or even an address).
- >
- > I'm not sure what I'd call your method. It's big problem is that
- > it requires an explicit "interpret" instruction to call an instruction
- > written from instructions instead of as a pre-existing C routine. If I had
- > to name it I would call it an "explicit-threaded interpreter", since the
- > thing that compiles the code must know to generate "interpret" instructions
- > to execute words that need interpretation, while all standard methods of
- > threading do not need to know.
-
- I think, you both are right. Martin calls a method `subroutine threading'
- which is used in interpreters which are written in C.
- The `subroutine threading' of Randell, which is often used in Forth
- interpreters is the `indirect threading' of Martin.
-
- The interpreters of Martin are intended to test the method.
- Therefore they are small and have not the ability to compile
- code like an Forth-interpreter.
-
-
- Uli
-
- --
- Ulrich Graef | analog (phone) : +49 6155 62493
- Lichtenbergweg 11 | digital (Email): graef@hrz.th-darmstadt.de
- D-W-6103 Griesheim +--------------------------------------------
- Germany | Nothing is real, look into your mirror!
-