Review E: Efficiently implementing objects

printable version

E: [1] [2] [3] [4] [5] [6] [7]

Problem E.1

Given the following class definition that the compiler translates using the CIR format given at right, show how a compiler could translate the f method into an ARM assembly language subroutine.

class A extends Object {
    int x;

    A(int y) {
        x = y;
    }

    int f(int z) {
        return z * x;
    }
}
A's CIR format
0A_VMT
4x