graalvm

Discuss GraalVM related topics. Use clojure 1.10.2 or newer for all new projects. Contribute to https://github.com/clj-easy/graal-docs and https://github.com/BrunoBonacci/graalvm-clojure. GraalVM slack: https://www.graalvm.org/slack-invitation/.
dominicm 2020-09-26T09:00:03.003400Z

It seems that initialize-at-build-time is required for the hello world example, I think it was mentioned elsewhere as an optional optimization.

borkdude 2020-09-26T09:10:58.003700Z

no, it's mandatory for all Clojure GraalVM programs afaik

dominicm 2020-09-26T09:46:37.003900Z

https://github.com/lread/clj-graal-docs#class-initialization > For Clojure programs it is often actually feasible (unlike in a typical Java program) to change it back via --initialize-at-build-time to achieve yet faster startup time. Gave me the impression of optional. It's a bit of a pain because somehow this is causing Netty's PooledByteBuffer to be loaded at build time, which then fails. But Graal can't trace the loading class for me 🤕 This native stuff is hard

borkdude 2020-09-26T10:15:13.004300Z

@dominicm You can set run time initialization per class

borkdude 2020-09-26T10:15:36.004700Z

--initialize-at-run-time=<the class>

dominicm 2020-09-26T10:16:30.005200Z

@borkdude the problem is that PooledByteBuffer is forced to be runtime (by the netty config), but then something which is initialized at build time, is initiailizing PooledByteBuffer. I don't know what something is, and graal can't tell me in this specific scenario.

borkdude 2020-09-26T10:16:47.005500Z

ah right. sometimes this can be solved by wrapping things in a delay

dominicm 2020-09-26T10:16:57.005600Z

Not my code unfortunately, it's in Lettuce.

dominicm 2020-09-26T10:17:22.005700Z

I suspect Lettuce is incompatible with build time flag, and the initialization tracing doesn't work when it's loaded via the configs.

borkdude 2020-09-26T10:18:02.006100Z

Maybe check https://github.com/BrunoBonacci/graalvm-clojure for similar examples that do work

dominicm 2020-09-26T10:20:09.006400Z

No redis in there unfortunately, but jedis works fine :)

lread 2020-09-26T17:34:55.007400Z

@dominicm I agree that the wording under that section is confusing.

lread 2020-09-26T17:38:52.009100Z

@borkdude, I think we are simply trying to convey that we need to initialize at build time, but one can still defer specific classes to initialize at runtime?

borkdude 2020-09-26T17:59:40.009600Z

I think that's a better wording yes, I don't know the details of why this is needed

alexmiller 2020-09-26T18:35:49.010200Z

btw, Clojure 1.10.2-alpha2 has a few fixes that came from @borkdude related to reflection in case that helps y'all

borkdude 2020-09-26T18:38:01.010800Z

@alexmiller Thanks for accepting those patches. Two relevant other patches: - https://clojure.atlassian.net/browse/CLJ-2582 - https://clojure.atlassian.net/browse/TCHECK-157

borkdude 2020-09-26T18:41:32.011300Z

The TCHECK one is relevant if one is going to generate random data in a graalvm native binary e.g. using spec

lread 2020-09-26T20:33:24.012300Z

Thanks @borkdude and @alexmiller, I shall update our little clj-graal-docs repo!

1💯1✔️
borkdude 2020-09-26T21:08:39.012800Z

@lee Why did you upload the README of clj-graal-docs to TCHECK-157?

lread 2020-09-26T21:09:03.013300Z

uh.

borkdude 2020-09-26T21:09:54.013500Z

lread 2020-09-26T21:10:07.013900Z

wha…

borkdude 2020-09-26T21:12:05.014300Z

hm maybe that's an automated thing when you mention the issue in a git repo?

lread 2020-09-26T21:14:49.014700Z

I do have slippery fingers sometimes.. but…

borkdude 2020-09-26T21:16:29.015Z

Nice improvements btw, table of contents

lread 2020-09-26T21:18:22.015900Z

oh maybe I did upload it accidentally… I was previewing the README in firefox and might have dragged it over… which… hmmm.. oops…

lread 2020-09-26T21:21:44.016600Z

ya that must be it… sorry about that! Not sure how to delete it now.

borkdude 2020-09-26T21:22:30.016900Z

if you hover over those files, a trash can will appear

lread 2020-09-26T21:23:13.017400Z

ah had to go to jira “old view”. got it, tx!

borkdude 2020-09-26T21:25:44.017600Z

there's still one left :)

lread 2020-09-26T21:26:38.017900Z

got it! tx!

lread 2020-09-26T21:26:56.018300Z

yeesh, I can be dangerous!

borkdude 2020-09-26T21:27:28.018700Z

interesting way to promote the info in that README for sure :)

lread 2020-09-26T21:31:01.019600Z

As in “may you drag and drop in interesting ways”. :-)

1
borkdude 2020-09-26T21:41:25.020200Z

Pondering about an idea to leverage clojure git libs for (GraalVM or other) binaries: https://github.com/babashka/babashka.pods/issues/19