Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Update readme

  • Loading branch information...
commit 6788e29f94468a1b6def5212d82e23808e810a52 1 parent 17f95b3
@krestenkrab krestenkrab authored
Showing with 96 additions and 83 deletions.
  1. +0 −83 README
  2. +96 −0 README.md
View
83 README
@@ -1,83 +0,0 @@
-Erjang - a JVM-based Erlang VM
-
- Wiki Pages: www.erjang.org
- Discussion: http://groups.google.com/group/erjang
- Source: http://github.com/krestenkrab/erjang
-
---
-
-BUILDING
-
-
-You should be able to do "ant jar", and thereafter run the sample
-like this:
-
- prompt% ant jar
- ...
- prompt% ./ej -pa ./src/main/erl -noshell -s ring main
- ....
- {1267,799627,843000} Starting message, cycles=10000
- {1267,799638,52000} Around ring 10000 times
- 10000 == 10000 ... stop
- Start={1267,799628,58000} Stop={1267,799638,54000} Elapsed=9996000us
- {1267,799638,69000} Starting message, cycles=10000
- {1267,799647,837000} Around ring 10000 times
- 10000 == 10000 ... stop
- Start={1267,799638,74000} Stop={1267,799647,838000} Elapsed=9764000us
- {1267,799647,847000} Starting message, cycles=10000
- {1267,799657,644000} Around ring 10000 times
- 10000 == 10000 ... stop
- Start={1267,799647,851000} Stop={1267,799657,649000} Elapsed=9798000us
- {1267,799657,662000} Starting message, cycles=10000
- {1267,799667,790000} Around ring 10000 times
- 10000 == 10000 ... stop
- Start={1267,799657,665000} Stop={1267,799667,792000} Elapsed=10127000us
- {1267,799667,806000} Starting message, cycles=10000
- {1267,799677,486000} Around ring 10000 times
- 10000 == 10000 ... stop
- Start={1267,799667,809000} Stop={1267,799677,488000} Elapsed=9679000us
-
-You can compare this to a similar run for "BEAM" by running
-
- prompt% erl -pa ./src/main/erl -noshell -s ring main
-
-
-The source for the few samples are in src/main/erl.
-
---
-
-RUNNING
-
-When running, it writes files named ".erj/${module}-${CRC}.jar". These
-files are written in response to erlang:load_module(Module,Binary).
-
-These files also serve as a cache of files translated from beam -> jar.
-If something goes astray, it may help to remove the .erj directory
-forcing Erjang to recompile next time it runs.
-
---
-
-PREREQUISITES
-
-I have only been testing this with Erlang/OTP R13B02.
-
-If you run with a different erts (Erlang runtime system), then you can
-use the +e <ErsVsn> flag, like this:
-
- ./erl.sh +e 5.7.5
-
-To tun with erts-5.7.5.
-
-To run the tests, you need an OTP distribution, and go edit src/test/java/erjang/AllTests.java
-to tell it where your OTP_HOME is.
-
-
-
-Cheers!
-
-Kresten Krab Thorup
-krab _at_ trifork dot com
-
-
-
-
View
96 README.md
@@ -0,0 +1,96 @@
+# Welcome to Erjang!
+
+Erjang is a virtual machine for Erlang, which runs on Java(tm).
+
+* For comments and questions please use the "Erjang Google Group":http://groups.google.com/group/erjang
+* Check the [[README]] before you try to run this.
+* I am also posting updates at my blog, "Java Limit":http://javalimit.com
+
+### How does it work?
+
+It loads Erlang's binary `.beam` file format, converts it into Java's `.class` file format, and loads it into the JVM. It will eventually have it's own implementation of all Erlang's BIFs (built-in-functions) written in Java.
+
+### Does it work?
+
+Yes! It does actually work.
+
+- It can boot Erlang/OTP to the Eshell (`ej` command).
+- There's a GUI console (`ejc` command) which supports ^G and line editing. The console still needs some work [Swing wizards welcome here].
+- Run Erlang distribution, tcp/ip, port commands (stdio to external processes).
+- You can run the compiler (`c(foo)` command in the prompt)
+- It runs `mnesia` with distribution across Erjang/BEAM nodes.
+- The HTTP packet parsers are in the tcp/ip stack, so `mochiweb` and `webmachine` can run (without crypto for now).
+- Larger systems like `rabbitmq` and `riak` can boot; and works for basic cases ... but it's not ready for prime time yet.
+- Etc. etc. Lot's of stuff work.
+
+<pre> krab$ ./ej
+Eshell V5.8 (abort with ^G)
+1> erlang:display("hello world!").
+"hello world!"
+true
+2> q().
+krab$
+</pre>
+
+There are still things that doesn't work: a few BEAM instruction are missing some runtime support. There are also BIFs missing, or only partially implemented; we're quite careful to throw @erjang.NotImplemented@ in BIFs (or branches thereof) which are not complete. Many OTP modules need NIFs or linked-in drivers that are entirely missing or only partly implemented.
+
+
+### Why are you doing this?
+
+Good question. Well, I just wanted to learn Erlang, and so this felt like a good way to get through all the details. Seems to be working -- I am learning erlang!
+
+### What will it feel like to be running Erlang on the JVM?
+
+Here is what to expect:
+
+* In Erjang, every node runs on a single heap, and so global GC will sometimes happen.
+* On the other hand, Erjang does not copy messages between processes -- they are simply shared, so sending large messages is significantly cheaper.
+* Over all, you will loose the predictability in behavior that Erlang has with regard to GC pauses, because Erlang can GC each process individually. Java GC continues to improve, so this might become less of an issue over time; but it will likely never go away.
+* My current tests indicate, that you can get better throughput in Erjang than BEAM, see "this blog post":http://www.javalimit.com/2010/06/erjang-running-micro-benchmarks.html
+* Erjang can run the "ring problem" at-par with BEAM, the Erlang virtual machine. If you let the JIT warm up, Erjang looks like it is faster than beam.
+* The big win is that Erjang is running on a VM that does dynamic compilation, selective inlining, and all the performance that comes from that.
+
+
+## Building
+
+
+You should be able to do `ant jar`. You need Perl
+
+## Running
+
+<pre>renaissance:erjang krab$ ./ej
+Eshell V5.8 (abort with ^G)
+1> 3+4.
+7
+2>
+</pre>
+
+
+When running, it writes files named `~/.erjang/${module}-${CRC}.jar`. These
+files are written in response to erlang:load_module(Module,Binary).
+
+These files also serve as a cache of files translated from beam -> jar.
+If something goes astray, it may help to remove the .erjang directory
+forcing Erjang to recompile next time it runs.
+
+### Prerequisites
+
+I have only been testing this with Erlang/OTP R14B.
+
+If you run with a different erts (Erlang runtime system), then you can
+use the +e <ErsVsn> flag, like this:
+
+ ./erl.sh +e 5.7.5
+
+To run with erts-5.7.5.
+
+
+
+Cheers!
+
+Kresten Krab Thorup
+krab _at_ trifork dot com
+
+
+
+
Please sign in to comment.
Something went wrong with that request. Please try again.