A Java bytecode interpreter written in Haskell

(Please keep expectations low for now; this is just a weekend project.) I have written, in Haskell, something that aspires to be a Java Virtual Machine (but I don't call it a JVM yet as it doesn't fully comply with the spec). The code is available here: https://github.com/edom/haji This is similar to Frege [3], but while Frege aims to run a variant of Haskell on Java, this project tries the other direction: running a subset of Java on Haskell. Thanks. Best, Erik Some related stuffs: [1] https://github.com/MateVM/MateVM [2] https://hackage.haskell.org/package/hs-java [3] https://github.com/Frege/frege [4] https://wiki.haskell.org/GHC:FAQ#Why_isn.27t_GHC_available_for_.NET_or_on_th... [5] https://github.com/levans/Open-Quark

I have written, in Haskell, something that aspires to be a Java Virtual Machine
That sounds interesting... Just to be sure: I suppose it executes the code "live" just like a "real" JVM? Or do you compile Bytecode to Haskell - which would mean you found a way to sidestep a lot of the issues the authors of the [MateVM](https://github.com/MateVM/MateVM) must have run into? Also, do you have any concrete plans what you want to use it for when it's ready or was that just a really involved and commendable exercise? Cheers, Martin

On Tue, May 24, 2016 at 8:43 PM, Erik Dominikus
(Please keep expectations low for now; this is just a weekend project.)
I have written, in Haskell, something that aspires to be a Java Virtual Machine (but I don't call it a JVM yet as it doesn't fully comply with the spec). The code is available here:
This is similar to Frege [3], but while Frege aims to run a variant of Haskell on Java, this project tries the other direction: running a subset of Java on Haskell.
I think it can be really interesting for Java community if you implement Java-runtime directly the same way GHC-runtime is implemented, i.e. Java-threads as GHC's IO-threads (i. e. green threads) and Java-I/O as GHC's input-output (which is asynchronous internally to support green-threading model). -- Victor Nazarov
Some related stuffs:
[1] https://github.com/MateVM/MateVM [2] https://hackage.haskell.org/package/hs-java [3] https://github.com/Frege/frege [4] https://wiki.haskell.org/GHC:FAQ#Why_isn.27t_GHC_available_for_.NET_or_on_th... [5] https://github.com/levans/Open-Quark _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe

@Martin
Yes, it does it "live". No compilation, just interpretation.
Honestly, there was no strong reason for me to make a JVM, and I don't
have a plan. I just needed some ego boost over my fellow programmers.
So yes, it was just an involved and commendable exercise. You saw
through me... LOL...
(But it's licensed under BSD3 in case someone finds something
interesting to do.)
@Victor
Interesting idea. Yes, in principle we could implement a JVM where all
java.lang.Thread instances are green threads, and all IO operations
are nonblocking, just like GHC runtime, and this will allow Java
programmers to write code in the easiest way (just new Thread()
everywhere) without performance penalty.
On Wed, May 25, 2016 at 3:25 PM, Victor Nazarov
On Tue, May 24, 2016 at 8:43 PM, Erik Dominikus
wrote: (Please keep expectations low for now; this is just a weekend project.)
I have written, in Haskell, something that aspires to be a Java Virtual Machine (but I don't call it a JVM yet as it doesn't fully comply with the spec). The code is available here:
This is similar to Frege [3], but while Frege aims to run a variant of Haskell on Java, this project tries the other direction: running a subset of Java on Haskell.
I think it can be really interesting for Java community if you implement Java-runtime directly the same way GHC-runtime is implemented, i.e. Java-threads as GHC's IO-threads (i. e. green threads) and Java-I/O as GHC's input-output (which is asynchronous internally to support green-threading model).
-- Victor Nazarov
Some related stuffs:
[1] https://github.com/MateVM/MateVM [2] https://hackage.haskell.org/package/hs-java [3] https://github.com/Frege/frege [4] https://wiki.haskell.org/GHC:FAQ#Why_isn.27t_GHC_available_for_.NET_or_on_th... [5] https://github.com/levans/Open-Quark _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe

On Wed, May 25, 2016 at 8:21 PM, Erik Dominikus
@Victor
Interesting idea. Yes, in principle we could implement a JVM where all java.lang.Thread instances are green threads, and all IO operations are nonblocking, just like GHC runtime, and this will allow Java programmers to write code in the easiest way (just new Thread() everywhere) without performance penalty.
Exactly. I don't know if it is really feasible, though. There is already Quasar[1] project for Java, but it has it's limits since it work by bytecode preprocessing. Streaght forward JVM with green threads should be cool. [1] http://www.paralleluniverse.co/quasar/ -- Victor Nazarov
On Wed, May 25, 2016 at 3:25 PM, Victor Nazarov
wrote: On Tue, May 24, 2016 at 8:43 PM, Erik Dominikus < erik.dominikus71@gmail.com> wrote:
(Please keep expectations low for now; this is just a weekend project.)
I have written, in Haskell, something that aspires to be a Java Virtual Machine (but I don't call it a JVM yet as it doesn't fully comply with the spec). The code is available here:
This is similar to Frege [3], but while Frege aims to run a variant of Haskell on Java, this project tries the other direction: running a subset of Java on Haskell.
I think it can be really interesting for Java community if you implement Java-runtime directly the same way GHC-runtime is implemented, i.e. Java-threads as GHC's IO-threads (i. e. green threads) and Java-I/O as GHC's input-output (which is asynchronous internally to support green-threading model).
-- Victor Nazarov
Some related stuffs:
[1] https://github.com/MateVM/MateVM [2] https://hackage.haskell.org/package/hs-java [3] https://github.com/Frege/frege [4]
https://wiki.haskell.org/GHC:FAQ#Why_isn.27t_GHC_available_for_.NET_or_on_th...
[5] https://github.com/levans/Open-Quark _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
participants (3)
-
Erik Dominikus
-
martin
-
Victor Nazarov