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.

23<br />

Figure 2.6: Interpreter Engine Constructed Using Goto Statements<br />

formed. The arcs are used to illustrate the branches performed in order to execute<br />

the aload 0 bytecode.<br />

2.4.3 Indirect Threading<br />

It is still possible to reduce the number of branches performed. This is accomplished<br />

by using a technique referred to as threading. The general idea behind threading<br />

techniques is to remove the need to branch back to the top of the loop between each<br />

bytecode. Instead, the the flow of control transfers directly from the codelet for one<br />

bytecode to the codelet for the next bytecode, eliminating the need to branch back<br />

to the decode operation operation at the top of the loop.<br />

Indirect threading [41] accomplishes this task using a special array and goto statements.<br />

Each element in the array is initialized to the address of a codelet. One element<br />

is present in the array for each bytecode defined by the Java Virtual Machine<br />

Specification. Once the array is initialized, a bytecode can be decoded by loading the<br />

address of its codelet from the array and branching to it using a goto statement.<br />

Indirect threading completely eliminates the need for the switch statement. Instead,<br />

a small amount of extra code is added at the end of each of the codelets.

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

Saved successfully!

Ooh no, something went wrong!