djrieger / mjplusplus

A compiler for the MiniJava language
http://djrieger.github.io/mjplusplus/doc/doxygen/html/
6 stars 1 forks source link

Incorrect assembler output when letting BasicInliner inline memory chains #115

Open djrieger opened 9 years ago

djrieger commented 9 years ago

When letting the BasicInliner inline simple functions with memory chains, all tests pass except for Simon_163. I narrowed the problem down to this simplified test case:

class a {
    public static void main(String[] args) {
        new a().q(4);
    }

    public void q(int i) {
        System.out.println(i);
        doNothing();
    }

    public void doNothing() {

    }
}

For this example, correct assembler is generated and the compiled a.out prints 4. When moving the line doNothing();one line up (i.e. swapping it with System.out.println(i);), the resulting assembler code differs (mov %rsi, 0(%rsp)for the Start node of q(int)is missing) and a.out prints 1606416856.