Re: Re: ultra fast but too complex interpreter

Anton Ertl <anton@mips.complang.tuwien.ac.at>
Thu, 18 Mar 1993 13:50:54 GMT

          From comp.compilers

Related articles
ultra fast but too complex interpreter. hoesel@igc.ethz.ch (1993-03-17)
Re: Re: ultra fast but too complex interpreter anton@mips.complang.tuwien.ac.at (Anton Ertl) (1993-03-18)
| List of all articles for this month |

Newsgroups: comp.compilers
From: Anton Ertl <anton@mips.complang.tuwien.ac.at>
Keywords: interpreter, comment
Organization: Compilers Central
References: 93-03-060
Date: Thu, 18 Mar 1993 13:50:54 GMT

hoesel@igc.ethz.ch (Frans van Hoesel) writes:
|> 1) ultra fast but
|> complex
[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.


- anton
--
M. Anton Ertl anton@mips.complang.tuwien.ac.at
[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]
--


Post a followup to this message

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