QVM (?)

Jason Orendorff jorendorff at mozilla.com
Wed Dec 19 06:02:37 PST 2007


On Dec 19, 2007, at 7:05 AM, zwetan wrote:
> On Dec 19, 2007 12:03 PM, John Resig <jresig at mozilla.com> wrote:
>> So I caught yesterday's announcement of the excellent tracing JIT  
>> work - but then today I noticed this blog post concerning a VM  
>> (called QVM) written in Forth:
>> http://www.onflex.org/ted/2007/12/meet-qvm-new-tamarin-vm- 
>> contributed-to.php
>>
>> I'm slightly confused - was the tracing VM also QVM - and written  
>> in Forth? (After a quick browse of the repository, I didn't notice  
>> any in particular.) Or is this a completely separate VM that's  
>> also being released?
>
> kind of same here


Yes, QVM is the tracing JIT that was announced yesterday.  The VM  
itself is actually written in C++, and it interprets Tamarin bytecode  
(ABC), same as the "classic" Tamarin VM.

QVM has an additional "low-level bytecode" that it uses internally.   
Each Tamarin bytecode is equivalent to one or more low-level  
bytecodes.  That's where Forth comes in.

QVM's JIT works by tracing hot paths through the bytecode it  
executes.  It can't trace through native machine code, only QVM's low- 
level bytecode.  So in order to give the JIT the maximum range, Adobe  
had to rewrite some routines from C++ to bytecode.

Of course, no one wants to write and debug a long string of numbers  
(which is what bytecode is).  So Adobe invented a notation for  
bytecode that's a little easier on the brain, and which compiles to  
bytecode in a straightforward way.  This notation is a dialect of  
Forth.  You can find some examples of it in the repository.  For  
example, see:

   http://hg.mozilla.org/tamarin-tracing/?file/tip/core/e4x.fs

That file contains the Forth code for the JavaScript operator +  
(search for OP_add).

-j



More information about the Tamarin-devel mailing list