Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I'm having a hard time understanding the difference between an emulation virtual machine and a language vm. I started with the research and implementation of an emulation virtual machine. Primarily emulating quite old 16-bit architectures.

I want to get the basics down for a language virtual machine. Are both systems similar? Do they both use register-based architectures and stack-based?

I'm under the impression a language VM is basically a run time environment. Depending on the complexity of the VM, it may have a garbage collector, JIT compiler, etc... Would that assumption be correct?

EDIT: I'm also talking about bytecode VMs, but native machine code works too.

share|improve this question

1 Answer 1

up vote 4 down vote accepted

The line can be very fuzzy, but the distinction lies in their intended purpose rather than their implementation.

Language VMs typically operate at a higher level of abstraction. They may execute bytecode or execute the AST directly. JIT compilation may occur in either case, but I don't know of any processors that implement GC (except possibly lisp machines?).

Your assumption is correct, a language VM implements the runtime environment in a language implementation.

share|improve this answer
    
That makes sense. Thanks. I have a follow up question: For a language VM, you wouldn't need the lower level implementation like a memory stack, and heap, right? Only the call stack, etc. as your not emulating a machine? –  Daniel Jan 1 '13 at 10:10
1  
You only need to implement things that can be seen by a program running in your VM. The exact layout of the stack, for instance, is entirely opaque to a python program. –  dan_waterworth Jan 1 '13 at 10:21
    
Great, thanks ! –  Daniel Jan 1 '13 at 10:22
    
Note that x86 machine code is just another language like JVM bytecode or JavaScript source code. –  Jörg W Mittag Jan 1 '13 at 19:07

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.