> > 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 _______________________________________________ glob2-devel mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/glob2-devel
