HNHacker News
TopNewBestAskShowJobs

jfbastien

422 karma · joined November 27, 2013

https://twitter.com/jfbastien
submissionscomments
jfbastien··on Experimental support for WebAssembly in V8
C Python and Ruby should "just work" because you can compile their GC into you wasm module.

More general-purpose GC will be supported, but not in the initial release: https://github.com/WebAssembly/design/blob/master/GC.md

jfbastien··on Experimental support for WebAssembly in V8
Everyone on V8 would disagree with you :-)

Type tracing in particular is the big win, and with a dynamic languages you simply can't prove enough to do it ahead of time. There's also startup time that you're paying with AOT and avoiding with JIT.

jfbastien··on Experimental support for WebAssembly in V8
"ridiculously easy": https://github.com/rust-lang/rfcs/issues/604
jfbastien··on Experimental support for WebAssembly in V8
Transpiling some dynamic languages to JS is still sensible. WebAssembly is initially for static languages, and eventually (with JIT and GC support) it'll be usable as a building block to host dynamic language VMs.
jfbastien··on Experimental support for WebAssembly in V8
It should "just work", but we're still at the experimental stage right now so it may break randomly. It's not production quality yet, but mobile is a first-class platform for launch.
jfbastien··on Experimental support for WebAssembly in V8
WebAssembly has its own semantics, similar to asm.js (statically typed) but much cleaner because it doesn't need to map onto JavaScript.
jfbastien··on Experimental support for WebAssembly in V8
Correct, though we're working on dynamic linking to ease the pain, and improving compilers such as LLVM so that the generated code is smaller.
jfbastien··on Experimental support for WebAssembly in V8
Python is just another language VM. C Python should work just fine in WebAssembly, and bridging the APIs to the web (e.g. filesystem, etc) is already possible through Emscripten.

We don't plan to do things for WebAssembly, we plan to make WebAssembly powerful enough that anyone can run their language VM :-)

jfbastien··on Experimental support for WebAssembly in V8
When WebAssembly is further along the capabilities of PNaCl should be polyfillable to WebAssembly, and it would then make sense to ship one fewer VM. Otherwise NaCl and PNaCl have a solid track record of running code near native speed in an extremely secure sandbox. It's under Chrome's Vulnerability Reward Program, you're welcome to look for payoffs ;-)
jfbastien··on Experimental support for WebAssembly in V8
Software isn't free because you can see its source. JavaScript is no free-er, and no more view-source-able when minified, than WebAssembly is.

View-source is an explicit goal of WebAssembly's first launch: https://github.com/WebAssembly/design/blob/master/FAQ.md#wil...

jfbastien··on Experimental support for WebAssembly in V8
"In development": https://webkit.org/status/#specification-webassembly
jfbastien··on Experimental support for WebAssembly in V8
Right: direct hardware support can't be beat. Once WebAssembly has solid SIMD support and memory management that allows zero-copy then it should be* as good as it gets without direct hardware support.

* Assuming we're smart about security check elimination and SIMD codegen, which are both hard to do right.

jfbastien··on Parallel STL
There are a lot of papers to follow, unfortunately. Listed here: http://open-std.org/jtc1/sc22/wg21/docs/papers/2014/ http://open-std.org/jtc1/sc22/wg21/docs/papers/2015/

You'll want to follow mostly Mysen's and Kohlhoff's proposals on executors.

jfbastien··on Parallel STL
You're thinking of C++'s "executor", which is currently being discussed for addition to the standard. The parallel STL will use the executors once they're added to a technical specification. There's agreement on how integration this will work, and that it's the right thing to do, but executors don't have a fully agreed-upon API yet.

We (the C++ standards committee) discussed these things further this week :-)

jfbastien··on PDFium: Chrome’s PDF rendering engine is now open-source
I discussed this with Alon on IRC: you wouldn't use pepper to do this. NaCl doesn't imply pepper, you can expose a subset of syscalls into the trusted code base.

I understand the feeling about DRM, but given that sandboxed DRM is going to happen I'd hope that the best efforts possible are put in to make users safe. Good sandboxing seems the right way to go. I'm not any kind of a security expert, but jschuh seems to think the current sandbox isn't sufficient: https://bugzilla.mozilla.org/show_bug.cgi?id=1011491 I hope the right improvements go into tightening the DRM sandbox :)

jfbastien··on PDFium: Chrome’s PDF rendering engine is now open-source
Sorry, I don't check HN often. As we discussed on Twitter & IRC:

It's just an OS sandbox currently. pdfium previously worked with NaCl, with a non-V8 JS VM (work done by Bill Budge). V8-on-NaCl used to work, I think it may have bitrotted since then, but it used NaCl's dyncode modify API to do PIC. The GC moves code too, so extra page permissions need to be changed when that's done, but I think that's the extent of code modification that needs to be handled for a JS JIT to work on NaCl (on top of the sandboxing).

jfbastien··on PDFium: Chrome’s PDF rendering engine is now open-source
The DRM sandbox is yet another attack surface, isn't it? Wouldn't it make sense to use NaCl for DRM sandboxing, and then the option is open to use the same sandbox for PDF viewing, and pdf.js can still work, giving users choice.

Creating yet another sandbox seems silly, and NaCl hasn't been hit by pwnium, it's only been a stepping stone to the renderer (I'll let comex dive into details here!)

jfbastien··on On Asm.js
Oh I see your point on being a proper fit. It's not much of an argument then, since you're just saying that making it work when it wasn't quite designed for that use is hard, but we did make it work. So I agree :-)

I also wish there weren't any UD, but we did try to do a good list and I think we chose which to fix and which to punt on purpose.

I see memory allocation (both for code and data) as well-defined randomness: saying that the allocated base addresses are random allows many interesting types of sandboxing to be used which couldn't be used otherwise (more on that in the future). I think this will lead to interesting perf gain in some cases, and interesting security gains in others. More pragmatically it currently allows ASLR while still providing memory access without indirection (i.e. reg-reg addressing) on x86-32 and ARM.

jfbastien··on On Asm.js
I think quoting Dan's email repeatedly is entirely unhelpful, I'd appreciate it if you wouldn't to that. We've actually addressed every single point in Dan's email, talked to Dan repeatedly, and gone beyond what he originally wrote. Sure it has a catchy title, but if you actually read it (and the replies it generated back then), and then compare to what PNaCl does (including discussions on the LLVM mailing list) you'll see that I'm not making things up here. Our IR subset was designed to be portable and stable.

Undefined behavior: it's mostly gone by the time the pexe is created, and our intent is to remove all that's left (e.g. shift by larger than bit width is trivial to fix). I think what's left is mostly non-issues that can't be easily fixed without breakage, so honestly I don't think undefined behavior is any kind of a deal breaker at this point. asm.js still doesn't have canonical NaNs so it's not fully defined ;-)

Note for other readers here: yes C/C++ have undefined behavior, but both PNaCl and asm.js settle on actual behavior before something gets shipped to the browser.

On compile speed: agreed, but I'll take the "it's getting better" approach here (hey, asm.js can do it for runtime!).

I'm not quite sure why having a non-SSA representation would be a requirement. I agree that there are advantages, but I think that's true of both approaches.

Extra bindings and non-Pepper: agreed.

jfbastien··on On Asm.js
I think you're conflating frontend and back end. As they currently exist both asm.js and PNaCl frontends are LLVM, if just because it's a good C/C++ solution to parse and optimize. The backend is indeed an LLVM subset as of today for PNaCl and not asm.js, but it's a very restricted subset because the complex bitcode definition LLVM has was pruned a lot for PNaCl, both to distance it from LLVM churn and to make it implementable in another VM.

It is definitely possible to implement a non LLVM back end for PNaCl.

The bug you quote is quite the opposite of what you state: Mark was explaining how complex and potentially often varying LLVM's representation of atomics was. There is a need for atomics to express the full breadth of capabilities C11/C++11 has, but it has to be solved in a way that is close to the standard and no more, non of LLVM's quirks and legacy cruft (LLVM predates these standards, launched PNaCl does not). The primitives also have to be packaged portably so that they can be expressed correctly on any hardware targets (this happens to be tricky to get right, especially since Clang usually makes assumptions about the target). I think PNaCl got this one exactly right, but then again I'm the one who implemented this. :-)

← PreviousPage 3 of 3