[612] in java-interest

home help back first fref pref prev next nref lref last post

Has the bytecode gone native?

daemon@ATHENA.MIT.EDU (sbk@netcom.com)
Fri Jul 7 23:38:44 1995

From: sbk@netcom.com
To: java-interest@java.Eng.Sun.COM
Date: Thu, 6 Jul 1995 11:04:59 -0700 (PDT)

I have a couple of questions about the bytecode to native code
translator that is in the works.

- What is the status of the implementation? And is anyone working on
  an x86 version?

- It seems like there are at least two ways in which the translator
  can be used -- to statically convert compiled java classes into
  native code, or to augment the interpreter so it can dynamically
  convert a stream of java bytecodes into native code for further
  execution. Is the plan for the translator coming from the java team
  to do both?

Out of curiosity, I wrote a very small subset java bytecode
interpreter that dynamically and naively converts bytecode for a
method into Sparc code prior to invoking the method. For what it is
worth, here is what I did and found.  The test program adds a couple
of arrays. The "main()" method of the benchmark is translated into
Sparc code and invoked. No optimization of any kind, so there is
considerable memory traffic. Each bytecode is converted into about 4-5
sparc instructions.

For instance, the bytecode corresponding to
bipush 10
is converted to (the machine code equivalent of)
mov 0xa, %l0
st %l0, [%i0 + 4]
add %i0, 4, %i0

There is no bounds checking.

Here is what I got, this is on a Sparc10 running Solaris 5.4.

C, gcc2.5.6 -O :      2.0u 0.0s 0:02 86% 0+0k 0+0io 0pf+0w
translator:           10.0u 0.0s 0:10 94% 0+0k 0+0io 0pf+0w
java interpreter:     60.0u 0.0s 1:03 94% 0+0k 0+0io 0pf+0w

It is use-once code, but if you are curious, the interpreter is at
ftp://ftp.netcom.com/pub/sb/sbk/foo.tar.gz. Don't expect to run
anything more than the benchmark :-)

The java version of the test program is:
class perf
{
  public static void main(String argv[])
    {
      int a[], b[], c[], i, j;

      a = new int[10000]; b = new int[10000]; c = new int[10000];

      for (j=0; j<1000; j++)
        for (i=0; i<10000; i++)
          a[i] = b[i] + c[i];
    }
}

-KB-

-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post