Skip to main content

All Questions

Filter by
Sorted by
Tagged with
1 vote
1 answer
197 views

Is my 'variable-storing area' basically a 'heap'?

I'm planning to implement a simple VM/interpreter kind of thing for a simple language I'm making. The compiler of the language emits mostly stack-oriented instructions to be executed by the VM. The ...
Aviv Cohn's user avatar
  • 21.5k
0 votes
3 answers
2k views

How does a stack VM manage with only one stack?

Lately I've been asking a lot of questions here about VMs. Here's another one: I understand that often stack based VMs use only one stack - the call stack - for everything. E.g. it is also used for ...
Aviv Cohn's user avatar
  • 21.5k
6 votes
3 answers
2k views

What would the register-machine bytecode for this code look like?

I hope this kind of question isn't off-topic on this site. I'm finally getting the hang of what a stack based machine is, and how to compile code for it. For example, the following code: 2 * 5 + 1 ...
Aviv Cohn's user avatar
  • 21.5k
3 votes
2 answers
486 views

Do VMs use one stack for everything? [duplicate]

Most VMs have a "call stack" to keep track of where to return from each function that was called. This is often simply regarded as "the stack". However often a stack is needed for operations that ...
Aviv Cohn's user avatar
  • 21.5k
6 votes
1 answer
3k views

How do VMs implement function calling?

I'm reading a compiler textbook that compiles to some form of assembly. Since I don't know this assembly language I decided to invent my own simple "assembly language" and implement a basic "virtual ...
Aviv Cohn's user avatar
  • 21.5k