So here it is, the first method from the all new Shark, String.hashCode(). And the same method from old Shark for comparison. Some highlights:

  • The inner loop for the actual calculation is 18 instructions (down from 53)
  • A complete pass through the method when fetching a cached hashcode is 39 instructions (down from 66)

All in all I’m pretty pleased with myself.

7 thoughts on “

  1. That’s great !!! So we already have the ubiquitous “all architectures” interpreter, and next we also will have it’s brother the ubiquitous “all architectures” JIT compiler. Porting Java to new architectures will become simple !!!!

  2. Porting Java to new architectures should be not so much “simple” as “not required”, though you will only have the interpreter unless LLVM supports your CPU.

    Also, a minor nit, I saw you used the term “platform independent” in the Wikipedia articles, but “platform” to me suggests the combination of CPU and OS, and Zero and Shark are CPU-independent but Linux-specific.

  3. I fixed the article: “This port is intended to allow the interpreter part of HotSpot to be very easily adapted to any Linux processor architecture”, and “Achievement of this work would made the Java Virtual Machine independent of the CPU architecture.” That said, again great work !!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.