News for hackers. Stuff that matters.
Re:Firefox's low-latency WebAssembly compiler by pjmlp on Friday March 27, 2020 @03:11AM (#22700924)
CLR supports C and C++ quite well.
Re:Firefox's low-latency WebAssembly compiler by Rusky on Friday March 27, 2020 @11:59AM (#22704010)
The CLR is not "most other VMs." You might say it's the exception that proves the rule. ;)

Further, as I've pointed out to you before, the CLR does not really support unmodified C and C++ as well as WebAssembly does. It supports C++/CLI instead, which is not a superset of standard C or C++. And worse, the main (only??) compiler for C++/CLI has no plans for keeping newer features of C++ working on the CLR.

In the context of this discussion about integrating GC into a VM that supports C and C++, the CLR is an odd choice of example anyway. The CLR doesn't aim to support existing languages unmodified, every port I've seen has been similar to C++/CLI in diverging from its original definition, specifically because of its memory and object models. And those are precisely what WebAssembly does away with.

Re:Firefox's low-latency WebAssembly compiler by pjmlp on Friday March 27, 2020 @12:32PM (#22704323)
WebAssembly also does not support unmodified C and C++.

What do you call emscripten and the language extensions it makes use of, then?

One of the major features for .NET Core 3.0 was C++/CLI support. It is a major .NET language in Windows desktop applications, as it is more convenient than writing P/Invoke annotations.

Also CLR is just the example more people nowadays can relate to, I can give other C and C++ bytecode examples.

Re:Firefox's low-latency WebAssembly compiler by Rusky on Friday March 27, 2020 @01:14PM (#22704727)
You don't have to use emscripten or its language extensions to build C or C++ for WebAssembly. And in the other direction, emscripten's raison d'etre is unmodified C and C++, by providing the platform APIs those unmodified programs use.

.NET Core 3.0's C++/CLI support, again, is not standard C++ and never will be! It's just the same C++/CLI on a more up-to-date CLR.

Re:Firefox's low-latency WebAssembly compiler by pjmlp on Friday March 27, 2020 @04:46PM (#22706712)
So then help me here, I am kind of lost, in which ISO C page are EMSCRIPTEN_BINDINGS, EXPORTED_FUNCTIONS described, or WebIDL for that matter?
Re:Firefox's low-latency WebAssembly compiler by Rusky on Saturday March 28, 2020 @12:57PM (#22712384)
As I originally pointed out, the difference between C++ and C++/CLI is that C++/CLI is not just a superset of standard C++. Things are changed or missing, not just added. You can't just take a pre-existing standard C++ program and drop it in a C++/CLI compiler because you'll hit all those differences.

(Things may have been better in the past, but the C++/CLI spec has not kept up with the C++ standard at all and so the main implementation, when asked for "C++17 and C++/CLI," just kind of shrugs and makes a mess.)

This is not true of emscripten. It does add some Javascript binding functionality, but that's no different from e.g. Linux or Windows offering their own platform APIs beyond the C++ standard library. You can just take a lot of pre-existing standard C++ programs, often including those that use platform-specific APIs, and drop it in emscripten!

Re:Firefox's low-latency WebAssembly compiler by afiori on Friday March 27, 2020 @04:51AM (#22701288)
CLR and wasm share many design goals
Re:Firefox's low-latency WebAssembly compiler by pjmlp on Friday March 27, 2020 @05:00AM (#22701316)
Yeah, except that usually WebAssembly is placed as being innovative in supporting C and C++.

Bytecode for C and C++, is even older than the CLR, and before the browsers, there were a couple of J2ME competing stacks that used C and C++ instead.

Re:Firefox's low-latency WebAssembly compiler by afiori on Friday March 27, 2020 @05:39AM (#22701446)
Again, the innovative part is the embeddability of the bytecode/VM. The CLR is not designed to run malicious code and still be safe (It had very interesting work on that with Midori, still).

The innovative thing with wasm is half political (that is it is socially free to implement and use) and half the lightweight reliable sandboxing.

It is perfectly possible that there is a subset of the CLR that would have been a better Web-Assembly than this WebAssembly, but the CLR chose different trade-offs so it isn't.

One of WebAssembly main distinguishing features is that it can compete with eBPF in term of safe embeddability.

Re:Firefox's low-latency WebAssembly compiler by garganzol on Friday March 27, 2020 @05:34AM (#22701420)
WebAssembly is indeed innovative, especially in the field of security. Another great concept is normalized control flow graph of WebAssembly byte code - it significantly simplifies the job for interpreters and JIT compilers at run time.

But WebAssembly (wasm32) code density is not the world's best. Comparing to good old x64 it goes at 1.42/1.0 ratio which is still tolerable. I hope someday we'll get a more dense instruction set like ARM's Thumb.

Re:Firefox's low-latency WebAssembly compiler by pjmlp on Friday March 27, 2020 @05:38AM (#22701435)
So what does it offer versus CLR, IBM i and z/OS security models?