Skip to content

scala.collection.immutable.VM use of methodhandle breaks native-image #12129

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

Closed
johnynek opened this issue Aug 27, 2020 · 3 comments
Closed

scala.collection.immutable.VM use of methodhandle breaks native-image #12129

johnynek opened this issue Aug 27, 2020 · 3 comments
Labels

Comments

@johnynek
Copy link

This PR:

scala/scala#8779

seems to be breaking the ability to use graalvm native image for me:

here is an error output:

Error: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: Invoke with MethodHandle argument could not be reduced to at most a single call or single field access. The method handle must be a compile time constant, e.g., be loaded from a `static final` field. Method that contains the method handle invocation: java.lang.invoke.LambdaForm$MH/634445912.invoke_MT(Object, Object)
[bosatsu:3147]     analysis:  57,890.61 ms,  2.52 GB
To diagnose the issue, you can add the option --report-unsupported-elements-at-runtime. The error is then reported at run time when the invoke is executed.
Detailed message:
Trace: 
	at parsing scala.collection.immutable.VM.releaseFence(VM.java:25)
Call path from entry point to scala.collection.immutable.VM.releaseFence(): 
	at scala.collection.immutable.VM.releaseFence(VM.java:25)
	at scala.collection.immutable.HashSet$HashSetBuilder.result(HashSet.scala:1283)
	at scala.collection.immutable.Set$SetBuilderImpl.result(Set.scala:344)
	at scala.collection.immutable.Set$SetBuilderImpl.result(Set.scala:329)
	at scala.collection.generic.GenericCompanion.apply(GenericCompanion.scala:57)
	at fastparse.parsers.Combinators$Repeat.toString(Combinators.scala:496)
	at java.lang.String.valueOf(String.java:2994)
	at java.nio.charset.IllegalCharsetNameException.<init>(IllegalCharsetNameException.java:55)
	at java.nio.charset.Charset.checkName(Charset.java:315)
	at com.oracle.svm.core.jdk.Target_java_nio_charset_Charset.lookup(CharsetSubstitutions.java:78)
	at java.nio.charset.Charset.isSupported(Charset.java:505)
	at com.oracle.svm.jni.JNIJavaCallWrappers.jniInvoke_ARRAY:Ljava_nio_charset_Charset_2_0002eisSupported_00028Ljava_lang_String_2_00029Z(generated:0)

Error: Use -H:+ReportExceptionStackTraces to print stacktrace of underlying exception
Error: Image build request failed with exit status 1

It seems related to this graal issue: oracle/graal#955

It's a real shame to lose the ability to get native-image in scala.

original comment here:
scala/scala#8779 (comment)

@johnynek
Copy link
Author

my current work around is to use 2.12.11 which does not have this code and I can build. Obviously using 2.12.11 forever isn't a great long term strategy.

@SethTisue
Copy link
Member

duplicate of #12116?

@johnynek
Copy link
Author

Yes I think this is the same issue. Sorry for not checking carefully for duplicates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants