Skip to content

Graal gives different output when background compilations are disabled #4801

Closed
@connglli

Description

@connglli

Describe the issue

This is a JIT bug where Graal gives a different output from the interpreter or HotSpot's C1/C2 compiler only when the background compilations are disabled.

Steps to reproduce the issue

  1. javac T.java
  2. java -Xint T
  3. java T
  4. java -XX:-BackgroundCompilation T

The results of aaa and bbb are different, while expected to be the same.

Describe GraalVM and your environment:

  • GraalVM version: 22.3.0-dev
  • JDK major version: 11.0.16
  • OS: Ubuntu 20.04
  • Architecture: x86_64

More details

The following is the source of our tests:

class T {
  long a;

  void c() {}

  void z() {
    int i, j, q = 40574, v;
    double m = 2.51479;
    j = 1;
    while (++j < 139) {
      for (int w = 0; w < 5618; w += 1) c();
      v = 1;
      do m -= 0.853F;
      while (++v < 2);
      q = j;
      q &= v;
    }
    a += q;
  }

  void f() {
    z();
    System.out.println(a);
  }

  public static void main(String[] g) {
    T t = new T();
    t.f();
  }
}

Result of the interpreter:

$ java -Xint T
2

Result of Graal compiler w/ background compilations:

$ java T
2

Result of Graal compiler w/o background compilations:

$ java -XX:-BackgroundCompilation T
0

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions