|ultra fast but too complex interpreter. firstname.lastname@example.org (1993-03-17)|
|Re: Re: ultra fast but too complex interpreter email@example.com (Anton Ertl) (1993-03-18)|
|From:||Anton Ertl <firstname.lastname@example.org>|
|Date:||Thu, 18 Mar 1993 13:50:54 GMT|
email@example.com (Frans van Hoesel) writes:
|> 1) ultra fast but
[thousands of instructions like add_i0_i1_i4]
This approach might be slower than you expect due to cache thrashing. If
you want fewer instructions, make a general version (with explicit
register numbers, like 3) and create a specialized version only for
frequently occurring instruction/reg combinations.
It seems you are creating a C function for every instruction. Throwing
everything into a big switch is faster (since you can keep the
interpreters state in registers). Best of all is direct threading with GNU
C's "labels as values" feature.
|> 2) a second approach is a simple stack machine
|> This would be easy to make, but most likely not very fast.
Why do you think so?
|> The questions is.. how did you guys attack this problem and why did you
|> choose the way you have done it?
The one time I had a choice I chose the stack machine, for simplicity.
M. Anton Ertl firstname.lastname@example.org
[There was an interesting article in 1991 on more or less portable threaded
code in C. See article 91-03-121 and the subsequent responses. -John]
Return to the
Search the comp.compilers archives again.