Welcome, Guest. Please login or register.

Author Topic: Java VM Update  (Read 3498 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16879
  • Country: gb
  • Thanked: 5 times
    • Show all replies
Re: Java VM Update
« on: March 24, 2003, 09:45:08 AM »
For the current generation of amiga HW, for Java to be anything other than an academic curiosity, we really need a JIT system and a decent native optimised port of the runtime classes (those that handle graphics/sound/io at least).

Bytecode interpretation is slow as hell. A thread based JIT, combined with register allocation has the potential to run at near native speed and would make Java a serious development tool for Amiga.
int p; // A
 

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16879
  • Country: gb
  • Thanked: 5 times
    • Show all replies
Re: Java VM Update
« Reply #1 on: March 24, 2003, 10:23:38 AM »
Quote

Kronos wrote:
A JIT in C++ ? I doubt that  ;-)


A common misconception. You can do anything in C++ that  you can do in C. That includes using hand coded assembly, low level pointer manipulation ect.
I know, I have done so myself, plenty of times.

Quote

A JIT has to be handcrafted to every single target-CPU, and
somehow I doubt that SUN would just hand out a 68k-version ....


Correct. You need to emit machine native opcodes. You also need to be able to manipulate data caches and the like (to properly flush the emitted opcodes).

Most of the high level interface could be written portably in C++. The low level back end that generates the code can be as target dependent as you like. You then create and use the appropriate back end for each system.

Take a look at the Kaffe sources to get an idea.
int p; // A
 

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16879
  • Country: gb
  • Thanked: 5 times
    • Show all replies
Re: Java VM Update
« Reply #2 on: March 24, 2003, 12:12:46 PM »
Quote

Kronos wrote:
@Karlos

Yes, I know, but IMO using inline asm and that stuff in a C++
means it ain't C++ but asm .....



Well, I would never, ever use inline asm in the C++ part of a project. The asm keyword should be dropped! I only do low level stuff deep in the implementation dependent part of a project. That's the only way to avoid dependencies.
For example, I basically declare methods empty in C++ code to get their signature from the generated asm source. I then write the asm implementation of the function myself.

Quote

Same goes for the old C-tricks.


Agreed. I don't use use them either, I was just pointing out for the bebefit of other people that you can if you wish to do so.

Quote

If you want to write a efficient JIT, you will have to go down to asm, there is simply no other way.


I don't think thats true, exactly. Is your C++ compiler written in asm? Or is it written in C++ itself? It's the efficiency of the generated code that's most important. A good JIT should be fast at generating code (such that generation times are small compared to load/setup), but it doesn't have to be written in asm. Just look at the 68040 JIT emulation that comes with UAE. Java bytecode is an order of magnitude simpler than any real CPU.

For Java, where code only exists inside methods (except static class code), my preference is for function based transcription. Whenever the VM first invokes a method, the JIT kicks in, transcripts the code and caches it for later.
int p; // A