5
3
5
u/kanzenryu Jun 02 '20
Here's a 100% spec compliant JVM...
throw new UnknownError();The spec says that may be thrown at any time ;-)
1
u/BigGuyWhoKills Jun 03 '20
This is very similar to the prerequisite class for my capstone project. We built an assembler. The capstone was a compiler.
0
Jun 02 '20
[deleted]
10
Jun 02 '20
Ok, show me how you program a JIT with an optimizer for a JVM. Those guys were working on it since Java 1.2? 1.3? and there a still bugs and missed optimization opportunities.
And it's a TOY JVM, not for serious use in production
0
Jun 02 '20
[deleted]
7
u/rotharius Jun 02 '20
They're not really giving that impression. It's clearly a toy JVM for educational or hobby purposes. It could be a nice starting point for driving in deeper.
6
Jun 02 '20
It doesn't give that impression at all. The title literally says toy in it. Their introduction says "In this post I will try to write a toy (and incomplete) JVM to show the core principles behind it and hopefully sparkle some interest in you to learn it further.".
I couldn't fathom how someone could get the impression they are saying its either a complete jvm, or that its simple/easy to do so. The JVM is one of the most complex pieces of software on the planet.
1
u/wildjokers Jun 03 '20
Did you read the article? The author literally says:
"So, it works. Yes, it’s a very lousy and pitiful JVM, but still, it does what JVM does - loads bytecode and interprets it (but of course, the real JVM does way more than that)."
2
Jun 02 '20
[removed] — view removed comment
7
u/kimec Jun 02 '20
You mean like all the other meta-circular VMs such as Jikes RVM, Hera VM, Maxine JVM and by extension GraalVM?
3
u/dpash Jun 02 '20
The Hotspot JVM has a lot of C++ in it, so you wouldn't be able to run OpenJDK on your JVM. You could run your JVM on OpenJDK.
1
u/pjmlp Jun 04 '20
Hotspot JVM is just one JVM implementation,there are plenty of other ones, as noted on sibling comment.
2
u/Molossus-Spondee Jun 02 '20
The Java bytecode interpreter is extremely slow. Probably be faster to run a jitted interpreter.
33
u/RoToRa Jun 02 '20
Great article. One suggestion: You should mention that you are using Go somewhere in the title or introduction.