Re: Do we really need virtual machines?

Paul Robinson <postmaster@paul.washington.dc.us>
17 Dec 2004 00:31:14 -0500

          From comp.compilers

Related articles
[10 earlier articles]
Re: Do we really need virtual machines? Nicola.Musatti@ObjectWay.it (2004-10-09)
Re: Do we really need virtual machines? danwang74@gmail.com (Daniel C. Wang) (2004-10-09)
Re: Do we really need virtual machines? gah@ugcs.caltech.edu (glen herrmannsfeldt) (2004-10-09)
Re: Do we really need virtual machines? david.boyle@ed.tadpole.com (2004-10-12)
Re: Do we really need virtual machines? anton@mips.complang.tuwien.ac.at (2004-10-17)
Re: Do we really need virtual machines? Colin_Paul_Gloster@ACM.org (Paul Colin Gloster) (2004-10-21)
Re: Do we really need virtual machines? postmaster@paul.washington.dc.us (Paul Robinson) (2004-12-17)
Re: Do we really need virtual machines? gah@ugcs.caltech.edu (glen herrmannsfeldt) (2004-12-19)
Re: Do we really need virtual machines? tobias@berg.dichter.de (Tobias Bergmann) (2004-12-22)
Re: Do we really need virtual machines? vbdis@aol.com (2004-12-23)
| List of all articles for this month |

From: Paul Robinson <postmaster@paul.washington.dc.us>
Newsgroups: comp.compilers
Date: 17 Dec 2004 00:31:14 -0500
Organization: Compilers Central
References: 04-10-013
Keywords: VM, design
Posted-Date: 17 Dec 2004 00:31:14 EST

Nicola Musatti wrote:


> Hallo,
> According to their proponents virtual machines such as JVM and CLR are
> the solution to all our (programming) problems, of which portability
> is but one.


I'm not sure if that is what has been claimed, or if that's your opinion
    but if it is what is being claimed, it's obviously dead wrong.


A Virtual Machine solves one problem and only one: allowing a
particular binary program to be operated in a non-compatible
environment. That the environment may not exist anywhere except in
software isn't really relevant.


There are a number of areas that a virtual machine does not solve,
including source portability (care to say that you are certain you can
run a program unchanged on two different machines that use the same
virtual machine environment? Maybe you can but it is probably likely
you can't); execution efficiency in critical environments (nobody
writes a boot loader to run in multiple virtual machine environments)
and graphics standardization (a game to run on Windowz will be
different from one to run on Linux or the Macintosh even if it can run
in a virtual machine).


> Maybe it's just because when I learnt programming the p-machine was
> considered an interesting oddity, but with the exception of code that
> really must run unchanged on unknown platforms, I fail to see what do
> I gain from a virtual machine that I don't already get from a good old
> compiler/runtime support/standard library chain.


For text-based and batch processing in ordinary applications a virtual
machine may provide a bettet choice for targeting an application than
a recompile for dozens of targets. This may be one reason Ryan
McFarland COBOL is quite popular since the p-code for compiled
applications is the same for all platforms the compiler is written
for.


> After all, isn't gcc the most ported virtual machine of all?


I don't think GCC would qualify as a virtual machine as I think code
is generated to run natively, not to be interpreted.


> Now, this being the compiler forum, I'm interested in learning about
> the advantages of virtual machines from the compiler writer
> perspective.


It allows you to write the code generator once (as opposed to
rewriting the code generator for each target machine) and simply
rewrite (or recompile) the run-time library and virtual support
environment for each target machine (which you have to do anyway).
You would also have to rewrite the compiler's I/O routines to handle
differences in file management.


If the compiler itself can run on the run-time library then you might
not even have to rewrite any part of the compiler at all.


Paul Robinson
"The lessons of history teach us - if they teach us anything - that
nobdy learns the lessons that history teaches us."



Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.