Live data from Hacker News

HolyJit: A New Hope

blog.mozilla.org

201–210 of 219 posts

Re: HolyJit: A New Hope

#201
post #199

Earlier quoted context omitted.

That is what I imagined when the Karger/Thompson attack came up with regards to Rust. The simplest cheat would be mapping low-level Rust to a safe subset of C. Automatically or hand-convert the source for Rust compiler. Then, run that through CompCert. A Csmith-style program run through both versions of Rust compiler might also catch errors in one or both. One might also use the C tooling to find errors in the Rust c…

I admit that I'm quite curious about determining exactly what features could be left out of maximally-explicit Rust, because it would determine the obvious MVP for an alternative compiler, that could technically compile all Rust code with the caveat that you would need to first losslessly and automatically transform the source (which theoretically shouldn't be too hard to add the Rust compiler, e.g. it already has th…

This is why I wish that there was a higher-level, maintained api for the compiler internals, to make it easier to do these kinds of experiments

Re: HolyJit: A New Hope

#202
post #179
post #151

Earlier quoted context omitted.

I don't remeber ARM, MIPS, x86 or x64 having a good GC history either. If WebAssembly is good enough as C and C++ target, it is good enough as any of those processors. As for the potencial of WebAssembly, there are already ongoing efforts to port .NET and Java runtimes to it, and I am looking forward to Adobe porting Flash to it as well. So it will come, WebAssembly + Canvas + WebGL is already quite usable.

> I don't remeber ARM, MIPS, x86 or x64 having a good GC history either. Typical client programs intended to run on nascent versions of those architectures were not intended to be delivered and installed very often. In contrast, web pages might get changes deployed to production multiple times a day. Needing to deliver a compiled runtime solely in order to run your client side code is going to be a nonstarter for the…

Runtimes are already being delivered by the majority of languages that compile to JavaScript.

A GC runtime for a language with like Oberon semantics is just a few hundred KB, way less than sonething like minified jQuery.

Re: HolyJit: A New Hope

#203
post #187
post #151

Earlier quoted context omitted.

I don't remeber ARM, MIPS, x86 or x64 having a good GC history either. If WebAssembly is good enough as C and C++ target, it is good enough as any of those processors. As for the potencial of WebAssembly, there are already ongoing efforts to port .NET and Java runtimes to it, and I am looking forward to Adobe porting Flash to it as well. So it will come, WebAssembly + Canvas + WebGL is already quite usable.

Those ISAs are much lower-level than wasm. If you want to keep things secure, you have to restrict things. For example, wasm is going to optimize a lot of things and isn't necessarily going to treat your pointers the way you expect. Good garbage collectors need pretty fine-grained control. LLVM has been the bane of GC creators for the same kinds of reasons.

Only from those that want to rely on LLVM for their compiler backends.

Using LLVM to target WebAssembly is not a requirement.

Also the point isn't implementing the best GC algorithm, rather a good enough one.

Re: HolyJit: A New Hope

#204
post #175

Earlier quoted context omitted.

> You can sort of think of MIR as "core Rust", in that it's the final, desugared form of everything. Though I don't want anyone to get the impression that MIR is a source-compatible subset of Rust; it's a pretty different thing in its own right. (Worth clarifying because one could imagine a "fully-desugared" maximally-explicit subset of Rust, where e.g. all method calls are maximally disambiguated via UFCS, all types…

That is what I imagined when the Karger/Thompson attack came up with regards to Rust. The simplest cheat would be mapping low-level Rust to a safe subset of C. Automatically or hand-convert the source for Rust compiler. Then, run that through CompCert. A Csmith-style program run through both versions of Rust compiler might also catch errors in one or both. One might also use the C tooling to find errors in the Rust c…

This is kind of what mrustc does? It's a Rust-to-C compiler in C++; one which assumes the Rust program is correct (i.e. passes type/borrow check).

But you still need to resolve types to do dispatch, so that's a nontrivial amount of work.

mrustc can currently compile rustc, but the produced rustc doesn't pass the entire rustc testsuite (yet).

A colleague of mine was considering writing a Rust-to-C++ compiler that was similar, but offloading most of the dispatch/resolution work onto C++. This is actually possible, you can turn method dispatch and autoderef into template resolution. You can do stuff to fake type inference too if you know the program is correct already. This is much harder however and I'm not yet sure if it's 100% possible without doing some typechecking in the Rust-to-C++ compiler itself.

You could however take rustc --unpretty=typed (or whatever that option is these days) output and transform that really easily.

This requires you to be able to independently verify that the two ASTs are equal if you resugar, because you can't trust rustc's output for this. In fact, the poc trusting trust attack I wrote[1] would still go under the radar here.

Verifying ASTs as semantically equal is much less work. But there's a loophole here, it is possible to add type annotations to type inference'd Rust to get different behavior. This is because (among other things) integers are inferred more loosely (an uninferable integer type is defaulted as u32). It's possible that a trusting trust attack would be able to propagate itself merely by flipping around the results of inference.

Even if we looked out for that, you still have the problem of dispatch, where a backdoored rustc could change the method being dispatched to be a different trait. Now this isn't something that would work if you assume that the original code was code which compiled fine with rustc (because rustc complains when there's unqualified ambiguity). But we can't actually trust the original compiler to have handled this correctly either!

In both cases there would be need to be traces of weird code in rustc for this to work, but it might be possible to hide this.

(This is also somewhat a problem for mrustc, but to much a lesser degree)

[1]: http://manishearth.github.io/blog/2016/12/02/reflections-on-...

Re: HolyJit: A New Hope

#205
post #78

Earlier quoted context omitted.

Does Terry still post here? I just went to my settings to turn on dead posts.

I saw a couple of dead comments from him here on HN earlier today or yesterday evening actually. First time in a long while I'd come across his comment so that was kind of random. Edit: The comments were posted 6 hours ago, check his user page https://news.ycombinator.com/threads?id=TempleOS

mods, thanks for not permabanning him. it’s nice to read his posts and see he’s doing okay

Re: HolyJit: A New Hope

#206
post #70

How is this different from Pypy, other than the fact that ones uses RPython and the other uses Rust?

PyPy is a tracing JIT and mozilla abandoned their tracing JIT efforts (TraceMonkey) a few years ago.

Re: HolyJit: A New Hope

#207

Earlier quoted context omitted.

> everyone would be much better off emotionally if he just took his medication You say that as if the schizophrenic person, someone who lives in an alternate reality due to psychosis, has any kind of agency over taking his medication. You can only make that choice when you're sane, and even then the drugs aren't perfect and people routinely decide to come off them for some psychotic reason - yes, you can become psych…

> people tell you you can't handle being off the meds > you'll show them > go off the meds > you can't handle it > man fuck those people tho, it's all their fault

"Voices hearer" here. I've been mostly off antipsychotics for 7 years now (over 30 yo). If antipsychotics did just cut "voices" down I would be happy to take them, but unfortunately most of them have sedation and motivational side effects that are harder to bear than the "voices" themselves, which also I don't like. However, it comes handy to have them at hand during those occasional periods of insomnia, since my health priority is keeping a solid routine in study, sports and sleep pattern.

Re: HolyJit: A New Hope

#208

Earlier quoted context omitted.

> people tell you you can't handle being off the meds > you'll show them > go off the meds > you can't handle it > man fuck those people tho, it's all their fault

"Voices hearer" here. I've been mostly off antipsychotics for 7 years now (over 30 yo). If antipsychotics did just cut "voices" down I would be happy to take them, but unfortunately most of them have sedation and motivational side effects that are harder to bear than the "voices" themselves, which also I don't like. However, it comes handy to have them at hand during those occasional periods of insomnia, since my hea…

There is absolutely nothing wrong with you varying your medication in order to manage side effects. That's a very good reason. However, parent said:

> and failing that they come off them because they're so ashamed of being mentally ill from all those condescending and "well-meaning" (read: superior) people telling them what to do and how defective they are all the time that they want to prove they can handle it.

Which is a really bad reason.

Re: HolyJit: A New Hope

#210
post #200

Earlier quoted context omitted.

You will need to ignore anything non-technical. He suffers from mental illness and says offensive things.

I was online in the 80s. I have an account on voat. I visit Slashdot. I should be ok. ;-)

Ah Slashdot. I was there when it was cool :) I do have a 5 digit id, so there is that.

How is voat, like is the programming/tech comments worthy?

Post reply on HN