Fork me on GitHub
#graalvm
<
2019-11-28
>
sogaiu03:11:13

@taylor i just noticed that one of my projects no longer builds with the changes in this commit: https://github.com/taylorwood/clj.native-image/commit/b3823a48be75122b9671c86ce5353a85589ef15f (it does build with the commit right before it) the output from native-image looks like this:

Error: Unsupported features in 12 methods
Detailed message:
Error: com.oracle.graal.pointsto.constraints.UnresolvedElementException: Discovered unresolved type during parsing: clojure.tools.reader.reader_types.IPushbackReader. To diagnose the issue you can use the --allow-incomplete-classpath option. The missing type is then reported at run time when it is accessed the first time.
Trace: 
	at parsing rewrite_clj.reader$unread.invokeStatic(reader.clj:115)
Call path from entry point to rewrite_clj.reader$unread.invokeStatic(Object, Object): 
	at rewrite_clj.reader$unread.invokeStatic(reader.clj:112)
	at rewrite_clj.reader$unread.invoke(reader.clj:112)
	at clojure.tools.reader.default_data_readers.proxy$java.lang.ThreadLocal$ff19274a.equals(Unknown Source)
	at java.util.HashMap.getNode(HashMap.java:579)
	at java.util.HashMap.get(HashMap.java:557)
	at com.oracle.svm.jni.access.JNIReflectionDictionary.getClassObjectByName(JNIReflectionDictionary.java:128)
	at com.oracle.svm.jni.functions.JNIFunctions.FindClass(JNIFunctions.java:314)
	at com.oracle.svm.core.code.IsolateEnterStub.JNIFunctions_FindClass_3ec1032c6cb9443725d1e68194130533bfb04076(generated:0)

sogaiu03:11:02

i tried what you mentioned in: https://github.com/taylorwood/clj.native-image/issues/15#issuecomment-550573681 , but got a result similar to what you got.

sogaiu03:11:22

i had "--initialize-at-build-time" before (build unsuccessful) and changed this to "--initialize-at-build-time=clojure"

jaihindhreddy12:11:09

I am a complete Graal neophyte, and I keep hearing stuff like "Graal is based on a closed world assumption". Here's what I'm wondering: 1. How does this tie into the dynamic nature of Clojure? 2. Which subset of Clojure's features and/or constructs are compatible with Graal? 3. Do the answers to the above two questions depend on whether we're talking about GraalVM HotSpot mode vs native image?

taylor20:11:16

The closed world thing only applies to AOT compiling your program to a native image

taylor20:11:51

Otherwise you can use the GraalVM basically as you would a JVM

taylor20:11:41

Compiling stuff to a native image does prohibit a lot of dynamic runtime stuff you could otherwise do with Clojure

borkdude13:11:20

@jaihindhreddy I'm only familiar with native image. Closed world means that it analyses reachable code at compile time and will strip everything not needed.

borkdude13:11:30

Kind of like the Google Closure compiler for CLJS + eval in CLJS

borkdude13:11:26

See https://github.com/lread/clj-graal-docs/blob/master/doc/external-resources.md for a list of projects that are currently working in graal

borkdude13:11:38

@lvh Did you end up announcing your blogpost somewhere? Maybe add it to ^