flix / flix

The Flix Programming Language
https://flix.dev/
Other
2.08k stars 150 forks source link

Compile Flix with graal-native-image #6269

Open magnus-madsen opened 11 months ago

magnus-madsen commented 11 months ago

... and explore performance implications

jaschdoc commented 11 months ago

After my brief investigation with https://github.com/jaschdoc/flix/tree/graal it seems we can maybe get the build command to work with graal since we're not interacting with the live jvm that vscode uses. However, if the user tries to do any java interop outside of what the standard library uses it probably won't work as the parts of the compiler that rely on reflection to do java interop will fail (the dependencies do not exist at compile time). One way to fix this is to define a way to link with a jar that the compiler can look up at compile time.

jaschdoc commented 6 months ago

Btw, it may be quite easy to provide a native compilation target for Flix programs. Flix already builds a jar that contains all its dependencies, so running native-image on that jar should produce a native build that just works. I remember someone mentioning in the Gitter channel that they had it running with native-image without much effort.

jaschdoc commented 6 months ago

I'll look into compiling a hello world program with native-image

jaschdoc commented 6 months ago

Okay, I was able to create native image without much hassle, so maybe we should consider supporting this as an alternative compilation target (and require that the user has the native-image dependencies installed)?

magnus-madsen commented 6 months ago

Okay, I was able to create native image without much hassle, so maybe we should consider supporting this as an alternative compilation target (and require that the user has the native-image dependencies installed)?

I don't think we want to support anything, but it would be nice to have a document in docs which outlines the steps to create the image. Maybe you can make a PR with that?

jaschdoc commented 6 months ago

Sure thing

Update: see https://github.com/flix/book/pull/116