News for hackers. Stuff that matters.
Re:Gap between asm.js and native gets narrower with float32 ... by cpprototypes on Friday December 20, 2013 @12:25PM (#6942589)
Some thoughts/questions about asm.js

1) I understand the C/C++ -> LLVM -> Emscripten -> asm.js process. But I heard they're also working on supporting GC languages (like Java and Go). How would this work exactly? Wouldn't they first have to port the entire JVM or Go runtime into asm.js? And every time a Java/Go -> asm.js program is downloaded, it would basically also download the entire JVM/Go runtime as well?

2) Would it be possible to use GUI frameworks (like Qt for C++ and maybe Swing for Java in the future) to build GUIs and directly output to canvas?

Re:Gap between asm.js and native gets narrower with float32 ... by andhow on Friday December 20, 2013 @12:37PM (#6942679)
For (1): You're right that an option is to compile the VM itself to asm.js (since the VM is usually written C/C++ code; JITs are an obvious exception since they generate machine code at runtime). This has already been done, e.g., for Java [1] and Lua [2]. What is meant by "supporting GC languages" is translating GC objects in the source language to real JavaScript objects so that the JS GC may be used on them. For statically-typed source languages like .NET/JVM, the proposed Typed Objects extension to JavaScript [3] could be naturally integrated into asm.js to describe classes. This is all a little ways off since Typed Objects needs to be standardized first. Also, the lack of finalizers in JS would limit the fidelity of the translation.

For (2): yes, it is already being worked on [4].

[1] xmlvm.org [2] http://kripken.github.io/lua.vm.js/lua.vm.js.html [3] http://wiki.ecmascript.org/doku.php?id=harmony:typed_objects [4] http://badassjs.com/post/43158184752/qt-gui-toolkit-ported-t...

Re:Gap between asm.js and native gets narrower with float32 ... by camus2 on Friday December 20, 2013 @12:33PM (#6942651)
Qt running in the browser :

http://badassjs.com/post/43158184752/qt-gui-toolkit-ported-t...

JVM running in the browser :

http://plasma-umass.github.io/doppio/about.html

Anything is possible in the browser.

Re:Gap between asm.js and native gets narrower with float32 ... by serge2k on Friday December 20, 2013 @01:47PM (#6943180)
Anything is possible in brainfuck too. You can also do all your coding in just C++ templates.

Doesn't make it a good idea.

Re:Gap between asm.js and native gets narrower with float32 ... by coldtea on Friday December 20, 2013 @04:07PM (#6944028)
Yes, if only using the browser as a platform also had other benefits... Oh, wait!
Re:Gap between asm.js and native gets narrower with float32 ... by serge2k on Friday December 20, 2013 @04:52PM (#6944301)
I fail to see the benefit of building a jvm to run in a javascript engine.

I would rather see effort to develop a better language than JS for the web. Now someone will bring up emscripten and dart...

Re:Gap between asm.js and native gets narrower with float32 ... by coldtea on Saturday December 21, 2013 @01:26AM (#6945985)
>I fail to see the benefit of building a jvm to run in a javascript engine.

That's because you picked a very specific example to suit your argument.

How about seing the benefit of building games to run in the browser with near native speed? Or something like Mathematica? Or an image editor, etc etc...

Re:Gap between asm.js and native gets narrower with float32 ... by _random_ on Saturday December 21, 2013 @02:33PM (#6947665)
The long-term plan is to avoid being locked into crappy languages such as JS and HTML/CSS and give developers more freedom.
Re:Gap between asm.js and native gets narrower with float32 ... by kalleboo on Friday December 20, 2013 @11:37PM (#6945782)
Wow, those Qt demos are actually really quick and responsive.
Re:Gap between asm.js and native gets narrower with float32 ... by GregBuchholz on Friday December 20, 2013 @05:23PM (#6944500)
Someone should tackle Squeak on asm.js.