|
Hi All,
I got a idea to speed up JJOS a
little bit.
For the right now, we are using
switch statement to interrupt the Java Bytecodes.
i.e.
swtich (bytecodes) {
case 0: do_opcode_0();
break;
case 1: do_opcode_1();
break;
............
............
............ ............
}
It is slow. every opcodes needs one to hundred comparsion so that they can
perform the operation.
well, yup, we can store all the bytecode operation function into a array.
It can run a little faster.
i.e.
function_list = { do_opcode_0, do_opcode_1, ...........};
(*function_list[bytecodes * sizeof(function_list[]])();
But It needs several mulitplation(*) and addition(+). and then we make a
call. It is not fast enough.
maybe we can do it in another way.
For the right now, Java bytecode in JJOS are a serial of i386 "Call"
instruction (in general). i.e.
push variable_a
Call Do_OpCode_0
mov ax, [bp+12]
mov variable_a , ax
push variable_b Call Do_OpCode_1mov ax, [bp+10]
mov variable_b , ax
push variable_c Call Do_OpCode_1.............
sths like that. When we load the class from Disk/Memory into JVM, we
convert each bytecodes into
a i386 "Call" Instruction and store into Memory. When a Java method call,
we simple jump to
the start of code. Will It be faster ? I think it will. Since We
Remove All the Comparsion / Multiplation(*) / Addition (+) for
each bytecodes. For Each Java Method Call , we just simply jump to
instruction set that we are already compiled. it will
be faster. But we need to precompile each Class when Class is uploaded into
memory. It is the time we need to pay.
Any Opinion ?
Regards,
Hilary
|
- Re: [JOS-Kernel] Some Idea About Speed Up JJOS Hilary Cheng
- Re: [JOS-Kernel] Some Idea About Speed Up JJOS John Morrison
- Re: [JOS-Kernel] Some Idea About Speed Up JJOS Hilary Cheng
- Re: [JOS-Kernel] Some Idea About Speed Up JJOS John Morrison
