Front page | perl.perl6.internals |
Postings from February 2002
Forth engine techniques for faster byte code interpreter. (indirect threaded interpreter)
From:
karlheg
Date:
February 14, 2002 14:19
Subject:
Forth engine techniques for faster byte code interpreter. (indirect threaded interpreter)
Message ID:
87sn83wvto.fsf@juniper.intra.microsharp.com
The "librep" virtual machine uses a technique taken from Forth
engines called "indirect threading". That's not threading as in
"multithreading" or "pthreads"... You'll have to read about it for
yourselves, since I've not the knowledge, time, or the inclination to
write a long essay on the subject. I can tell you "it exists" and
show you where to find out about it, however.
When GCC is the compiler, "rep" uses the "address of label" and
"computed goto" features to build a jump table into the
interpreter/decoder "loop". So rather than test, fail, branch, test,
fail, branch, ..., test, hit, execute, branch in a long switch
statement, it uses the opcode as the index into a jump table, and
does a "goto table[op]" instead.
When it's built with some olde slowunuchs compiler, it falls back to
being a switch statement, through fancy use of the CPP "macro"
system. It's really very amazing and clever.
From <URL:http://www.geocrawler.com/archives/3/688/2001/3/0/5397900/>:
@InProceedings{ertl93,
author = "M. Anton Ertl",
title = "A Portable {Forth} Engine",
booktitle = "EuroFORTH '93 conference proceedings",
year = "1993",
address = "Mari\'ansk\'e L\'azn\`e (Marienbad)",
url = "http://www.complang.tuwien.ac.at/papers/ertl93.ps.Z",
}
Additionally, a search for this author, paper, and/or subject on
CiteSeer may prove fruitful... (bookmark this one!)
<URL:http://citeseer.nj.nec.com/>
The "librep" byte code engine is very fast. Anyone who has used
"sawfish" can attest to it's quickness. My guess is that a good look
at librep (and some Rep Lisp code) might prove very interesting.
Surely John Harper has already encountered many of the similar
problems the Parrot developers are faced with!
<URL:http://librep.sourceforge.net/>
The list archives there are probably worth mining, so bring your
reading headlamp when you visit the list mine under the source forge.
I would really like to see Parrot able to run "rep" lisp/scheme and
"guile" with "goops" also. Do you know about them? It's worth
spending some time to research, IMHO, so put your googles on guile's
goops! (and click on that headlamp in their mailing list archives
also.)
... and I've heard that "rscheme" has a real time generational
garbage collector of some kind. I wonder if it's readable enough to
use as a guide, portable enough to rip out and install, or even worth
the bother? (I'm not good enough at it to understand the thing yet.)
[ I sail a coffee mug in the general direction of a wall... Bring us
WATER, dag nab it. I want something _healthy_ to drink so my brain
doesn't break. ]
--
mailto: (Karl M. Hegbloom) karlheg@microsharp.com
Free the Software http://www.debian.org/social_contract
http://www.microsharp.com
phone://USA/WA/360-260-2066
-
Forth engine techniques for faster byte code interpreter. (indirect threaded interpreter)
by karlheg