Why Bytecode?

Maneesh Yadav 97yadavm@scar.utoronto.ca
Fri, 06 Feb 1998 20:09:09 -0600



Eric W. Biederman wrote:

> >>>>> "MY" == Maneesh Yadav <97yadavm@scar.utoronto.ca> writes:
>
> MY> OK, this may be a stupid comment, but I can't figure out a good answer.
> MY> Why is that VM's like java impliment their thing with a universal
> MY> bytecode?
>
> Efficiency, and portability.  A byte code is a no brainer to
> interpret, just do a switch on the byte code, and go to the right
> place to interpret that.
>

I find it hard to believe that writing an java interpeter is as easy as writing
a big switch statement in a loop.

> Also basic optimizations can be done ahead of time.
>

Certain optimizations that work on one processers may not optimize well on
another, past the algorithm level, (take branch prediction for instance on a 486
pentium and ppro)

> Besides I haven't seen a `universal' bytecode.
>
> MY> Why not concentrate on a VM with a readable language with a JIT and save
> MY> space by leaving it up to a compression algo.?
>
> MY> In order to prevent the code stealing, mangled sources could be used...
>
> Code's copyrighted so why do you need to worry about code stealing?
>

Oh yeah, I forgot it's a perfect world with perfect programmers :-)....

> MY> I realize that a bytecode is good since it resembles a processers
> MY> instruction set nad is small.  But why restrict a language to only work
> MY> with today's processing paradigms (who knows what's next).  Surely a
> MY> good HLL leaves more room for the future.
>
> It's expedient, simple, and well tested.  When that future comes you
> upgrade your virtual machine.
>

That's what I'm saying we could possibly prevent by not using a bytecode, no one
likes to upgrade unless they have to....

> MY> Doesn't bytcode just put an unessecary step in between
> MY> idea-> language->program?
>
> No.  It just specifies the form.
>

Couldn't that be done more elegantly in an HLL?

> Eric