2 ms·
> Jikes, http://jikes.sourceforge.net/ http://jikes.sourceforge.net/ That is not a JVM, that is a Java compiler. Surely you know the difference. > Oh and post
by haberman 13y ago
> Jikes, http://jikes.sourceforge.net/ http://jikes.sourceforge.net/
That is not a JVM, that is a Java compiler. Surely you know the difference.
> Oh and post Java 8, Hotspot might be replaced with Graal a new JIT done in Java,
Good luck getting reasonable performance out of that.
But even if the JVM decides to go that way, a JIT is only one part of a VM. The interpreter and the GC will take particularly bad perf hits if you try to write them in Java.
- swift 13y agoI agree that the GC is a bad fit but I don't see any reason to believe that the interpreter is a particularly bad thing to write in Java. Can you elaborate on your reasoning?
- justincormack 13y agoInterpreters are very hard to optimise automatically. A huge case statement for the whole language in effect. C compilers don't do that well, still often written in assembler.
- vidarh 13y agoBut in this case they're talking about writing it in Java, and they have control over the Java compiler. In other words they have plenty of opportunities to ensure it optimises well: - Focus on ensuring the overall pattern optimises well. - Or recognising the special case of the JVM interpreter loop - Or adding a pragma of some sort to trigger special optimisations. Making it fast when compiled with an arbitrary compiler is another matter. But then even a lot of interpreters written in C often resorts to compiler specific hackery.
- justincormack 13y agoRecognising special cases is fragile. And the special optimisation may as well be "replace with this hand written code"... Compilers, well parts of them, are not really an example of the typical code you are trying to optimise.
- haberman 13y agoThe usual suspects mostly (guards/bounds checks, excessive boxing/unboxing, hard to do clever things wrt. memory, etc), magnified because an interpreter is in the inner loop of an interpreted VM.
- pjmlp 13y agoA JVM does not require an interpreter, that is an implementation detail, not part of the language. As for the GC, I can give the Squawk example which has a GC done in Java, targets embedded systems, with C/C++ only being used for hardware integration part. http://www.sunspotworld.com/ http://www.sunspotworld.com/ https://java.net/projects/squawk/pages/Home https://java.net/projects/squawk/pages/Home http://en.wikipedia.org/wiki/Squawk_virtual_machine http://en.wikipedia.org/wiki/Squawk_virtual_machine http://www.sunspotworld.com/docs/Yellow/javadoc/com/sun/squawk/package-summary.html http://www.sunspotworld.com/docs/Yellow/javadoc/com/sun/squa... http://dl.acm.org/citation.cfm?id=1094908 http://dl.acm.org/citation.cfm?id=1094908 Developers should learn about compiler design and not mix languages with implementations.
- haberman 13y ago> As for the GC, I can give the Squawk example which has a GC done in Java, targets embedded systems, with C/C++ only being used for hardware integration part. I didn't say it was impossible, just slow, and it is: "My third reservation is Squawk's performance, which is roughly that of the J2ME-derived Java KVM introduced a few years ago, an interpreted JVM that is written in C. From everything I have learned about it, the developers are assuming that most applications for the SPOT platform will include processors of sufficient power and that large amounts of memory will be available for garbage collection, pointer safety, exception handling and a mature thread library for thread sleep, yield and synchronization. That is not true in many cases, and if SPOT is limited to only sensor applications that are not performance-constrained, the platform is interesting but not all that important in the long run." http://www.embedded.com/electronics-blogs/cole-bin/4025677/Sun-s-SPOT-Squawk-VM-and-wireless-embedded-sensor-devices http://www.embedded.com/electronics-blogs/cole-bin/4025677/S...
- pjmlp 13y agoIt just needs to be fast enough to fulfill the required tasks, not a blazing thunder. This is how C replaced Assembly in many use cases, C++ replaced C in many use cases, ...
- 13y ago
- lucian1900 13y agoI believe this is what was meant to be linked http://jikesrvm.org/ http://jikesrvm.org/ That's an entire JVM written in Java, with only a small bit of C to bootstrap the JIT.
- pjmlp 13y agoCorrect, pasted the wrong link. Thanks for pointing that out.