Live data from Hacker News

Oracle Contributing GraalVM Community Edition Java Code to OpenJDK

graalvm.org

131–140 of 141 posts

Re: Oracle Contributing GraalVM Community Edition Java Code to OpenJDK

#131
post #5

Earlier quoted context omitted.

Maybe it's my ignorance of the Java ecosystem or a lack of imagination but how could a language that requires a heavy runtime be written in itself? Wouldn't you need a runtime for the runtime, and then a runtime for the runtime for the runtime and then...? I can't quite imagine how you'd bootstrap something like that.

Just imagine a Python interpreter written in Python. Then the interpreter could interpret its own code while interpreting its own code.

https://www.pypy.org/

Re: Oracle Contributing GraalVM Community Edition Java Code to OpenJDK

#132
post #59

Does this have any impact on Truffle to speed up Ruby on Rails?

Nothing technical is changing. It's just a change in the development process used by Oracle. A lot of this announcement will be opaque if you don't know the history of Sun, but suffice it to say that the core Java development process has a lot of oddness in it that exists to make Java more open and less controlled by Sun-then-Oracle, for example if you go look at their mailing lists you'll see they "vote" on whether…

The part I like is that it basically _forces_ GraalVM on everyone who is currently using a JVM with Oracle lineage. It would be not unlike PyPy and CPython agreeing to ship together, not really but kinda.

GraalVM is going to see adoption go up > 100x.

Re: Oracle Contributing GraalVM Community Edition Java Code to OpenJDK

#133

Earlier quoted context omitted.

My point is this: what alternative would you prefer? Oracle can't implement trade-off checks or process gates inside other companies.

Alternative : open source it and charge for support.

Red Hat is the poster child for that approach and they charge for support based on per-core usage with audits / legal teams to back it up, no different to Oracle.

Re: Oracle Contributing GraalVM Community Edition Java Code to OpenJDK

#134

I refuse to praise Oracle for anything. But I could make an exception if they put Isolates in the CE version of Graal and not only the Enterprise one. :) Also, obviously Oracle didn't do this out of the kindness of their hearts, if they didn't contribute Graal into the OpenJDK the would risk to Graal never become anything other than a niche VM because most people, specially big clients don't want to change VMs and th…

Which isolates do you mean? Support for Native image isolates is included in CE.

There are some features like polyglot isolates that are currently EE, but they are just a use of native image isolates.

Re: Oracle Contributing GraalVM Community Edition Java Code to OpenJDK

#135
post #93

Earlier quoted context omitted.

A component of the GraalVM project is called native-image. The native-image tool compiles a Java app to machine code ahead of time and combines it with a small JVM called SubstrateVM. That JVM is written in Java, just like the rest of your app. As pointed out by other comments, this concept of a "meta-circular VM" isn't new. It's been done before by two other projects, Maxine and Jikes. What's different about Substra…

Hi! I was under the impression that Graal reused OpenJDK’s GC implementations - or was it only in the Graal as JIT compiler mode? Also, may I ask how do you know so much about the topic? I would really like to one day work on OpenJDK/Graal, but I just don’t see the road ahead me.. — I’ve just started my master in CS, but I don’t feel it closing the gap at all. Surely I can read up more and more on the topic in small…

Graal dev here. We have an internship program: https://www.graalvm.org/community/internship/

It's not uncommon to do a CS master Thesis as part of an internship, if your university allows that. We have plenty of topics to choose from and you can also come up with your own.

Good luck!

Re: Oracle Contributing GraalVM Community Edition Java Code to OpenJDK

#136

Earlier quoted context omitted.

Not being facetious - but it works exactly like any other GC. There's nothing magic about writing code in Java instead of C that makes a huge difference. But you might find this interesting as a specific example - this is where it actually obtains memory from the OS. https://github.com/oracle/graal/blob/44e68777b130c8ee781c72b... Note the @Uninterruptible annotation - that's saying that this code is safe to use withi…

I think that's the piece that got me and grand-GP maybe confused. You are writing a GC in Java, yes but have access to low-level memory abstractions/interfaces, right? Whereas I was initially wondering how to write a GC in "pure Java" that doesn't have access to low-level memory interfaces. Does it make sense why I was asking, now? Or am I still not getting it? To be clear, Java the language is Java, I'm not going to…

I think with regular old java this would be impossible to do in a reasonable way. But with AOT compiled Java and extensions like @Uninterruptible you can do it.

I think I'd phrase it like this: you can write a GC mostly in Java.

Other GCs than the default Java one in native image like G1 actually embed the C++ version of the implementation instead of writing it in Java.

Re: Oracle Contributing GraalVM Community Edition Java Code to OpenJDK

#137
post #93

Earlier quoted context omitted.

Hi! I was under the impression that Graal reused OpenJDK’s GC implementations - or was it only in the Graal as JIT compiler mode? Also, may I ask how do you know so much about the topic? I would really like to one day work on OpenJDK/Graal, but I just don’t see the road ahead me.. — I’ve just started my master in CS, but I don’t feel it closing the gap at all. Surely I can read up more and more on the topic in small…

Graal dev here. We have an internship program: https://www.graalvm.org/community/internship/ It's not uncommon to do a CS master Thesis as part of an internship, if your university allows that. We have plenty of topics to choose from and you can also come up with your own. Good luck!

How hard is it to get accepted? I have written a toy JVM without a GC, only interpreter, but I don’t feel qualified, and I am afraid of blowing my chance (is there some limit on how often can one apply?). I’m working on adding a templated interpreter+GC version next, afterwards I might have a bit more confidence.

Re: Oracle Contributing GraalVM Community Edition Java Code to OpenJDK

#138
post #137

Earlier quoted context omitted.

Graal dev here. We have an internship program: https://www.graalvm.org/community/internship/ It's not uncommon to do a CS master Thesis as part of an internship, if your university allows that. We have plenty of topics to choose from and you can also come up with your own. Good luck!

How hard is it to get accepted? I have written a toy JVM without a GC, only interpreter, but I don’t feel qualified, and I am afraid of blowing my chance (is there some limit on how often can one apply?). I’m working on adding a templated interpreter+GC version next, afterwards I might have a bit more confidence.

I'd ask people that know you and have experience in the field for a realistic opinion (maybe a professor/assistant/phd?). It does definitely not hurt to code all kinds of systems stuff. Try to tinker with some low-level optimization problems. You should be an excellent coder too. In our case it does help to know the JVM ecosystem, including HotSpot details.

And (shameless self plug), implement a Truffle language. Start here: https://www.youtube.com/watch?v=pksRrON5XfU&list=PLN193mR3Js...

Re: Oracle Contributing GraalVM Community Edition Java Code to OpenJDK

#139

Earlier quoted context omitted.

I think that's the piece that got me and grand-GP maybe confused. You are writing a GC in Java, yes but have access to low-level memory abstractions/interfaces, right? Whereas I was initially wondering how to write a GC in "pure Java" that doesn't have access to low-level memory interfaces. Does it make sense why I was asking, now? Or am I still not getting it? To be clear, Java the language is Java, I'm not going to…

I think with regular old java this would be impossible to do in a reasonable way. But with AOT compiled Java and extensions like @Uninterruptible you can do it. I think I'd phrase it like this: you can write a GC mostly in Java. Other GCs than the default Java one in native image like G1 actually embed the C++ version of the implementation instead of writing it in Java.

> But with AOT compiled Java and extensions like @Uninterruptible you can do it.

Yeah, but also the code shown above used native low level primitives like mmap which typically aren't available.

AOT, special behavior directives (@Uninterruptible), native memory access, making sure not to use new (?), at that point you are formally using Java, the language, but it's sort of its own thing.

So, that's still cool and likely no way around it but I wonder to what degree it's actually beneficial: Your program is much closer to a C++ program than a Java one except for syntax and the additional glue abstractions that typically exist in neither. In a (exaggerated) sense it's like it's written in a C++ DSL embedded in Java.

If you know how to write C++ it's possibly simpler to just write it in C++ as you know how memory management there works. If you know Java you need to get familiar to the extensions used here.

This is a bit different from the idea of self-hosting a compiler for instance where you can start writing your compiler now ideomatically in your own language instead of something different. For instance if your language & runtime has GC it's much simpler / safer to write a program in it, and so a compiler in it than pre-self-hosting (if the earlier compiler was written in C).

So what in particular is afforded by writing the GC in "Special Java" ? Is it just about being able to say "it's all in Java" or are there language features in "Special Java" that make live easier than C++? Or other benefits? For instance, I imagine use of the wider ecosystem / libraries isn't possible whereas in C++ it is (more so at least).

It would be nice if somehow you could write a GC itself in regular old Java without having to worry about aspects of how to do it in a special, restricted way. Say, the code you write and which runs the garbage collection creates objects, which subsequently get cleaned up by your very own GC program.

In the end you still have to work with low level abstractions / memory though and maybe that's still different to the self-hosted compiler example in a sense: There you translate code into a language that is more low level but you don't need to have these abstractions available in your own language / on your stage of computation / while running your compiler.

Re: Oracle Contributing GraalVM Community Edition Java Code to OpenJDK

#140
post #93

Earlier quoted context omitted.

Hi! I was under the impression that Graal reused OpenJDK’s GC implementations - or was it only in the Graal as JIT compiler mode? Also, may I ask how do you know so much about the topic? I would really like to one day work on OpenJDK/Graal, but I just don’t see the road ahead me.. — I’ve just started my master in CS, but I don’t feel it closing the gap at all. Surely I can read up more and more on the topic in small…

When used on HotSpot it does. Native images/SubstrateVM have their own GC written. Native Image EE can also use the G1 GC so then your native image is a mix of C++ and Java. The Graal compiler can be used in both modes. How did I learn about it - mostly by reading their papers, watching their videos and asking lots of inane questions on their Slack. Also, I happen to live around the corner from where the Graal team w…

I thought native-image in community mode use the serial gc? I'm guessing thats not true anymore?
Post reply on HN