Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GraalJS should support Ahead-of-Time(AOT) compilation to Native binary like GraalPy. #8850

Open
Foxchandaisuki opened this issue Apr 28, 2024 · 5 comments
Assignees

Comments

@Foxchandaisuki
Copy link

GraalPy, which is Python implication of the GraalVM, supports AOT compilation to Native binary.

GraalPy is compiled ahead-of-time to a native executable.
This means that you do not need a JVM to run GraalPy and it is compact in size.

In time of now, most of main implications of Python and JavaScript do NOT support AOT compilation.

For example, NodeJS , Deno, and even Bun only supports Just-in-Time(JIT) compilation and they have no plan to support AOT.

However, the case of GraalPy shows us that making Script language to be compiled to Native binary is technically possible. And already there is an AOT compiler for Javascript like ChowJS, but unfortunately it is a closed source, and maybe a project NOT free of charge.

Static Hermes, which is being developed by Meta shows us that AOT compiling of JavaScript could be a killer feature of the project.

@sgammon
Copy link

sgammon commented Apr 28, 2024

It's not quite AOT, but:

GraalJs does support AOT, in the sense that you can use GraalJs in a native-image, using Truffle's SVM implementation. We do this with GraalJs, GraalPython, and TruffleRuby, all quite effectively.

@fniephaus
Copy link
Member

Thanks for the feature request, @Foxchandaisuki. I'm guessing you would like to see something similar to GraalPy's standalone application feature for Graal.js? Is that correct?

As @sgammon already pointed out: Graal.js it self can already be AOT-compiled and a js as well as a node distribution of Graal.js is what we release on GitHub, see for example: https://github.com/oracle/graaljs/releases/latest. Graal.js Maven artifacts are published on Maven central.

@Foxchandaisuki
Copy link
Author

@fniephaus

I'm guessing you would like to see something similar to GraalPy's standalone application feature for Graal.js? Is that correct?

That's correct.

I hope GraalJS was a something like Kotlin/Native for JavaScript.

@tarsa
Copy link

tarsa commented May 2, 2024

GraalPy, which is Python implication of the GraalVM, supports AOT compilation to Native binary.

GraalPy is compiled ahead-of-time to a native executable.
This means that you do not need a JVM to run GraalPy and it is compact in size.

In time of now, most of main implications of Python and JavaScript do NOT support AOT compilation.

For example, NodeJS , Deno, and even Bun only supports Just-in-Time(JIT) compilation and they have no plan to support AOT.

However, the case of GraalPy shows us that making Script language to be compiled to Native binary is technically possible. And already there is an AOT compiler for Javascript like ChowJS, but unfortunately it is a closed source, and maybe a project NOT free of charge.

Static Hermes, which is being developed by Meta shows us that AOT compiling of JavaScript could be a killer feature of the project.

IIUC, it's not the user's Python code that is AOT compiled, but the GraalPy runtime itself. GraalPy containts lots of Java code and that Java code is AOT compiled, so then you don't need JVM to run that Java code. Same thing goes for GraalJS

@sgammon
Copy link

sgammon commented May 2, 2024

@tarsa The user's Python code can be compiled as well. You would just have to make sure it is loaded and executed within the addressable context managed by native-image; often, Python/Ruby/JS is built into the binary to run arbitrary programs.

But that doesn't stop you from using Auxiliary Images, or from running a Truffle computation of some kind (regardless of language) at build time.

There is also GraalPy's Standalone Applications feature, as pointed out by @fniephaus

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants