DoppioVM: a JVM in CoffeeScript
int3.github.com
int3.github.com
Check out the demo here: http://int3.github.com/doppio/
> While we do not emulate threads, we still wanted to handle blocking operations, particularly for standard input. Since the browser DOM is largely asynchronous, blocking operations have to be emulated via async callbacks. We solved this by implementing a 'yield' construct: upon encountering a blocking function, we throw a YieldException to pause the VM. This exception would also contain the asynchronous function that we are waiting on, which eventually calls the VM and resumes the program.
Absolutely brilliant work guys
Java -> bytecode -> JVM -> CoffeeScript -> JavaScript -> interpreter/JIT -> machine code -> CPU -> hardware.
Turtles all the way down...
function scrollToBottom() {
jQuery.fn.jquery > "1.6" ?
inner.prop({scrollTop: inner.prop("scrollHeight")}) :
inner.attr({scrollTop: inner.attr("scrollHeight")})
}I think its a silly thing really, running a JVM on top of a JITer inside a browser. I can see it having some uses in specific cases but I can't imagine it being used for anything heavy duty.
The plan is to implement a bytecode -> JS compiler next, a la JSIL / Emscripten. Thus far most of the work has gone into porting the runtime environment first.
P.S. I'm a sophomore, the other two are grad students :)
Oh, and if this thing catches on, we won't be seeing another FlashBlock again :)
doppio > rhino
js> Packages.java.lang.System.out.println('hello world');
hello world
Call me crazy, but I think threading could be implemented via green threading or by utilizing a global event loop to manage script execution. Using pop up windows, one for each thread, might also be a solution that takes advantage of system level threads. It might also be possible to implement sleep using a synchronous ajax call to someting that doesn't exist that has a specific timeout attached to it.
One problem though, I tried compiling the Swing Hello World app and after it worked at it for a while got a java.lang error:
http://docs.oracle.com/javase/tutorial/uiswing/examples/star...
I know that the observed real world running times are all sub-linear, but we can only theoretically proove that in runs in O( n * log(n) * log(n) * log (n) ) .
If you can maybe shave a log(n) off that running time proof, I'm sure that your thesis committee will finally have found big O, and we will make you an extra special hat to wear at graduation.
The JVM is the only redeeming feature of Java (the language). You're nerfing the high performance features for what, exactly? A half assed tracing ability? "Write once, run anywhere"?
Javascript won in the browser, move on.
Android in the browser.