6

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.

1 Answer 1

5

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.

3
  • 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
    Commented Jan 1, 2013 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. Commented Jan 1, 2013 at 10:21
  • Note that x86 machine code is just another language like JVM bytecode or JavaScript source code. Commented Jan 1, 2013 at 19:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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