Question

While all java byte codes are 1 byte wide, at points there are variable sized constants which could range from 1 byte to 8 bytes. How does java fetch these instructions with operands larger than one byte efficiently since this data access would be done unaligned. And lastly how does java virtual machine preform this operation on platforms that do not support unaligned data access (ex ARM,Alpha)?

Was it helpful?

Solution

It cannot be done efficiently. The solutions are (as you are likely to be aware of):

  • micro-assembler if feasibly (not ARM), reprogramming the CPU;
  • load time transformation: a better, faster interpreted byte code (unlikely);
  • load time transformation: a simple compilation;
  • extending the Just-In-Time compilation;
  • pre-compilation.

Mind, that the interpretation overhead of byte code is not that much higher than of word code, especially as the interpretation cycle itself has the largest overhead.

Nevertheless I did some work on older processors, with customizable optimizable interpreters, and there it helped.

The GNU java commpiler might be mentioned.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top