Skip to content

CIF simulator crashes on too many invariants

Simulating the following model results in a crash:

automaton def A():
    disc bool d = true;
    invariant d or d or d or d or d or d or d or d or d or d or d or d or d or d or d or d or d or d or d;
    location:
        initial;
end

group def G1():
    a1: A();
    a2: A();
end

group def G2():
    g1: G1();
    g2: G1();
end

group def G3():
    g1: G2();
    g2: G2();
end

group def G4():
    g1: G3();
    g2: G3();
end

group def G5():
    g1: G4();
    g2: G4();
end

group def G6():
    g1: G5();
    g2: G5();
end

group def G7():
    g1: G6();
    g2: G6();
end

group def G8():
    g1: G7();
    g2: G7();
end

group def G9():
    g1: G8();
    g2: G8();
end

group def G10():
    g1: G9();
    g2: G9();
end

g: G10();

The crash report states:

[Exception]
java.lang.RuntimeException: Compilation error.
	at org.eclipse.escet.cif.simulator.compiler.CifCompilerContext.compile(CifCompilerContext.java:1531)
	at org.eclipse.escet.cif.simulator.compiler.CifCompiler.compileSpec(CifCompiler.java:115)
	at org.eclipse.escet.cif.simulator.compiler.CifCompiler.compileSpec(CifCompiler.java:63)
	at org.eclipse.escet.cif.simulator.CifSimulator.loadSpec(CifSimulator.java:475)
	at org.eclipse.escet.cif.simulator.CifSimulator.simulateInternal(CifSimulator.java:216)
	at org.eclipse.escet.cif.simulator.CifSimulator.simulate(CifSimulator.java:115)
	at org.eclipse.escet.cif.simulator.CifSimulatorApp.runInternal(CifSimulatorApp.java:129)
	at org.eclipse.escet.common.app.framework.Application.run(Application.java:343)
	at org.eclipse.escet.common.app.framework.Application.run(Application.java:183)
	at org.eclipse.escet.common.eclipse.ui.BaseFileCommandHandler.run(BaseFileCommandHandler.java:261)
	at org.eclipse.escet.common.eclipse.ui.BaseFileCommandHandler$1.run(BaseFileCommandHandler.java:102)
	at java.lang.Thread.run(Thread.java:748)
Caused by: org.eclipse.escet.common.app.framework.javacompiler.RuntimeJavaCompilerException: Run-time Java code compilation failed (with 2062 source files):
with output (0):
with diagnostics (100):
    line 2739, column 11: ERROR: code too large for try statement
    line 2748, column 11: ERROR: code too large for try statement
    line 2757, column 11: ERROR: code too large for try statement
[...]
    line 3612, column 11: ERROR: code too large for try statement
    line 3621, column 11: ERROR: code too large for try statement
    line 3630, column 11: ERROR: code too large for try statement

	at org.eclipse.escet.common.app.framework.javacompiler.RuntimeJavaCompiler.compile(RuntimeJavaCompiler.java:187)
	at org.eclipse.escet.cif.simulator.compiler.CifCompilerContext.compile(CifCompilerContext.java:1529)
	... 11 more

The problem with too many invariants is that the code ends up in a single method, and that violates Java class file constraints. We encountered similar issues before. We need to split it up into multiple methods or so.