[graalvm-dev] How to use compiled source GraalVM to run a java program?

Ofir Gordon ofirg6 at gmail.com
Sun Mar 22 02:15:08 PDT 2020


Great! I found the java files both in the graalvm build products and the
build graal-jvmci-8 products, your answer was very helpful.

Do you know if it is possible to compile the jvm such that it will be
compatible for an arm 32bit system? Is regular build (such as described in
the links in this thread) will be enough? or is it creating only a version
compatible for 64bit?

‫בתאריך יום א׳, 22 במרץ 2020 ב-10:50 מאת ‪Fabio Niephaus‬‏ <‪
lists at fniephaus.com‬‏>:‬

> On Sun, Mar 22, 2020 at 9:25 AM Ofir Gordon <ofirg6 at gmail.com> wrote:
> >
> > Thank you for your answer!
> >
> > When running mx --env ce graalvm-home I'm getting the following error
> message:
> >  "Could not find a JDK
> > The following JDKs are available:
> >   /usr/java/jdk-12.0.2
> >   /usr/java/openjdk1.8.0_242-jvmci-20.0-b02
> > Specify one with the --java-home or --extra-java-homes option or with
> the JAVA_HOME or EXTRA_JAVA_HOMES environment variable."
>
> Oh no, that's an mx error. You need to run `mx --env ce graalvm-home`
> inside the graal/vm directory. If that doesn't work, try this: `mx
> --env ce --java-home /usr/java/openjdk1.8.0_242-jvmci-20.0-b02
> graalvm-home`.
>
> >
> > The two jdks specified in the message are jdks that I downloaded, not
> the product of the graalvm compilation.
> >
> > What does it mean build a custom JVMCI-enabled OpenJDK? I cloned the
> graal project from here: https://urldefense.com/v3/__https://github.com/oracle/graal__;!!GqivPVa7Brio!KxpRLQ0X2ffkAi-J3tzVWhPGTeCmK7gKouP3G28ROuRIFNw2CtXlBLe1VzoCpVMzPOmteA$ 
> > and built the source code in it, under graal/vm.
> > Isn't this the JVM source code? Did I build the wrong code? What am I
> missing here?
>
> Disclaimer: I'm not on the GraalVM team, and my understanding of this
> process may not always be accurate.
>
> When you build a GraalVM, it copies over most of the JVMCI-enabled
> JVM's components (incl. GC). So the JVM you use to build GraalVM is
> basically a template for the resulting GraalVM. In your case, that
> would be /usr/java/openjdk1.8.0_242-jvmci-20.0-b02. The build process
> compiles and installs the Graal compiler as well as some other
> GraalVM-specific components.
>
> The graal-jvmci-8 repo [1] let's you build your own OpenJDK with JVMCI
> support, which mx accepts as a GraalVM template. So that's where you
> have to look for the JVM sources if you want to modify one of the GCs.
>
> Hope the above makes sense!
>
> Fabio
>
> [1] https://urldefense.com/v3/__https://github.com/graalvm/graal-jvmci-8__;!!GqivPVa7Brio!KxpRLQ0X2ffkAi-J3tzVWhPGTeCmK7gKouP3G28ROuRIFNw2CtXlBLe1VzoCpVPBvQdo2g$ 
>
> >
> > Again thank you for your help,
> > Ofir
> >
> >
> > ‫בתאריך יום א׳, 22 במרץ 2020 ב-1:22 מאת ‪Fabio Niephaus‬‏ <‪
> lists at fniephaus.com‬‏>:‬
> >>
> >> Hi Ofir,
> >>
> >> On Sat, 21 Mar 2020 at 10:19 pm, Ofir Gordon <ofirg6 at gmail.com> wrote:
> >>>
> >>> Hello,
> >>> I hope this is the right place to ask this question,
> >>>
> >>> I built the GraalVM jvm code from the project repository, using the
> following instructions. I think it completed successfully (didn't see any
> error messages), and it created a new folder graal\vm\mxbuild with what
> seems to be the compilation product.
> >>>
> >>> My question is, how do I use the compiled JVM to run a java program?
> usually I would expect some java execution file, but I can't find any.
> >>
> >> If you ran mx --env ce build to build it, mx --env ce graalvm-home
> should print the path to your custom built GraalVM home. This should
> contain the usual bin/ directory with the java binary you are looking for.
> >>>
> >>> My goal is to eventually change the jvm code in order to test the
> behavior of the GC, so if there is a differnt way to do it with the graalvm
> source code I'll appreciate your instructions.
> >>
> >> The JVM has lots of GC flags. But if that's not enough and you want to
> change the actual implementation of one of the GCs, I think you'd need to
> build a custom JVMCI-enabled OpenJDK (see [1]) with your patches and use
> that to build a GraalVM.
> >>
> >> Hope this helps!
> >>
> >> Fabio
> >>
> >> [1] https://urldefense.com/v3/__https://github.com/graalvm/graal-jvmci-8__;!!GqivPVa7Brio!KxpRLQ0X2ffkAi-J3tzVWhPGTeCmK7gKouP3G28ROuRIFNw2CtXlBLe1VzoCpVPBvQdo2g$ 
> >>
> >>
> >>> Thanks in advance,
> >>>
> >>> Ofir
> >>>
> >>> _______________________________________________
> >>> GraalVM-Dev mailing list
> >>> GraalVM-Dev at oss.oracle.com
> >>> https://oss.oracle.com/mailman/listinfo/graalvm-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://oss.oracle.com/pipermail/graalvm-dev/attachments/20200322/03c3be7e/attachment.html 


More information about the GraalVM-Dev mailing list