0

When looking through the OpenJDK repositories and trying to build them, I discovered that they contain two very similar implementations of the Hotspot JVM. (Mostly was looking through JDK6 because it has a significantly simpler structure ... but have found the same in the modern releases).

Obviously, the code group "hotspot" will contain an implementation (although that seems to completely be missing an entry-point, but that's not really important here). But "java.base" has many of the same classes with very similar implementations; also referencing itself as being the "Java VM".

Why is this? Is there any specific reason there are two implementations provided - or, more likely, what am I misunderstanding about the JDK?

Robbe
  • 111
  • 3
  • It's not clear what you mean by "two JVM implementations". Can you post links to the "first" and to the "second" one? – apangin Feb 21 '23 at 22:21
  • Will edit them in later; can't right now - StackOverflow is refusing. One would be in here: https://github.com/openjdk/jdk19/blob/master/src/java.base/share/native/libjli/java.c (when it reaches CreateExecutionEnvironment especially, that is pretty much the same implementation as the other one), The other would "be" here as a starting point: https://github.com/openjdk/jdk19/tree/master/src/hotspot (Haven't quite figured out what the entry point might be yet. Still working on that one :( ). – Robbe Feb 21 '23 at 22:46
  • 1
    I don't see what similarity you find between those two. These are different things: the first one (`java.c`) is the [launcher](https://stackoverflow.com/questions/26020872/totally-confused-with-java-exe/26025656#26025656). The launcher is not the JVM implementation. The second link points to the root directory of the HotSpot JVM source code. – apangin Feb 21 '23 at 23:27
  • yep ... bad second choice on my part. It's much easier to see in the old version; this might be more explanative: Hotspot Launcher: https://github.com/openjdk/jdk6/blob/master/hotspot/src/share/tools/launcher/java.c JDK VM Lancher: https://github.com/openjdk/jdk6/blob/master/jdk/src/share/bin/java.c – Robbe Feb 21 '23 at 23:30
  • 1
    Again: `java.c` is not a JVM implementation, it is just a launcher, i.e. a small CLI utility to load and run the JVM. Historically, in the times of JDK 6, JDK class library and HotSpot JVM were in different repositories developed by different teams. To ease the development and testing of the JVM, HotSpot source base had its own version of the launcher. The [comment](https://github.com/openjdk/jdk6/blob/master/hotspot/src/share/tools/launcher/java.c#L25-L36) in the source code explains the aim of this separate launcher pretty well. – apangin Feb 21 '23 at 23:43
  • Oh ... that's what it was about. Weird launcher stuff ... I had a suspicion but hadn't quite recognised it yet! Thank you very much. – Robbe Feb 21 '23 at 23:53

0 Answers0