On 3/6/07, Nicolas Cannasse <[EMAIL PROTECTED]> wrote:

Thanks, I will have a look at the paper, but that's a good'old debate :)

Indeed. From the paper:

"A long-running question in the design of VMs is whether stack
architecture or register architecture can be implemented more
efficiently with an interpreter. On the one hand stack architectures
allow smaller VM code so less code must be fetched per VM instruction
executed. On the other hand, stack machines require more VM
instructions for a given computation, each of which requires an
expensive (usually unpredictable) indirect branch for VM instruction
dispatch. Several authors have discussed the issue [12, 15, 11, 16]
and presented small examples where each architecture performs better,
but no general conclusions can be drawn without a larger study."

It later states:

"We find that the increased cost of fetching more VM code [in register
machines] involves only 1.07 extra real machine loads per VM
instruction eliminated. Given that VM dispatches are much more
expensive than real machine loads, this indicates strongly that
register VM code is likely to be much more time-efficient when
implemented with an interpreter, although at the cost of increased VM
code size."

However:

"As the cost of dispatches falls, any benefit from using a register VM
instead of a stack VM falls. However, switch and simple threaded
dispatch are the most commonly used interpreter techniques, and switch
is the only efficient alternative if ANSI C must be used."

Hope it helps. :-)

Sandro

--
Neko : One VM to run them all
(http://nekovm.org)

Reply via email to