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.
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.
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.