3 ms·
> Future-tech, remember. Not so much future tech. The most sophisticated JIT in production use nowadays is HotSpot's optimizing JIT, and next year it's getting
by pron 12y ago
> Future-tech, remember.
Not so much future tech. The most sophisticated JIT in production use nowadays is HotSpot's optimizing JIT, and next year it's getting this: http://openjdk.java.net/jeps/165 http://openjdk.java.net/jeps/165 (basically, metadata that the programmer can use to help the JIT with some decisions). HotSpot's next-gen JIT, Graal, takes five more steps forward and allow a full programmer-controlled JITting, that can suggest and improve various speculations on the semantic AST: https://wiki.openjdk.java.net/display/Graal/Publications+and+Presentations https://wiki.openjdk.java.net/display/Graal/Publications+and...
I have full confidence in the general utility of JITs for server-side applications, but JITs themselves are a tradeoff (require warmup or caching, more RAM and more energy).
> There's nothing stopping you from transforming C code into Rust code
Not really, because Rust requires manual type annotations. Either they are added manually -- in which case you may as well translate manually -- or automatically, in which case the tranlator would need to infer the very same properties you want to verify.
> Just that language semantics (which consist of such things as a type system, a threading/memory model, etc.) have no reason to be tied to either a particular syntax, or a particular VM.
But they do because it's not just syntax -- the language and runtime are really a part of the algorithm (in fact, most algorithms presuppose a certain execution context like random, constant-time access to memory). The threading/memory model is what determines whether certain algorithms can be implemented at all; functional purity can completely change the complexity (by more than a constant) etc.
> I foresee much more of this, and much more cleverness about it: writing code that compiles to a bunch of separate modules for separate VMs, which then form a micro-distributed-system all within a Docker container or somesuch.
The problem with that is that once you go distributed (even on the same machine) there are tremendous performance costs involved. Not only marshalling/demarshalling of data, but fanning-in and then fanning out your concurrency on each end. There's no way you can use, say, a Java parallel stream, whose parallel operation is performed over the wire. There are only very specific places where you can place that boundary.
I do, however, think that a platform such as OpenJDK, with such powerful GCs and JITs, can -- and indeed does -- contribute significantly to the ability to interoperate among various languages -- but certainly not all of them.
- derefr 12y ago> But they do because it's not just syntax -- the language and runtime are really a part of the algorithm. I don't think you understood my statement above—what you're attributing to the runtime (memory-model et al) is part of the abstract machine specified by the language's semantics, but that's orthogonal to the runtime. A runtime can be a better or worse fit for a given language's semantics, but any VM can virtualize any abstract machine with enough glue. VMs are Turing machines, after all. (In practice, the overhead can be surprisingly low; you don't have to emulate what you can trace or dynamically recompile. The work around ASM.js is rich in data about how to squeeze performance out of the not-particularly-direct mapping of the C abstract-machine to the JS VM.) The abstract machine formed by the language semantics can, of course, demand live support machinery of the underlying runtime (like a GC, say) that may have to be "polyfilled." This is what we've been doing forever—a PIT signalling a processor interrupt which is checked for between each cycle is just a polyfill for having concurrent processes on other processors sitting in blocking-sleep for a bounded time, for example. Any hardware emulator is full of these. Usually you can find ways to make them less necessary—IronRuby doesn't contain its own GC with Ruby semantics, it just translates Ruby's GCing requirements into calls to the CLR allocator+GC and the result works "well enough." > Not only marshalling/demarshalling of data, but fanning-in and then fanning out your concurrency on each end. Why are you assuming message-passing distribution? Shared-memory cross-runtime distribution works too. That's how ZeroMQ works, for example.
- pron 12y ago> what you're attributing to the runtime (memory-model et al) is part of the abstract machine specified by the language's semantics OK, I see where you're going with this. But now you'll need a "bottom representation", which, even if it is easier to transform than machine instructions, will be pretty hard to decompile to another language. For example, most interesting lock-free algorithms require some sort of garbage collection; how do you describe that GC behavior, which doesn't necessarily need to be general purpose, in a way that can be ported to both C and Go?) Theoretically it may be doable, but in practice the problem is very, very hard. The big question, then, is why bother? The JVM already provides excellent interoperation with excellent performance that can cover the vast majority of (at least) server-side applications out there, and Graal/Truffle are extending the range of languages that the JVM can provide the fastest implementation for (it's early days and it's already pretty much on par with V8 when running JS, and faster than PyPy for Python). Those applications not within this profile range will use other languages (like C++), but those languages are already more expensive to develop in, and their developers happily pay more for more specialized algorithm implementations. > Shared-memory cross-runtime distribution works too. That's true (provided both sides can agree on an ownership and concurrency behavior).