Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create custom JVM? [closed]

Tags:

I was reading item #6.10 on http://www.cafeaulait.org/javafaq.html and I began wondering how the big players go about creating their own implementation of a JVM. Would an experimental something or another be possible (and feasible) for one guy?

like image 796
ianmac45 Avatar asked Apr 08 '09 18:04

ianmac45


People also ask

How do I close JVM?

There are two ways to terminate the JVM instance from the running application: Calling the exit() method, which initiates the JVM normal shutdown sequence: run all registered shutdown hooks; run all uninvoked finalizers; then end the JVM instance. Calling the halt() method, which ends the JVM instance immediately.

Can we create our own JVM?

technically, all the information people need to create a new JVM is in the public specifications for the language and the targetted platform.

What happens when JVM shuts down?

A shutdown hook is simply an initialized but unstarted thread. When the virtual machine begins its shutdown sequence it will start all registered shutdown hooks in some unspecified order and let them run concurrently.


1 Answers

technically, all the information people need to create a new JVM is in the public specifications for the language and the targetted platform. A JVM would need to behave differently depending on whether it is meant to run on a desktop computer or a mobile phone, even if the bytecode interpretation would be largely identical.

A few places to start looking for information:

http://en.wikipedia.org/wiki/List_of_Java_virtual_machines
Reading The "Java Virtual Machine Specification" by Tim Lindholm
http://www.jcp.org/en/jsr/detail?id=30

From what I have seen of JVM implementations by Sun, IBM or smaller companies like Esmertec, writing a simple JVM is a several man-months project but adding JSR after JSR to support more functionality can take years afterwards.

Now, if all you need is a simple bytecode interpreter, it's not that bad, but it's still quite a bit of code to write.

like image 55
michael aubert Avatar answered Oct 02 '22 15:10

michael aubert