Questions tagged [vm-implementation]

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.

294 questions
11
votes
2 answers

Is .NET memory management faster in managed code than in native code?

I would have thought that it would be clear cut whether memory allocation is faster in managed code than in native code - but there seems to be some controversy. Perhaps memory management under a Virtual Machine be faster because of no…
Josh
  • 7,936
  • 5
  • 41
  • 63
10
votes
1 answer

What is the most reliable / portable way to allocate memory at low addresses on 64-bit systems?

I need to allocate large blocks of memory (to be used by my custom allocator) that fall within the first 32GB of virtual address space. I imagine that if I needed, say, 1MB blocks, I could iterate using mmap and MAP_FIXED_NOREPLACE (or VirtualAlloc)…
Aardappel
  • 5,559
  • 1
  • 19
  • 22
10
votes
6 answers

How does PHP know what type of variables it uses (or does it)?

I haven't done much programing in many languages, but I know in C(++), you have to declare a variable type (int,char,etc). In PHP you, of course, don't have to do that. You can start with $str = "something"; then later $str = array("something" =>…
Jason
  • 3,357
  • 1
  • 22
  • 29
10
votes
5 answers

Execution speed of references vs pointers

I recently read a discussion regarding whether managed languages are slower (or faster) than native languages (specifically C# vs C++). One person that contributed to the discussion said that the JIT compilers of managed languages would be able to…
10
votes
4 answers

How to find out what optimizations the JVM applied to my code?

The JVM (especially the HotSpot VM) is famous for having a huge number of optimizations it can apply at runtime. Is there a way to look at a certain piece of code and see what the JVM has actually done to it?
soc
  • 27,983
  • 20
  • 111
  • 215
9
votes
3 answers

What's the difference of Squeak/Pharo/Newspeak Smalltalk VMs?

I saw 3 different VMs while learning about Smalltalk. They are Squeak/Pharo/Newspeak. What's the difference between them?
eonil
  • 83,476
  • 81
  • 317
  • 516
9
votes
6 answers

Custom programming language: how?

Hopefully this question won't be too convoluted or vague. I know what I want in my head, so fingers crossed I can get this across in text. I'm looking for a language with a syntax of my own specification, so I assume I will need to create one…
9
votes
6 answers

Writing a VM - well formed bytecode?

I'm writing a virtual machine in C just for fun. Lame, I know, but luckily I'm on SO so hopefully no one will make fun :) I wrote a really quick'n'dirty VM that reads lines of (my own) ASM and does stuff. Right now, I only have 3 instructions: add,…
David Titarenco
  • 32,662
  • 13
  • 66
  • 111
9
votes
5 answers

VM interpreter - weighting performance benefits and drawbacks of larger instruction set / dispatch loop

I am developing a simple VM and I am in the middle of a crossroad. My initial goal was to use byte long instruction, and therefore a small loop and a quick computed goto dispatch. However, turns out reality could not be further from it - 256 is…
user2341104
9
votes
2 answers

Why is Lua designed to generate intermediate opcodes?

I was reading Lua's source code and surprisingly found that it was implemented to generate some odd instructions (e.g. GETUPVAL, FORLOOP, etc.) Then those opcodes are executed by a virtual machine. Is there any benefit to do this (compared with pure…
babel92
  • 767
  • 1
  • 11
  • 21
9
votes
3 answers

PHP Request Lifecycle

Okay, so I'm relatively naive in my knowledge of the PHP VM and I've been wondering about something lately. In particular, what the request lifecycle looks like in PHP for a web application. I found an article here that gives a good explanation, but…
user131441
9
votes
3 answers

Output language/format for toy compiler

I took a compilers course in university, and it was very informative and a lot of fun, although also a lot of work. Since we were given a language specification to implement, one thing I didn't learn much about was language design. I'm now…
8
votes
2 answers

How does the Dalvik VM save and restore its registers between method calls?

Semantically, the Dalvik VM has a fresh set of registers for each method, and does not have instructions to access the call stack. But in terms of its implementation, the registers should be saved somehow on method calls and restored on method…
Pteromys
  • 1,441
  • 2
  • 12
  • 29
8
votes
6 answers

What does it mean that Squeak runs "bit-identically" across platforms, in a way Java doesn't?

Alan Kay points out that "Unlike Java, [Squeak] runs bit-identical on every machine -- we invented this 20 years ago". The wikipedia page mentions this also: Squeak is available for many platforms, and programs produced on one platform run…
Andrey Fedorov
  • 9,148
  • 20
  • 67
  • 99
8
votes
1 answer

Optimization techniques for backtracking regex implementations

I'm trying to implement a regular expression matcher based on the backtracking approach sketched in Exploring Ruby’s Regular Expression Algorithm. The compiled regex is translated into an array of virtual machine commands; for the backtracking the…
siracusa
  • 3,286
  • 1
  • 10
  • 19