5 ms·
I understand why Google would want to use Java in their app platform. But if they didn't have the resources to get JIT working before now, wouldn't gcj (or hel
by jbellis 16y ago
I understand why Google would want to use Java in their app platform. But if they didn't have the resources to get JIT working before now, wouldn't gcj (or hell, write your own java-to-machine-code compiler, clearly Google isn't scared of writing compilers) have been better than using a non-JITed VM?
- Daishiman 16y agoThe point of using a VM was to abstract away from specific processor targets, since embedded processors run from ARM to PowerPC, MIPS, x86, and others (and multiple variants of each processor, support additional instruction sets). This allows OEMs to produce an x86 port of stuff while keeping 95% of all apps which don't need native compilation.
- nimrody 16y agoWell, you could always ship software in platform neutral code and make the final transition to native code when they are installed (either with something like gcj or use some intermediate representation like LLVM does).
- wgren 16y agoThat is basically what JIT is. Why reinvent the wheel when they can use the resources that has been poured into JVM research?
- jbellis 16y agoExcept they can't, really. Dalvik is completely unrelated to Hotspot or any other JVM out there. (Remember that Android doesn't run Java class files natively, it's first compiled into dex.)
- wgren 16y agoRight you are jbellis. Had forgotten that Dalvik isn't just a small JVM but a completely different architecture (register based, etc). But anyway, what nimrody suggested is what they are doing - using platform neutral Dalvik bytecode and then transition to native through JIT.
- theBobMcCormick 16y agoI think that would have it's own complexities. You'd have to ship each phone with a compiler and related toolchain. You'd also end up with two copies of each application installed on the users phone (one in the neutral format and one native). Sound like kind of a messy approach. Really, the existing non-jit'ed Dalvik VM runs fast enough. If you think about it, their decision to ship a non-JIT VM and enhance the platform with JIT later is very much like Apple's approach with the iPhone of initially shipping the product without cut-and-paste and without any native API for third party apps, but then enhancing the platform later by adding those (and many other) features later. Both companies shipped when they had a platform that was "good enough", then have kept iterating and improving.
- s3graham 16y agoIt's not quite that obvious. Compared to desktop/server where almost any jit is a win, there's substantial pressure on memory usage and battery life. An interpreter can do better on whole-system performance for both of those, without special care for when to run the jit, and how it's implemented. I'm looking forward to seeing Bill Buzbee's talk on the JIT at I/O (of the most excellent http://www.homebrewcpu.com/ http://www.homebrewcpu.com/ incidentally! :)
- ergo98 16y ago>But if they didn't have the resources to get JIT working before now, wouldn't gcj (or hell, write your own java-to-machine-code compiler, clearly Google isn't scared of writing compilers) have been better than using a non-JITed VM? The Dalvik VM uses its own bytecode and all, so they would have to heavily modify anything existing. Ultimately Android has been a work in progress. JIT is something that everyone has been asking for since day one, but there just aren't enough resources -- Apple is a $220 billion dollar company that is significantly hinged on the iPhone OS. The Android project, while relied upon by a lot of companies, is largely the work of Google that sees little to no revenue from it (their primary motivation, purportedly, was simply to ensure that there were options in the market).
- cpr 16y agoClarification: their primary motivation is so that they could ensure that at least some part of the mobile market could run their ads, they realizing that mobile is the future, and that ads are currently their only real source of income.
- ergo98 16y agoAbsolutely true. As a business they don't want to be in a position where they can be cut out of the ecosystem. That's actually an interesting facet of Android -- much was made recently about one of the open handset partners replacing Google with another search engine, but that's exactly how the platform is supposed to work. Google has no free in to all of the platform, beyond the add-ons like Google Mail that the partners would almost certainly want on the phone.