Fog Creek Software
Discussion Board




New Virtual Machine Anyone (Pt2) ?

Before this post falls off the page and out of your minds, please check the original post (further down the page).

Id be interested in hearing from anyone.

Regs,

James Ladd
Friday, June 21, 2002

I really wanna see a faster VM. But I admit I am a bit skeptical (due to the experience with some of the current VMs). Anyway, I think a project like this should have its own forum or newsgroup.

Good luck.

Sam Wong
Friday, June 21, 2002

This is all fine and good, but will it Frotz?

Anon
Friday, June 21, 2002

Ok you got me. What does "frotz" mean ?

James Ladd
Friday, June 21, 2002

hhgttg of course!

James Wann
Friday, June 21, 2002

That clears it up ... _NOT_

James Ladd
Saturday, June 22, 2002

http://www.geocities.com/SiliconValley/Heights/3222/frotz.html

vanguard
Sunday, June 23, 2002

Book Review: Virtual Machine Design and Implementation in C/C++

http://books.slashdot.org/books/02/06/25/1223234.shtml?tid=156

Thought you might find that interesting.

The Z-Machine is the virtual machine made by the Infocom guys so that Zork & other text adventure games would work on any computer. You could code the game in their proprietary language, compile, and run it on a C64, Atari, Apple ][ and whatever else was around at that time. There are Z-Machine interpreters for just about every platform that exists.

Since the language & compiler were proprietary, nobody could create text games until Graham T Nelson created Inform - a compiler for infocom style games.

http://www.inform-fiction.org/

Fun to play with when you want to hack code just for the fun of it.

MarkTAW
Tuesday, June 25, 2002

* nobody except the folks at Infocom, and anyone who had a heck of a lot of time on their hands to create a whole text adventure engine for scratch.

MarkTAW
Tuesday, June 25, 2002

Thanks for the link. Ill definately get that book. Especially as it talks about a register based machine, which is what I am doing. Though im using assembler and not C/C++.

Regs,

James Ladd
Tuesday, June 25, 2002

Now I am really confused.  Virtual machines are for portability... and you are writing it in assembler - which is not portable?

Joe AA.
Wednesday, June 26, 2002

"Now I am really confused. Virtual machines are for portability... and you are writing it in assembler - which is not portable?"

Don't confuse portability of the virtual machine itself with the portability of an implementation of a virtual machine. Not all virtual machines are intended to provide portability as their first goal, either.

I work with virtual machines that run on small processors (128 bytes RAM/2k code, 192 bytes RAM/4k code, 368 bytes RAM/8k code). The virtual machines allow us (http://www.vestatech.com/) to run our version of Basic on boards incorporating these processors. These machines are implemented in assembly for reasons of performance, in terms of both speed and capability. I don't think we'd have as capable a virtual machine if they'd been coded in C.

True, it's a different arena than you were probably thinking of, but that's the point ... portability *is* a major benefit of virtual machines, but it's not the only one, and it may not even be the major one in all cases.

Steve Wheeler
Wednesday, June 26, 2002

I guess I can say a definite maybe to that Steve.  In one of the earlier posts it mentions a VM to run on C64, Atari, Apple... which in that context means 6502/6510 machines - same CPU but possibly different memory mapping.

Joe AA.
Wednesday, June 26, 2002

Good comments steve.

The implementation of the VM is assembler, so the VM itself is not directly portable. However, HL languages implemented ontop of the VM will be when the VM is implemented on another platform.

The goal of the VM is speed and the ability to support a wide range of languages ontop of it.

When it comes to a new platform, the VM will be re-implemented in assembler for that platform. Again, any code written for the VM on one platform will run un-changed on the other platform. The VM is the abstraction.

Im also thinking of making the VM a 32bit machine where the smallest datum is 32bits. Yes, there would be a waste when storing a byte, but there are also other advantages for the VM is not handling multiple datums of different sizes.
You could (as a compiler writer) pack a 32bit value with byte values and use instructions of the machine to manipulate just a portion of the 32bit value. I see this as akin to a flat memory model.

Regs,

James Ladd
Wednesday, June 26, 2002

Does anyone have an opinion on what instruction set the VM should be based on and why ?

Please give details / justification for your opinion.

Regs,

James Ladd
Wednesday, June 26, 2002

Perhaps Forth coudl provide a workable prototype:

http://www.taygeta.com/forth/dpans.html

Ged Byrne
Thursday, June 27, 2002

register machine, four address code notation (meaning the most common instruction format has the semantics of "reg1 <- reg2 op reg3") or whatever variant  that better fits your setting.

Why? it's at least as quickly executable as stack based machines (such as Forth); It's just as easy to generate code for if you have an infinite number of regs (a bit more complex if you have a finite number, but not too complex if it's more than 4).

But reasoning about register code, optimizing it and/or translating it between different representations with efficient output is significantly easier for register machines.

Try to find Ron Cytron's thesis about "SSA" or Michael Brandeis "GSA" representation - they give an amazing insight into just how much more flexible register machines are (they don't use a classic four-address-code machine though - they replace branches with something that allows better reasoning still).

Ori Berger
Friday, June 28, 2002

This paper about the design of the Inferno virtual machine can offer interesting ideas.
http://www.vitanuova.com/inferno/papers/hotchips.html

Ramón
Sunday, June 30, 2002

All good comments, thanks. Keep em comming !

Regs,

James Ladd
Sunday, June 30, 2002

A register machine with a four address combo looks pretty kewl. So does the info on Inferno. Thanks people.

Please keep the suggestions coming.

Regs,

James Ladd
Sunday, June 30, 2002

What do you people think about calling the VM....
Navajo ?

Regs,

James Ladd
Tuesday, July 02, 2002

No... a more technical sounding name.

Try "H1B".

Joe AA.
Tuesday, July 02, 2002

*  Recent Topics

*  Fog Creek Home