-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
GraalVM-built native image does not support Unsafe.staticFieldOffset() method #2694
Comments
Actually, I'm not sure whether it is a bug or not. If it is 'just not implemented yet', are there any plans to support this feature? If I just do something wrong, please let me know.
|
When I add
to
So it looks like Unsafe field offsets are not supported in native mode on purpose. Still, it's interesting to know why and whether this will change in the future. |
Fixed by 46cd5c7. |
@cstancu The commit you mentioned 46cd5c7 was made on July, 17, so it seems that the issue should be fixed in the nightly builds for a looong time. But it is still present in the nightly build I downloaded today. I've put together a demo project: https://github.com/rpuch/native-unsafe-static-field-offset GraalVM's java identifies itself as follows:
I did not find a way to reopen the issue. Could please anyone do it? |
The issue persists in current GraalVM versions as well:
|
You are right, that commit only updated the internal mechanism to properly support |
@cstancu : Hey, thanks for the fix! :) It looks like this fix is also important for making Scala 3 work with GraalVM native image. Currently, with GraalVM 21.1.0, I'm getting this error:
where the code in the class Do you maybe have an idea when this fix will land in production? |
@makingthematrix I had the very same error (Scala 3, GraalVM CE 21.1.0) but I managed to run native image successfully. Are you sure that you passed |
I'm sure I don't do that :) why? and how? |
Describe the issue
Unsafe.staticFieldOffset()
causes an exception when invoked inside a native image:Steps to reproduce the issue
Test.java
:javac Test.java
java Test
to verify that it works (it does)native-image --no-server --no-fallback Test app
./app
Describe GraalVM and your environment:
I tried both the latest released version (20.1)
and the latest snapshot version (20.2):
JDK version is 11
OS is Ubuntu Linux 16.04, kernel version 4.15.0-107-generic
Architecture is Amd64.
The text was updated successfully, but these errors were encountered: