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/.
littleli 2020-04-25T21:37:52.208200Z

There is eventually also different way to use SQLite. By using Graalvm polyglot API and sulong.

peterschwarz 2020-04-26T21:29:49.210Z

That would be interesting, but would require writing a the interaction from top to bottom, versus being able to use existing JDBC code

peterschwarz 2020-04-26T21:30:51.210200Z

the current JDBC drivers include the native binaries in the jar and move them around, which doesn't seem to play well with native image and clojure (at least as far as I've been able to manage).

littleli 2020-04-25T21:38:16.208300Z

It's slightly difficult for me to explain, since I'm not C/C++ experienced. But in theory, you can compile SQLite using llvm-toolchain to llvm-bitcode and than using sulong and polyglot to interact and interop with such compiled sqlite shared object. There is a notation to map structures from native-c as described here: https://github.com/oracle/graal/blob/master/substratevm/src/com.oracle.svm.tutorial/src/com/oracle/svm/tutorial/CInterfaceTutorial.java Obviosly it's a great deal of work.

littleli 2020-04-25T21:44:29.208700Z

To demonstrate something visible everyone can run SQLite on JVM by doing following on sqlite source:

export CC=$(lli --print-toolchain-path)/gcc
$CC -o sqlite -DSQLITE_THREADSAFE=0 shell.c sqlite3.c -ldl
lli --jvm sqlite
the last command actually runs sqlite compiled to llvm-bitcode with sulong interpreter directly on JVM. To interact with such a thing of course there has to be some envelope. It would be a great project for some Oracle Labs intern. I mean great example of the capabilities.

littleli 2020-04-25T21:46:38.208900Z

It's probably wrong on some assumptions, but still...