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.

142<br />

length n (the entire multicode block itself). By counting the number of times each<br />

candidate sequence occurs across all multicode blocks, one can obtain the complete<br />

set of candidate sequences executed, as well as the number of times each sequence<br />

executed.<br />

Performing multicode identification on the blocks shown in Figure 7.2 began by<br />

determining all subsequences of length 2. This revealed that a total of 7 sequences<br />

with length 2 are present. Three of these sequences are contributed by Block 1:<br />

aload 0 → getfield, getfield → aload 0, and aload 0 → getfield. Four additional<br />

sequences with length 2 are contributed by Block 2. However, while a total of<br />

7 sequences with length 2 are present, only four of the sequences are distinct. For<br />

example, the sequence aload 0 → getfield occurs three times. The identification<br />

process went on to consider all sequences of length 3, 4 and 5 in the same manner.<br />

Table 7.1 presents some of the information needed to perform multicode identification.<br />

In addition to enumerating the set of unique candidate sequences, the table<br />

maintains the number of times each sequence appears. This count, in conjunction<br />

with an analysis of a specific candidate sequence, can be used to establish a score<br />

representing how much optimization potential the candidate sequence has. In the<br />

table, a very simple scoring procedure was used; the number of times the candidate<br />

sequence appears multiplied by the length of the candidate sequence. Other scoring<br />

algorithms will be presented later.<br />

Using maximum score as the basis for selection, the table indicates that aload 0<br />

getfield should be the first multicode selected. However, attempting to use the<br />

table to determine the second multicode poses problems. To see why, assume that<br />

the first substitution is performed, using mc to indicate the multicode aload 0 →<br />

getfield. The two multicode blocks will change to the following:<br />

Block 1:<br />

Block 2:<br />

mc → mc →<br />

getfield → aload 0 → getstatic → mc →<br />

From the blocks shown above, it is obvious that Table 7.1 cannot be used to<br />

establish the second multicode. Almost all of the candidate sequences in the table no<br />

longer exist, and most of the others will have their occurrence count (and thus their<br />

score) changed because of the first multicode substitution.<br />

This issue suggests an iterative algorithm for multicode identification. The profiling<br />

work provides an initial stream of bytecodes, which is broken into a collection<br />

of multicode blocks, and then used to obtain a set of candidate sequences and associated<br />

scores. The candidate sequence with the best score is chosen as the first

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

Saved successfully!

Ooh no, something went wrong!