13.10.2014 Views

OPTIMIZING THE JAVA VIRTUAL MACHINE INSTRUCTION SET BY ...

OPTIMIZING THE JAVA VIRTUAL MACHINE INSTRUCTION SET BY ...

OPTIMIZING THE JAVA VIRTUAL MACHINE INSTRUCTION SET BY ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

216<br />

Changing the definition of a multicode block in this manner also presents a challenge<br />

for profiling. At the present time, the profiler is able to end the current block as<br />

soon as a branch bytecode is encountered. Under the new system, the profiler would<br />

have to determine if the branch was taken before the block was ended. In the event<br />

that the branch was taken, a new block would begin. Otherwise, bytecodes would<br />

continue to be added to the current block. Consequently, changing the definition<br />

of a multicode block in this manner would only impact the selection of multicodes<br />

for branches that normally “fall through” to the following instruction rather than<br />

branching to another location. If bytecodes continued to be added to the same block<br />

after a branch was taken, the sequence would represent execution from two distinct<br />

points within the file. Attempting to represent code from two distinct locations within<br />

the file with a single opcode would present several large challenges. Whether these<br />

challenges could be overcome, and whether overcoming the challenges would offer any<br />

gains compared to current multicode selection techniques is unknown at the present<br />

time.<br />

10.2.2 Compatibility with Virtual Machines that do not Support<br />

Multicodes<br />

In its present implementation, performing multicode substitution generates a class<br />

file that does not strictly follow the Java Virtual Machine Specification. While the<br />

general structure of the file is identical, the specification dictates that bytecodes that<br />

are not defined by the Java Virtual Machine Specification will not occur in the code<br />

attribute of a legal class files. Consequently, performing multicode substitution results<br />

in illegal class files because they contain such bytecodes.<br />

It is possible to perform multicode substitution while retaining a legal Java class<br />

file. This can be accomplished by introducing a new attribute for each method in<br />

the class which contains a second copy of the code where multicode substitution has<br />

been performed. Because the Java Virtual Machine Specification requires unknown<br />

attributes to be silently ignored, introducing the new attribute has no impact on the<br />

functionality of virtual machines that do not include multicode functionality. Such<br />

virtual machines will ignore the multicode attribute and execute the original code.<br />

However, a virtual machine that supports multicodes will recognize the presence of<br />

the additional attribute and execute it, gaining the benefits multicodes provide.<br />

The cost associated with achieving compatibility with virtual machines that do<br />

not support multicodes relates to class file size. Previous studies have shown that

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!