14 ms·
GraalVM
- nwmcsween 6y agoDoes graalvm work with openjdk or any java VM alternative? And does Graalvm have the weird Oracle no business use license that Oracle Java has?
- ksec 6y agoYou can use Redhat distribution of GraalVM. https://github.com/graalvm/mandrel https://github.com/graalvm/mandrel
- doikor 6y agoThe community edition of GraalVM is licensed under GPLv2
- toyg 6y agoGraalVM is “open core”: the community edition is free as in freedom, but the enterprise version (which you need for any serious production usage) is commercial and “Oracle expensive”. It’s a bit of a shame, because it’s really nice tech, but it will likely continue to struggle for adoption as long as it’s owned by Oracle. I wish they would spin it off; the same product, with more or less the same commercial model, would probably work very well in the market, as long as it lived far away from the the toxic Oracle-licensing nightmare.
- eyelidlessness 6y agoSo... the polyglot featureset is simultaneously terrifying and super impressive.
- greatjack613 6y agoAs an engineer who lives and breathes java, both in the context of high performance servers and android apps, can someone explain what this does for me besides for quick startup times through the native image feature? what are the benefits of this?
- hedora 6y agoJava’s linker is based on an open world assumption, where you can add arbitrary stuff to the classpath and dynamically link it at runtime. This defeats most compiler optimizations, so you’re left with the JIT. GraalVM makes a closed world assumption, so it can do things like dead code elimination (for library functions that don’t get called), and apply static analysis to inline virtual method calls, perform constant propagation, and so on. This lets it greatly outperform the JVM, at the expense of some rarely used functionality. Basically, it’s like switching from the JIT to a C compiler’s -O3.
- bdibs 6y agoAnd is that with their javac or is it reserved only for their native image generation?
- smabie 6y agoIn my experience, native image is noticeably slower than regular openjdk, at least for Scala. The start up speed is nice, though.
- asymptotically2 6y agoYou need to pay Oracle $lots for a GraalVM enterprise licence to get profile guided optimisations, if you want some of your peak performance back.
- pjmlp 6y agoTwitter thinks otherwise, as they are the major consumer of GraalVM in production.
- ridiculous_fish 6y agoCan someone please give a sober explanation of what GraalVM, is and how Truffle works? I think it is somewhat analogous to LLVM: Graal exposes a "language agnostic" API which allows multiple front-ends. There's a front-end for Ruby, JS, C++, others. But this API is higher level than LLVM: it knows about objects, and allows tricks like querying properties across language boundaries. But I can't imagine what this API looks like! For example, graaljs exists: how do JS semantics get expressed in a Java VM? What does a getProperty instruction look like? How does it know when to invalidate inline caches?
- sanxiyn 6y agoHere is Truffle's Javadoc: https://www.graalvm.org/truffle/javadoc/overview-summary.html https://www.graalvm.org/truffle/javadoc/overview-summary.htm... See especially Assumption, CallTarget, and DynamicObject.
- fniephaus 6y ago> Can someone please give a sober explanation of what GraalVM, is and how Truffle works? GraalVM is basically a JVM with a new compiler, the Graal compiler. Truffle is the language implementation framework for GraalVM and designed to build AST interpreter. The Graal compiler can optimize Truffle ASTs through partial evaluation (see "One VM to rule them all" paper [1]), and produces machine code directly without using Java bytecode as IR. > how do JS semantics get expressed in a Java VM? Graal.js comes with a parser for JavaScript code that generates a Truffle ASTs for a given JavaScript program. JS semantics are defined within the AST nodes (see [2]). > What does a getProperty instruction look like? I think getProperty is implemented in `CachedGetPropertyNode` [3], but I am not sure as there are multiple other property-related nodes. > How does it know when to invalidate inline caches? Unfortunately, Graal.js lacks documentation for `CachedGetPropertyNode`. But I encourage you to have a look at SimpleLanguage [4], a JS-like toy language and the reference language implementation for Truffle with proper documentation. [5] explains how reading properties and invalidating inline caches works and it's all done using the Truffle DSL. The `@Specialization` annotation [6] might be a good starting point if you want to learn how it works. You may also want to check out the docs on the GraalVM website (e.g. [7]). [1] https://doi.org/10.1145/2509578.2509581 https://doi.org/10.1145/2509578.2509581 [2] https://github.com/graalvm/graaljs/tree/a36b978aa328a8da3a7f9e2b354257f8a817409d/graal-js/src/com.oracle.truffle.js/src/com/oracle/truffle/js/nodes https://github.com/graalvm/graaljs/tree/a36b978aa328a8da3a7f... [3] https://github.com/graalvm/graaljs/blob/a36b978aa328a8da3a7f9e2b354257f8a817409d/graal-js/src/com.oracle.truffle.js/src/com/oracle/truffle/js/nodes/access/CachedGetPropertyNode.java https://github.com/graalvm/graaljs/blob/a36b978aa328a8da3a7f... [4] https://github.com/graalvm/simplelanguage https://github.com/graalvm/simplelanguage [5] https://github.com/graalvm/simplelanguage/blob/a25e385dd8626a85e8374f213e708b2f813ab9b7/language/src/main/java/com/oracle/truffle/sl/runtime/SLObjectType.java#L230-L295 https://github.com/graalvm/simplelanguage/blob/a25e385dd8626... [6] https://www.graalvm.org/truffle/javadoc/com/oracle/truffle/api/dsl/Specialization.html https://www.graalvm.org/truffle/javadoc/com/oracle/truffle/a... [7] https://www.graalvm.org/docs/Truffle-Framework/user/README https://www.graalvm.org/docs/Truffle-Framework/user/README
- kasperni 6y agoGraalVM consists of a couple of things. 1. A modern JIT compiler written in Java that takes bytecode and transforms it into machine code. There is a plan that it might someday replace HotSpot [1]. However, we are probably a couple of years away from this. 2. A native image compiler [2] that uses ahead-of-time compilation technology to produce executable binaries of class files. This means startup times and memory usage similar to a language such as go. 3. An abstract syntax tree interpreter called Truffle. Which allows you to easily implement languages on top of GraalVM. With the performance of compiled languages but using an interpreter. You can read more about this here [3]. There are also other features such as a LLVM bitcode engine called Sulong. And various PolyGlot functionality to support integration of whatever language you want. [4] [1] https://jaxenter.com/openjdk-project-metropolis-137318.html https://jaxenter.com/openjdk-project-metropolis-137318.html [2] https://www.graalvm.org/docs/reference-manual/native-image/ https://www.graalvm.org/docs/reference-manual/native-image/ [3] https://www.beyondjava.net/truffle-compiler-compiler https://www.beyondjava.net/truffle-compiler-compiler [4] https://github.com/oracle/graal/blob/master/sulong/README.md https://github.com/oracle/graal/blob/master/sulong/README.md
- rkangel 6y agoThe 'party trick' combination of (2) and (3) being that you can take a Ruby application, and all of the C extensions that it's using, compile them all AoT and then run whole program optimisation. It was kinda/sorta working a couple of years ago I believe, I don't know what the progress has been.
- nathell 6y ago[3] is made possible thanks to a variation of the idea called "Futamura projections": https://en.wikipedia.org/wiki/Partial_evaluation#Futamura_projections https://en.wikipedia.org/wiki/Partial_evaluation#Futamura_pr...
- rubyfan 6y agoI read that as Futurama and when I clicked through was expecting to see a picture of Fry or Hypnotoad as some time travel concept as inspiration. Even better, when I clicked through I read it the first time and thought “wow cool someone’s last name is Futurama” then I read it again haha.
- galaxyLogic 6y agoWhat about an IDE? Is there an IDE?
- deleted 6y ago[deleted]
- brabel 6y agoGraalVM is just Java :) you don't need a new IDE.
- galaxyLogic 6y agoBut isn't it more than Java? You can run other languages like Node.js and Python besides Java. So what I'm asking for would be an IDE where I can easily program calls from Java to Node.js or vice versa, for example. Or some other poly-language IDE if such exists
- abhijat 6y agoAt least for Java / Scala etc intellij works as it would normally. You just need to point to the graalvm JDK instead of your usual JDK.
- galaxyLogic 6y agoAh I see
- fniephaus 6y agoIf you're looking for an IDE for polyglot programming, GraalVM provides an extension for VSCode: https://www.graalvm.org/docs/tools/vscode https://www.graalvm.org/docs/tools/vscode and supports the LSP: https://www.graalvm.org/docs/tools/lsp https://www.graalvm.org/docs/tools/lsp
- gigatexal 6y agoHow “early stage” is the python support?
- kgoutham93 6y agoIntuitively how does any Java program compile into an executable?
- tutfbhuf 6y agoInstead of compiling Java to Java bytecode which is then executed by the JVM (e.g. Hotspot), you compile it to native machine code/assembly + runtime (Substrate VM). However you loose the cross-platform ability and Java reflections won't work out of the box.
- pas 6y agoWhat's the GC performance of Substrate VM's GC? Is it still the 1G young 3G old thing? What's the long term vision? In theory can this thing become "better" than HotSpot, JIT and G1/Z/Shenandoah?
- andretti1977 6y agoI'm happy with language interoperability as a concept but how can i mix java and js in the same codebase with graalvm? And would it make sense? What are the advantages of this approach?
- fniephaus 6y agoCurrently, you'd use the polyglot package that ships with the GraalVM SDK: https://www.graalvm.org/sdk/javadoc/org/graalvm/polyglot/Context.html https://www.graalvm.org/sdk/javadoc/org/graalvm/polyglot/Con... Here are a couple of demos: https://github.com/graalvm/graalvm-demos https://github.com/graalvm/graalvm-demos I said "currently", because you currently have to use the host Java, that is the Java on top of which all other languages are implemented. The GraalVM team is working on Project Espresso, a Java written in Truffle. That will make polyglot programming with Java much more consistent with the rest of the languages. Project Espresso isn't public yet, but here's the latest update from the team working on it: https://github.com/oracle/graal/issues/1656#issuecomment-664335618 https://github.com/oracle/graal/issues/1656#issuecomment-664...
- jbister 6y agoYou can use it for doing server side rendering of React or other JS framework components. I have a VERY rough repository[0] where I tested this out a while back. The way I did it was to export functions on the global object in JS[1] which could then easily be called from Java code[2]. I'm sure there's a better way to accomplish the same thing. What I found interesting with this approach is that it allows you to do server side rendering without needing a separate server and without needing any third party dependencies aside from GraalVM itself. 0. https://github.com/JackBister/javalin-preact-archetype https://github.com/JackBister/javalin-preact-archetype 1. https://github.com/JackBister/javalin-preact-archetype/blob/master/src/main/resources/archetype-resources/src/main/resources/frontend/src/server.ts https://github.com/JackBister/javalin-preact-archetype/blob/... 2. https://github.com/JackBister/javalin-preact-archetype/blob/master/src/main/resources/archetype-resources/src/main/java/BundledServerSideRenderer.java#L23 https://github.com/JackBister/javalin-preact-archetype/blob/...
- dang 6y agoThere have been many threads (https://hn.algolia.com/?dateRange=all&page=0&prefix=false&query=GraalVM%20comments%3E1&sort=byDate&type=story&storyText=none https://hn.algolia.com/?dateRange=all&page=0&prefix=false&qu...) including: 2019 https://news.ycombinator.com/item?id=20987946 https://news.ycombinator.com/item?id=20987946 2019 https://news.ycombinator.com/item?id=19885922 https://news.ycombinator.com/item?id=19885922 2018 https://news.ycombinator.com/item?id=16859559 https://news.ycombinator.com/item?id=16859559 2018 https://news.ycombinator.com/item?id=16995967 https://news.ycombinator.com/item?id=16995967
- Borkdude 6y agoCheck out babashka, a Clojure interpreter with instant startup, running in a GraalVM-compiled binary: https://github.com/borkdude/babashka https://github.com/borkdude/babashka
- slgeorge 6y agoThis is a good example of where Graalvm's native image is interesting. This is a CLI tool that lets Clojure developers create scripts that are as fast as bash scripts. Clojure may well not be your bag, but stay with me - we're talking about CLI or TUI's written in Java (or a java-based language) that are easy to distribute as statically compiled binaries.
- Hitton 6y agoI have hard time being deeply invested in GraalVM considering that the most interesting stuff tends to be kept proprietary (e.g. profile-guided optimizations).
- amelius 6y agoAlso, if you're like me, you simply don't want to deal with the law firm called Oracle.
- pjmlp 6y agoWhat about the law firm Apple?
- deleted 6y ago[deleted]
- oblio 6y agoDoes Apple sue its customers?
- rurban 6y agoAnd more worrying: Java, the language.
- mumblemumble 6y ago
- crudbug 6y agoHow is GraalVM different from Eclipse OMR [1] ? Seems both are doing AOT and modular language development. [1] https://www.eclipse.org/omr/ https://www.eclipse.org/omr/