Tuesday, April 8, 2008

SO WHAT IS THE JVM?

The JAVA Virtual Machine is a stack representation of the programming architecture.Which means that independent of the platform used the java programs can be compiled using this virtual architecture where instructions are stored in a certain order to be executed.
Each time a method is invoked the sequence of events happen are:
1. A frame is created consisting of an operand stack, an array of local variables, and a reference to the runtime methods
2. A thread stores this set of frames in the from of a JVM stack in LIFO structure

In the frames the array of local variables is used to store the local methods and loacal variable parameteres .

1. The parameters are stored first, beginning at index 0.

For a constructor frame or an instance method, the reference is stored at location 0. Then location 1 contains the first formal parameter

For a static method frame, the first formal method parameter is stored in location 0, the second in location 1, and so on.

This is all done at compile time

AND WHAT EXACTLY IS A BYTE CODE ?

Bytecode is the intermediate representation of Java programs like in the form of assembly code. To have an idea of what the byte code represents can help a programmer design better and more efficient programs with better performance and memory usage tuning.

This bytecode is generated by the javac compiler. So when you have compiled your program a .class file is generated which is the bytecode file.

In Java the assembly code is prefixed with certain alphabets

aload-manipulating object reference

iload- manipulating integer code

cload , bload, dload- manipulating charecter, byte, double resp

AND WHAT IS MY CONTRIBUTION

I will have to do the following skeletal job for a decent thesis

a) change a JVM to collect bytecode frequencies -optimization of the code using comp arch concepts since java optimization works well for web browsers but in case of small embedded systems using java components the data is not very well known.Like for example in the case of a PDA how shall the bytecodes be optimized for better effeciency.The requirements go different from those of a standard desktop computer

b) change the JVM a browser uses to your modifed version

c) browse the net to collect statistics - These statistics could probabbly provide some insights into understanding how to improve and what to focus on while creating web browsers for small handheld devices.

Knowing what bytecode is generated for a sequence of Java instructions can help you write smaller and more efficient code.


No comments: