A cosmopolitan-native JVM/JDK #1177
Replies: 3 comments 7 replies
-
Should probably note, there is a feature request along these lines in the graal project, although it doesn't have too much activity right now oracle/graal#8350 |
Beta Was this translation helpful? Give feedback.
-
That all sounds great. Someone would need to will it into reality by building it though. As mentioned in oracle/graal#8350 Oracle themselves has done all the legwork supporting Musl, so since Cosmo is based on Musl, I can't imagine it'd be that big of a stretch to support Cosmo too. The biggest obstacle they're likely to encounter is getting JIT to work across OSes. Cosmo provides APIs like |
Beta Was this translation helpful? Give feedback.
-
Some notes on getting this to work so far @ahgamut
Some of that is reflected in these forks, though the real blocker right now is getting that labs JDK to build against cosmo. https://github.com/jjsullivan5196/cosmopolitan/tree/graal-cosmo They also have this build tool called |
Beta Was this translation helpful? Give feedback.
-
Let me preface by saying, this is just an idea that I've had some interest in, and admittedly I lack experience in this area. If this isn't the right venue for this or it's just a dead end I totally understand.
Cosmo of course provides an experience familiar to that of the Java Virtual Machine (JVM) platform, but uses the amd64 ISA as its lingua franca to reach many platforms at once while being incredibly efficient. This also affords drastically simplifying toolchains, as compilers and all supporting programs can be shipped once as a single artifact, without the combinatorial explosion of platform/architecture/ISA woes.
While I am very impressed with the progress of porting so many languages and tools to cosmo, I still feel there's one affordance the JVM uniquely provides: in having the multitude of high-quality languages, libraries, protocol support, architectural patterns and more that can all be mixed and matched freely, on a coherent process VM that allows deep inspection and interaction at runtime. In today's world of many platforms, ways and places to run software however, there's an analysis paralysis that ensues when choosing the appropriate JVM and toolchain to work with. Graal has opened yet another can of worms trying to provide its own infrastructure for running high-level languages and runtimes close to the metal https://www.graalvm.org/latest/reference-manual/java-on-truffle/implementation/ And in purely historical terms, build tooling for the JVM and JDK has often been a churn-heavy responsibility that trickles down to those maintaining software repositories and OS platforms.
However now that research efforts have made it somewhat trivial to AOT compile Java, and JVM implementations written in Java, we might be closer to having a JVM that can predictably provide the capabilities of the host platform, all as a single software artifact. If we put that together with cosmo as the JVM's interface to the underlying platform, much of the headache of exposing such capabilities thru the JDK, JVM and its myriad native interfaces could be eliminated entirely. Given cosmo's library capabilities as well, there's probably a significant portion of the higher-level JDK APIs that could be shelled out to it.
To be clear, I'm not suggesting this is something that the cosmo community at large needs to care about or maintain, but I'd like to see what you folks out there think about this, given your experience using cosmo. I'm not aware of many people working on such a thing, but I have come across one example of an attempt already with an experimental JVM implementation http://bloggl.thenesis.org/2021/03/jainja-jvm-with-cosmopolitan-libc.html
Beta Was this translation helpful? Give feedback.
All reactions