Re: Help with virtual assembler design

djohnson@arnold.ucsd.edu (Darin Johnson)
Mon, 31 Jan 1994 23:59:10 GMT

          From comp.compilers

Related articles
Help with virtual assembler design leo@pyrite.cs.uow.edu.au (1994-01-30)
Re: Help with virtual assembler design djohnson@arnold.ucsd.edu (1994-01-31)
| List of all articles for this month |
Newsgroups: comp.compilers
From: djohnson@arnold.ucsd.edu (Darin Johnson)
Keywords: interpreter, comment
Organization: Compilers Central
References: 94-01-124
Date: Mon, 31 Jan 1994 23:59:10 GMT

Moderator writes:


> As an independent issue, you should consider threaded or
> indirect-threaded code to speed up the interpreter loop. -John]


Hmm, anyone, how about a quick overview of threaded interpreters
versus standard stackbased byte-code interpreters?
--
Darin Johnson
djohnson@ucsd.edu
[Threaded code is just a technique to speed up interpreter dispatch. Rather
than having a table of byte codes, you have a table of addresses of the
intepretive routines. You keep the pointer to the current location in the
table in a register. At the end of each of the routines, you have what
might be written in C as goto *r++; to jump directly to the next routine.
This was very popular on the PDP-11, where the goto turned into a single
one-word instruction. Indirect threaded code adds an extra level of
indirection in the pointers and gotos. It can be useful with dynamically
typed languages to dispatch through a per-data-type table. A thread in
comp.compilers a few years ago described a fairly machine-independent way to
implement threaded code in C using gcc. -John]
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.