9 ms·
Partial WebAssembly backend for the GNU toolchain
- felipellrocha 10y agoHow is this different than using the emsdk to build?
- bobajeff 10y agoEmscripten is a cross-compiler tool chain. This is a back end for a compiler. Currently Emscripten uses a fork of Clang/LLVM called fastcomp with a ASM.js backend. This is a fork of GCC/Binutils with a WebAssembly and ASM.js backend.
- azakai 10y agoTo add to that, in principle Emscripten could use gcc and this backend instead of clang and an LLVM backend. Emscripten itself abstracts over the backend details (it's supported 3 different backends in its history, and currently supports 2). Most of the code in Emscripten is in the libraries, like OpenGL=>WebGL, etc., and JS integration code, which shouldn't depend on the backend. It would be interesting to get that working and do some code comparisons on the output.
- quickben 10y agoSo what does the future hold? Will this replace JavaScript?
- JoshTriplett 10y agoIn the short term: probably not for small glue scripts, but it'll provide a serious alternative for larger web applications. In the long term, we might see WebAssembly used as a means to implement JavaScript, such that you can count on the same set of features in every browser. That'll depend on how well WebAssembly can interface with the DOM and with other browser APIs without needing JavaScript shim layers.
- EamonnMR 10y agoThe point about having a nice API is huge-otherwise we'd still be writing java applets.
- pekk 10y agoIntel x86 assembler is arguably not a nice API, but most of us are not working at that level any more. The requirements for an instruction set aren't really the same as the requirements for a language well suited to writing, say, video poker games.
- oblio 10y agoI don't get why people are so excited about WebAssembly, at least on the whole "replace Javascript"/"remove web bloat" aspect. Right now we have Javascript and its assorted libraries, which, as bad as they are, come with the browser or at least are generally reused/cached very frequently. People seem to fail to realize that everyone and their mother will dump their runtimes and their VMs on top of WebAssembly as soon as they will be able to. Java Applets 1, 2, ..., 100. Yes, they will present it in a very fancy and attractive way, but fundamentally that's what will happen, cause who wants to rewrite everything for Javascript-land when they're not forced to? Competitive pressure will always push towards bloat, just look at Facebook and they Android-runtime busting app for an example. I, for one, am looking forward to the day where, besides the 500MB of Javascript my 40 tabs are loading, I'll also load 1.5 GB of WebAssemblied formerly native runtimes.
- s369610 10y agoI doubt it will be for average brochure sites, but I have used it in two situations, one to encode a series of captured canvas frames into ogg video on the client using ffmpeg to save bandwidth on a telehealth web application, and another to embed a mobile game engine in with samples so users can interact in the browser without having to download build and run http://moaiforge.com/samples/sample-browser/player/index.html#hello-moai http://moaiforge.com/samples/sample-browser/player/index.htm...
- tromp 10y agoI'm excited at the prospect of 64-bit integer support, which will significantly speed up many applications, making even web-based proof-of-work mining feasible.
- rspeer 10y agoWait. Why would you want web-based proof-of-work mining? Does this have a legitimate purpose, or is it all about forcing unsuspecting visitors to mine Bitcoin for you?
- drchickensalad 10y ago
- tannhaeuser 10y agoThe more imminent concern is that publishers are beginning to bundle browser runtimes completely replacing native browser functionality along with its established privacy and fair use expectations. Say hello to unskippable interstitials, unblockable analytics and targeted advertising, content that can't be linked, saved/archived, mirrored, cached, shared, translated or made otherwise accessible. Developers mostly discuss JavaScript shortcomings and new possibilities offered by WebAss, but seem otherwise happy to completely throw the fundamental architecture of the web under the bus. Technically, what WebAss can do has since long been possible with native applications; the only thing added here are new software licensing models, eg. pay-per-use, but mostly tracking/ad-financed.
- vertex-four 10y agoOr... you could continue avoiding websites that do what you deem unacceptable things. I won't visit a Forbes website intentionally - I have no intention of supporting a site that wants to throw ads quite that blatantly in my face. There'll always be a very large amount of sites that behave respectably.
- tmccrmck 10y agoWhat sites do you frequent? Almost every site is infested with advertising.
- pekk 10y agoThis isn't a dystopian future we can avoid, it is a dystopian present that already happened and we are stuck with it. Almost every page needs JS to use. Almost all JS is thoroughly munged beyond readability. It's normal for even page navigation (surely a browser function) to be handled in JS, and for resource loading (again a browser function) to be done through JS making AJAX requests to URLs generated deep in a minified blob. The accessibility nightmare is real. Ads are common as ever and adblocking is an arms race never won. DRM has been here for years, and HBO isn't putting .mp4s on an FTP server any time soon. YouTube is almost unwatchably saturated with ads and is run by Google, the search and analytics company. Targeted advertising and analytics are a bell that can't be un-rung. The web you are trying to save became a victim of its own success, somewhere around when everyone decided it was going to be HTTP and HTML instead of gopher, the browser wars started and AOL users started to flood USENET.
- tomatsu 10y ago> Will [Wasm] replace JavaScript? For bigger games, maybe. For applications, not so much. However, it will give you the ability to mix and match different languages more freely. E.g. you can write processing-intensive modules in Rust/C/C++ and continue to script the UI with JS/TS/Dart. This way you won't have to recompile tens or even hundreds of thousands of lines of code for minor UI changes.
- tyingq 10y agoWebAssembly does have GC, Polymorphic Inline Cache, and direct DOM integration on their roadmap. So, at some point, you should be able to compile any language to WASM, including Javascript. The only real barrier would be the size of the runtime / standard library for the language. If WASM supports also supports some kind of hashed cache where many sites can share a language runtime, that's not even much of a barrier. I suspect once it's stable, you'll see all sorts of languages being used in the browser.
- JoshTriplett 10y agoI sincerely hope this gets a good reception, and doesn't suffer the fate of previous attempts to add similar backends to the GNU toolchain. In the past, backends for anything usable as an intermediate language received pushback as possible "escape hatches" by which one could glue proprietary code (whether frontends, backends, or optimization passes) into the GNU toolchain. That pushback mostly went away when the GCC Runtime Library Exception came out, which makes such proprietary combinations much less viable. So, hopefully this will get merged, or at least get on the path to merging after further development.
- hamandcheese 10y agoI don't really follow. Do you mean, for example, BigCorp making a backend that compiles to proprietary BigCorpLang? Why would that be such a bad thing?
- foota 10y agoI think they mean it compiles to BigBorp ir which is then used with BigCorps secret sauce optimizing compiler.
- bonzini 10y agoThat's already happening with the nVidia PTX backend, so I guess that's accepted too nowadays.
- icebraining 10y agohttps://lwn.net/Articles/582241/ https://lwn.net/Articles/582241/
- astrange 10y agogcc already has frontends (GIMPLE), backends (LTO and HSAIL) and plugins (DragonEgg) that do this, so you've had nothing to worry about for like five years now.
- pekk 10y ago
- bitL 10y agoThis is precisely what I was waiting for! Finally a set of reasonable languages for web! Many thanks!!!
- 7373737373 10y agoIs the closer C family of languages really reasonable for the web?
- andrepd 10y agoMuch better than the mess that is JS, IMO.
- bitL 10y agoIn many ways yes, as C can be much more straightforward than JavaScript, which enforces spaghetti-programming by design (via callback hell). So anyone used to develop desktop apps, facepalming on trivial problems in JS like loading resources, can rejoice. And I expect other languages will be ported soon, like Java, C#, Scala, Python, Go, Rust etc. Imagine getting the whole Java stack of libraries, .NET or ML stack for Python running on top of WebAssembly with almost zero differences and at native speeds. Why not?
- steveklabnik 10y agoRust has basic support today. We're working on making it even easier. https://users.rust-lang.org/t/compiling-to-the-web-with-rust-and-emscripten/7627 https://users.rust-lang.org/t/compiling-to-the-web-with-rust... (This post is a bit old, it works on stable nowadays, but it gives you the basic idea)
- minitech 10y agoJavaScript doesn’t have “spaghetti-programming by design via callback hell”. Callbacks are a common approach to dealing with events and asynchronicity because nothing was built into the language (until it added promises and async/await, like how nothing was built into C# until it added tasks and async/await). There certainly isn’t anything built into C.
- joaomacp 10y agoMaybe it's a foolish thought, but it occurred to me that maybe in 10/20 years AAA game titles will have a 'web' version, as well as the PC and game console ones. Or maybe they let you play a demo for free on the browser, with real gameplay mechanics and graphics made with wasm or similar tech.
- bitL 10y agoIn 10 years there won't be any difference between a web-app and a desktop app precisely because of WebAssembly-like tech. Imagine WebAssembly being the new JRE or .NET runtime (or maybe more like JavaFX, but supported by everyone). You can run it in a browser, but you don't have to. All native stuff will be accessible to you, like Vulkan, OpenAL etc.
- Longhanks 10y agoSounds like my worst nightmare. Browsers won't and should never have the full capabilities of native APIs. It's certain that many more applications will shift into web apps, but there are limits to what I'll want my browser to do.
- bitL 10y agoIt's more like you won't need to develop for two-three targets, like today with desktop, web and mobile. Instead you will use the same runtime, though there might be some restrictions on each platform you'd need to take into account (like handling permissions properly) and make sure your code would work on any platform that provides the capabilities you require.
- Sanddancer 10y agoJava promised that, but we got write-once, debug anywhere. Those different features, bugs, permissions, etc, mean you'll still have to test the platforms, build up different UIs for each platform, etc. About all you'd end up gaining is a stylesheet-based rendering engine, but you'd get that with something like XAML as well.
- gant 10y agoAnd thus the era of METAL[1] begins... [1]: https://www.destroyallsoftware.com/talks/the-birth-and-death-of-javascript https://www.destroyallsoftware.com/talks/the-birth-and-death...
- spraak 10y agoThis is super enjoyable thank you ^_^
- andrewflnr 10y agoAnd compelling. Can you really make that work securely in the kernel?
- amelius 10y agoIt's a nice idea, but it goes against layered security [1]. Perhaps computer-assisted proofs can make that a non-issue. In any case, I would very much like to see an implementation of this. [1] https://en.wikipedia.org/wiki/Layered_security https://en.wikipedia.org/wiki/Layered_security
- deleted 10y ago[deleted]
- deleted 10y ago[deleted]