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.

Daniel
  • 1,896
  • 2
  • 15
  • 14

1 Answers1

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.

dan_waterworth
  • 7,287
  • 2
  • 34
  • 45
  • 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 01 '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 01 '13 at 10:21
  • Note that x86 machine code is just another language like JVM bytecode or JavaScript source code. – Jörg W Mittag Jan 01 '13 at 19:07