This is excellent! For one, I find Java-in-Java to be much clearer after
this little set of definitions.
A quick proposal: perhaps "VM bootstrap" as used below should really be
something like "VM initialization," "VM init," or even "VM startup",
since the word "bootstrap" is very specific and to me at least,
indicates something more akin to the "VM bootloader" + "VM boot image"
(as used below).
I'm going to try to make a couple of observations. Please forgive the
rambling :) It just seems like things are starting to take shape...
* It looks like there is really not much in common between this
architecture and one where "VM core" would be in C... For that one, "VM
core" would be in C, as would be all of the components, such as GC,
scheduler, etc. "VM init" doesn't sound like a big deal but would
probably also be in C. "VM boot image" and the "VM bootloader" are
simply not present in a C solution.
* "OS interface" is perhaps one place where some code can be shared. If
C version can benefit from an OS abstraction layer for portability, then
it seems like this layer could be shared between the C and the Java
implementations.
* The meat of the VM seems to be in the "spokes" that connect to the "VM
core-hub". It seems that this is where it would make the most sense to
mix components written in C with those written in Java, to see which one
can do a better job. If all spokes were in C, it would make little sense
to have the hub be in Java... On the other hand if spokes are all Java,
it makes little sense to have the hub be in C.
Steve, if the spokes were in Java but the hub in C, would we then lose
all of the aggressive inlining benefits that Java-in-Java solution can
provide?
-dmitry
Steve Blackburn wrote:
I thought it might be helpful to clarify some terminology and a few
technical issues. Corrections/improvements/clarifications welcome ;-)
VM core
The precise composition of the VM core is open to discussion and
debate. However, I think a safe, broad definition of it is that
part of the VM which brings together the major components such as
JITs, classloaders, scheduler, and GC. It's the hub in the wheel
and is responsible for the main VM bootstrap (bootstrapping the
classloader, starting the scheduler, memory manager, compiler etc).
VM bootstrap
The bootstrap of the VM has a number of elements to it, including
gathering command line arguments, and starting the various
components (above).
In the context of a Java-in-Java VM, the above is all written in Java.
VM boot image
The boot image is an image of a VM heap constructed ahead of time
and populated with Java objects including code objects corresponding
to the VM core and other elements of the VM necessary for the VM
bootstrap (all written in Java, compiled ahead of time, packaged
into Java objects and composed into a boot image). The boot image
construction phase requires a working host VM (ideally the VM is
self-hosting).
VM bootloader
In the case of Jikes RVM a dozen or so lines of assember and a few
lines of C are required to basically do the job of any boot loader
loader---mmap a boot image and throw the instruction pointer into
it. It will also marshal argv and make it available to the VM core.
This is technically interesting, but actually pretty trivial and has
little to do with the VM core (aside from ensuring the instruction
pointer lands a nice place within the boot image ;-)
OS interface
The VM must talk to the OS (for file IO, signal handling, etc).
There is not a whole lot to it, but a Java wrapper around OS
functionality is required if the VM is java-in-java. This wrapper
is pretty trivial and one half of it will (by necessity) be written
in C.
I hope this brief sketch provides folks with a slightly clearer view
of what a java-in-java VM looks like, and some (tentitive) terminology
we can use to ensure we're not talking at cross purposes.
Cheers,
--Steve