Re: [Sablevm-user] bug report -- cannot run 'HelloWorld' test
Brought to you by:
egagnon
From: John L. <je...@pi...> - 2000-07-28 02:37:37
|
> There's also John Leuner <je...@pi...> who talked to me about > porting his JIT to SableVM. You might want to talk with him about > that. Maybe you two could help each other. Hello Etienne, Andrew Andrew, I've been developing a JVM for the past while (kissme.sourceforge.net), it's implemented in C and targeted at (free) UNIX. My current project is a JIT written in Java that doesn't conform to the traditional SUN JIT spec. It comprises of an i386 Assembler written in Java (although I wish I had a 64-bit architecture :-)) that is used to translate bytecodes into machine code. A typical excerpt from the code: case op.iconst_5: qc("mov eax,0x5 ; iconst_5"); qc("push eax"); break; /* Load instructions These generally get the pointer to optop by calculating ebp + 0x8 and storing it in eax Then we add 0,4,8,12 to eax and push [eax] */ case op.fload_0: case op.iload_0: case op.aload_0: qc("mov eax,[ebp + 0x8]"); qc("push [eax]"); break; You can see I use an intel-style assembler syntax. I've basically replaced the java stack with the native C stack, and all the translated instructions operate on this native stack. Because of the nature of the translation the resulting code could probably be optimised a lot. Future work would be a second stage optimising version of this translator which uses conventional optimisation techniques to produce faster code. The translation gets more complicated when the VM wants to invoke a method or put a value into an array etc, currently I handle these cases by having the optimised code call back into a special C routine that does what is necessary. My next endeavor is to teach the "assembler" to understand some C structs and thus have easy access to the fields of necessary structures. If that can be done the only real special-cases will be method-invocation. My JIT is selective, it only compiles certain methods and I intend to insert some kind of profiling ability at a later stage. Unfortunately I had to stop working on this project for two months due to a sports injury but I've recovered enough to carry on working now. If you're interested in the code or just discussing jits or whatever, just let me know. John Leuner |