code hoisting and optimization

Haluk Dogan hlk.dogan at gmail.com
Thu Sep 7 01:48:11 UTC 2017


Hello,

I'm trying to see the optimization steps by using Graal. I defined a
codeHoisting method in my Example class as in the following:

public class Example {

    public int[] codeHoisting(int x, int y, int n) {
        int[] result = new int[n];
        for (int i = 0; i < n; i++) {
            result[i] = x + y;
        }
        return result;
    }

}

Then, I used *compileAndInstallMethod* as shown in the Tutorial slides to
get the compiled code of given method. However, the resulting byte array is
different no matter we apply ALL or NONE optimizations.

I would expect the same byte array after we apply
OptimisticOptimizations.ALL.

Why the resulting byte arrays are different? Also, how can I print the
bytecode?

I put the gist of the code in the following link:

https://gist.github.com/anonymous/20c385bfbac1dfebffd648d88761274e

Thanks.

-- 
HD


More information about the graal-dev mailing list