Re: Questions about Bytecode

Christopher Diggins <>
26 Apr 2007 09:38:09 -0400

          From comp.compilers

Related articles
[6 earlier articles]
Re: Questions about Bytecode (Andy Johnson) (2007-04-23)
Re: Questions about Bytecode (Hans-Peter Diettrich) (2007-04-23)
Re: Questions about Bytecode (2007-04-23)
Re: Questions about Bytecode (Chris Dollin) (2007-04-23)
Re: Questions about Bytecode (glen herrmannsfeldt) (2007-04-25)
Re: Questions about Bytecode (Peter Flass) (2007-04-26)
Re: Questions about Bytecode (Christopher Diggins) (2007-04-26)
Re: Questions about Bytecode (Christopher Diggins) (2007-04-26)
| List of all articles for this month |

From: Christopher Diggins <>
Newsgroups: comp.compilers
Date: 26 Apr 2007 09:38:09 -0400
Organization: Compilers Central
References: 07-04-061
Keywords: VM, interpreter
Posted-Date: 26 Apr 2007 09:38:09 EDT

On Apr 18, 10:50 am, "Bison" <> wrote:
> Hello everyone. I've been trying to read about VMs for quite some
> time now, and I am still a bit confused about compiling to bytecode.
> How would the typical structure of a bytecode-compiled file look? I
> don't think a java *.class file would be a good example here either,
> just because all java files are also classes.

You can use a bytecode disassembler. A few off of the top of my header
- ildasm.exe (
), for the Common Intermediate Language bytecode emitted by .NET
- OCaml byte code disassembler (
- Parrot byte code ( )

The fact that Java files are all classes shouldn't dissuade you from
looking at the Java bytecode. I strongly recommend reading the Java
bytecode specification

> More specifically, how would I represent literals, like String and
> numbers? The problem I have with this is, how could the VM
> differentiate between instructions and literal data? I've heard
> someone say that I could use a delimiter to mark start and end points.

What differentiates them, is simply what you do with it. If you try to
execute it, it must be code.

> I'm also wondering if things would likely go in a specific order. For
> example, should code and constants be logically seperated?

Not neccessarily, but it does makes everything more manageable.

> Also, I'm wondering if there are any decent readings on the subject
> other than source code. Are there any VMs that would be good examples
> (and that is open source)?

Parrot and LLVM spring to mind. Personally I liked learning about
bytecode using the CIL (a.k.a. MSIL) since the free tool support is
superb on Windows (C# visual studio express and ildasm.exe). There is
even an API in .NET for generating byte-code (

Christopher Diggins

Post a followup to this message

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