Graal: float values are always 0.0f when passed down as a variable from JNI to Java

Created on 27 Apr 2020  路  4Comments  路  Source: oracle/graal

Describe the issue
When passing down a float variable from a native JNI method to the JVM layer, the value in JVM will always be 0.0f instead of the actual float value in JNI. The linked project uses env->NewObject() to construct a new instance of a Java class while passing a float value to the constructor. The value of this float in the Java-side is always 0.0f instead of 1.0f.

Steps to reproduce the issue

  1. git clone https://github.com/tiainen/graalvm-native-float-issue.git
  2. follow instructions in README.me

Describe GraalVM and your environment:

  • GraalVM version: CE 20.2.0-dev-20200426_0411 (master commit a64f618)
  • JDK major version: 11 (using OpenJDK 11.0.6)
  • OS: Windows 10
  • Architecture: x64

More details
There are no other issues or stack traces. We can only see that the value of the floats are always 0.0f. When running the program directly via java, the float values are passed down correctly.

bug native-image

Most helpful comment

As far as I know, this has been fixed with the following commit: https://github.com/oracle/graal/commit/fc2b286614994f9dd60748c96276c6ba62d4b271

All 4 comments

@pejovica any update on the issue please ?????

As far as I know, this has been fixed with the following commit: https://github.com/oracle/graal/commit/fc2b286614994f9dd60748c96276c6ba62d4b271

I agree, this looks very much like it's caused by the same underlying problem as #2397 . @tiainen could you test the newest development build and close this issue that resolves it? Thank you.

I can verify that the issue has been resolved with the latest development build.

Was this page helpful?
0 / 5 - 0 ratings