📜 ⬆️ ⬇️

Doppio - JVM, JavaScript Compiler and Disassembler

To date, we do not lack beautiful things that are written in JavaScript. Yes, and JVM implementation in JavaScript, we have already seen . However, Doppio is the most comprehensive and actively developing JVM.



By and large, Doppio is a project that allows you to run Java code directly in a browser without plug-ins. It includes the implementation of the Java Virtual Machine (JVM), which consists of a browser-based compiler and bytecode disassembler. The project is still under development, you still need to work well on performance before it can be used in development. But today it is supported:


')
It seems like the demo works best in Chrome, but it should work well in any browser that supports local storage and typed arrays.

But why java?


You must be thinking now: “But why do I need to write in Java for the browser?” But having a browser JVM, we get much more than just Java, don't forget that there are many other languages ​​compiled into JVM bytecode, including as already existing languages - Ruby (JRuby), Python (Jython) and JavaScript (Rhino), as well as new languages, such as Scala, Clojure and many others .

From this point of view, JVM in the browser can be used to work with many languages ​​and existing programs directly in the browser without manual translation. However, before this is possible, there is a lot of optimization work to do. Now Doppio interprets baytkod on the fly, but the authors remind them that they want to switch to a more compiled approach. Like Emscripten, it compiles LLVM bytecode in JavaScript, Doppio wants to do the same for JVM code - then it would be a very powerful utility.

You can find information about the Doppio project here , see documented examples or a page on GitHub . Well, of course, try the demo .

Source: https://habr.com/ru/post/153457/


All Articles