Design and implementation of virtual machines, interpreters, automata, Turing machines. **DO NOT** use this tag for virtualized computers (VirtualBox, VMWare, ...), unless the question address the implementation of such tools.
Questions tagged [vm-implementation]
294 questions
152
votes
5 answers
Java's Virtual Machine and CLR
As a sort of follow up to the question called Differences between MSIL and Java bytecode?, what is the (major) differences or similarity in how the Java Virtual Machine works versus how the .NET Framework Common Language Runtime (CLR) works?
Also,…

Frank V
- 25,141
- 34
- 106
- 144
107
votes
3 answers
Why is the JVM stack-based and the Dalvik VM register-based?
I'm curious, why did Sun decide to make the JVM stack-based and Google decide to make the DalvikVM register-based?
I suppose the JVM can't really assume that a certain number of registers are available on the target platform, since it is supposed to…

aioobe
- 413,195
- 112
- 811
- 826
80
votes
8 answers
registers vs stacks
What exactly are the advantages and disadvantages to using a register-based virtual machine versus using a stack-based virtual machine?
To me, it would seem as though a register based machine would be more straight-forward to program and more…

Jason Baker
- 192,085
- 135
- 376
- 510
80
votes
5 answers
What is the purpose of the Java Constant Pool?
I am currently trying to dig deeper into the specification of the Java Virtual Machine. I have been reading Inside the JVM book online and there is one confusing abstraction I can't seem to grasp: Constant Pool. here is the excerpt from the…

Bober02
- 15,034
- 31
- 92
- 178
65
votes
7 answers
Is the CLR a virtual machine?
I read a book which referred to the .net CLR as a virtual machine? Can anyone justify this? What is the reason we need the concept of virtual machines on some development platforms?
Isn't it possible to develop a native framework [one without…

this. __curious_geek
- 42,787
- 22
- 113
- 137
59
votes
7 answers
How to write self-modifying code in x86 assembly
I'm looking at writing a JIT compiler for a hobby virtual machine I've been working on recently. I know a bit of assembly, (I'm mainly a C programmer. I can read most assembly with reference for opcodes I don't understand, and write some simple…

jakogut
- 4,409
- 6
- 29
- 41
57
votes
2 answers
What is Smali Code Android
I am going to learn a little bit about Dalvik VM, dex and Smali.
I have read about smali, but still cannot clearly understand where its place in chain of compilers. And what its purpose.
Here some questions:
As I know, dalvik as other Virtual…
user4598738
56
votes
3 answers
Differences between Just in Time compilation and On Stack Replacement
Both of them pretty much do the same thing. Identify that the method is hot and compile it instead of interpreting. With OSR, you just move to the compiled version right after it gets compiled, unlike with JIT, where the compiled code gets called…

Chander Shivdasani
- 9,878
- 20
- 76
- 107
44
votes
2 answers
Why is it hard to beat AOT compiler with a JIT compiler (in terms of app. performance)?
I was thinking that JIT compilers will eventually beat AOT compilers in terms of the performance of the compiled code, due to the inherent advantage of JIT (can use information available only at runtime). One argument is that AOT compilers can spend…

Enno Shioji
- 26,542
- 13
- 70
- 109
43
votes
8 answers
What are the primitive Forth operators?
I'm interested in implementing a Forth system, just so I can get some experience building a simple VM and runtime.
When starting in Forth, one typically learns about the stack and its operators (DROP, DUP, SWAP, etc.) first, so it's natural to think…

Barry Brown
- 20,233
- 15
- 69
- 105
43
votes
6 answers
Tutorial/resource for implementing VM
I want self-education purpose implement a simple virtual machine for a dynamic language, prefer in C. Something like the Lua VM, or Parrot, or Python VM, but simpler. Are there any good resources/tutorials on achieving this, apart from looking at…

zaharpopov
- 16,882
- 23
- 75
- 93
36
votes
4 answers
Interpreters vs Compilers vs Virtual Machines
I have a question about Interpreters, Compilers, and Virtual Machines (VMs).
Now I know the differences between Interpreters and Compilers but what is different about the VIRTUAL MACHINES from the previous 2? What are the Pros and Cons of a VM over…

DodoSombrero
- 767
- 3
- 15
- 29
30
votes
10 answers
Why are Virtual Machines necessary?
I was reading this question to find out the differences between the Java Virtual Machine and the .NET CLR and Benji's answer got me wondering why Virtual Machines are necessary in the first place.
From my understanding of Benji's explanation, the…

Daniel
- 1,231
- 3
- 15
- 20
27
votes
8 answers
What is a VM and why do dynamic languages need one?
So, for example, Python and Java have a VM, C and Haskell do not. (Correct me if I'm wrong)
Thinking about what languages on both sides of the line have, I can't find the reason. Java is static in a lot of ways, while Haskell provides a lot of…

Pepijn
- 4,145
- 5
- 36
- 64
27
votes
3 answers
How to write a linker
I have written a compiler for C that outputs byte code. The reason for this was to be able to write applications for an embedded platform that runs on multiple platforms.
I have the compiler and the assembler.
I need to write a linker, and am…

The Big Spark
- 327
- 1
- 4
- 8