|Help with virtual assembler design email@example.com (1994-01-30)|
|Re: Help with virtual assembler design firstname.lastname@example.org (1994-01-31)|
|From:||email@example.com (Darin Johnson)|
|Date:||Mon, 31 Jan 1994 23:59:10 GMT|
> 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?
[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]
Return to the
Search the comp.compilers archives again.