
Translating JVM Code to MIPS Code 235
Bar .. Dispatch :
. word 6 # the number of entries in our table
. word Object . clone
. word Object . equals
. word Object . t o S t r i n g
. word Bar . f
. word Foo . foo
. word Bar . bar
Arrays are a special kind of object; they are dynamically allocated on the heap but lie
outside the Object hierarchy. A possible layout for an array is illustrated in Figure 6.17.
FIGURE 6.17 Layout for an array.
Arrays have a type tag of 1. The size in bytes is the size of the array object in bytes,
that is, 12 + n ∗ bytes, where n is the number of elements in the array and bytes is the
number of bytes in each element. The array