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/.
borkdude 2020-02-27T11:11:26.058100Z

Clojure Rust GraalVM example updated: https://github.com/borkdude/clojure-rust-graalvm Now uses a Rust library to get the amount of free memory and displays it in EDN.

borkdude 2020-02-27T13:32:06.059200Z

@retrogradeorbit Included your cool trick of storing the lib in ~/.clojure_rust and loading it from there now: https://github.com/borkdude/clojure-rust-graalvm/commit/2c0d01c771c67400f5cae4aa596e6e58b29bd897

1👍
borkdude 2020-02-27T13:43:47.059700Z

@retrogradeorbit Where are the functions that you are calling from Clojure to C location in your source?

borkdude 2020-02-27T13:44:15.060Z

I mean the Clojure part calling into C

Crispin 2020-02-27T13:45:53.060700Z

for all of them just grep for SpireUtils

borkdude 2020-02-27T13:46:38.061200Z

ah here you define the native things in Java: https://github.com/epiccastle/spire/blob/master/src/c/SpireUtils.java so it looks like you're also using JNA right?

Crispin 2020-02-27T13:47:40.061900Z

not JNA, no. graal doesnt support JNA

borkdude 2020-02-27T13:47:52.062100Z

sorry JNI

Crispin 2020-02-27T13:48:01.062300Z

yep JNI

Crispin 2020-02-27T13:48:24.062800Z

so SpireUtils.java is used to generate SpireUtils.h

zilti 2020-02-27T13:48:32.063100Z

JNI is more performant anyway, right?

Crispin 2020-02-27T13:49:24.063600Z

yep. significantly more performant. but much more ceremony around it

Crispin 2020-02-27T13:49:42.064Z

JNA is almost magical.

Crispin 2020-02-27T13:49:52.064200Z

header file is generated here:

Crispin 2020-02-27T13:50:10.064900Z

so in JDK8 there was a special tool javah

Crispin 2020-02-27T13:50:22.065200Z

in JDK11 its bundled into javac

borkdude 2020-02-27T13:51:06.065600Z

Awesome. I added this to the graal docs repo: https://github.com/lread/clj-graal-docs#interfacing-with-native-libraries If you have anything to add there, feel free.

Crispin 2020-02-27T13:53:13.066Z

I can add some stuff sure

borkdude 2020-02-27T14:32:51.066300Z

I think adding the remarks about javah / javac could definitely be useful

Crispin 2020-02-27T14:35:07.066900Z

Yeah I will write a quick summary for the C library case.

Crispin 2020-02-27T16:02:09.067300Z

https://github.com/lread/clj-graal-docs/pull/30

borkdude 2020-02-27T16:05:01.067700Z

🙏 :thanks:

1👌