glob2-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [glob2-devel] scripting language


From: martin . voelkle
Subject: Re: [glob2-devel] scripting language
Date: Wed, 25 May 2005 12:04:09 +0200
User-agent: Internet Messaging Program (IMP) 3.2.7

> > Now, back to VM coding :-):-)
>
> Just a question about vm: How do you plan choose each bytecode and increment
> PC? Most vm (specially C ones) have a big switch to execute bytecode, but
> using inheritance of a class ByteCode with a virtual method execute is
> usually faster. Furthermore, this method can return the relative
> displacement
> that PC should do. Martin V. knows more than me about this.

Actually, no. The DotGNU Portable.NET guys have written a paper about efficient
bytecode execution and it looks like the the fastest is to store the address of
the method as the opcode and jump directly to the code of the next instruction
after executing the current one (a method called computed gotos).

Virtual dispatch is the same as doing a switch but the lookup is done in a
different method table for each object at a constant offset instead of a lookup
in a unique table at different offsets, which is better in terms of cache use.

Virtual dispatch is just prettier, although it is arguable that working with a
stream of different sized objects is not the most beautifull thing.

Martin




reply via email to

[Prev in Thread] Current Thread [Next in Thread]