New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jaotc: long compile time for synthesized class files #288

Closed
tianxiaogu opened this Issue Jan 24, 2018 · 3 comments

Comments

2 participants
@tianxiaogu

tianxiaogu commented Jan 24, 2018

It takes a long time for jaotc to compile the attached generated class file (C0.class).
Actually, there are a couple of classes that can trigger the same behavior.
Since they may have the same cause, I attached just one of them here.

$ time ./openjdk/jdk/build/linux-x86_64-normal-server-release/jdk/bin/jaotc --output C0.so C0.class
Error: Failed compilation: C0.M7([Ljava/io/Serializable;[ZLjava/lang/Short;[ZFLjava/lang/Float;S[BC)J: java.lang.StackOverflowError

real	1m51.830s
user	7m12.364s
sys	0m2.364s
$ echo $?
0
@dougxc

This comment has been minimized.

Member

dougxc commented Jan 24, 2018

Thanks for the report. I've managed to come up with a unit test that reproduces the long compile time:

package org.graalvm.compiler.core.test;

import org.graalvm.compiler.core.common.GraalOptions;
import org.junit.Assert;
import org.junit.Test;

import jdk.vm.ci.meta.ResolvedJavaMethod;

public class TrivialInliningExplosionTest extends GraalCompilerTest {

    public static void M0() {
        M0();
        M0();
        M0();
    }

    public static void C0() {
        M0();
        M0();
        M0();
        M0();
        M0();
        M0();
        M0();
        M0();
        M0();
    }

    @Test
    public void test() {
        ResolvedJavaMethod methodC0 = getResolvedJavaMethod("C0");
        ResolvedJavaMethod methodM0 = getResolvedJavaMethod("M0");
        Assert.assertTrue(methodM0.getCodeSize() <= GraalOptions.TrivialInliningSize.getValue(getInitialOptions()));
        getCode(methodC0);
    }
}

It's still running after about 15 mins on my Mac.

@dougxc dougxc self-assigned this Jan 24, 2018

@dougxc

This comment has been minimized.

Member

dougxc commented Jan 24, 2018

It seems the solution is to reduce the default value for -Dgraal.InlineDuringParsingMaxDepth from 10 to 3. I'll push a fix soon. This seems to fix the jaotc issue as well:

> time jaotc -J-Dgraal.InlineDuringParsingMaxDepth=3 C0.class
11.95user 0.51system 0:03.89elapsed 320%CPU (0avgtext+0avgdata 260508maxresident)k
0inputs+8outputs (0major+68507minor)pagefaults 0swaps

/cc @veresov

dougxc added a commit that referenced this issue Jan 25, 2018

@dougxc

This comment has been minimized.

Member

dougxc commented Jan 25, 2018

The underlying Graal issue is fixed by 1b0ce5a. This probably won't show up in jaotc until JDK 11. Until then, adding -J-Dgraal.InlineDuringParsingMaxDepth=3 to the jaotc command line is the recommended workaround.

@dougxc dougxc closed this Jan 25, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment