Why is the JVM stack-based and the DalvikVM register based?

Posted by aioobe on Stack Overflow See other posts from Stack Overflow or by aioobe
Published on 2010-04-27T07:37:04Z Indexed on 2010/04/27 7:53 UTC
Read the original article Hit count: 467

Filed under:
|
|

I'm curious, why did Sun decide to make the JVM stack-based and Google decide to make the DalvikVM register based?

I suppose the JVM can't really assume that a certain number of registers are available on the target platform, since it is supposed to be platform independent. Therefor it just postpones the register-allocation etc, to the JIT compiler. (Correct me if I'm wrong.)

So the Android guys thought, "hey, that's inefficient, let's go for a register based vm right away..."? But wait, there are multiple different android devices, what number of registers did the Dalvik target? Are the Dalvik opcodes hardcoded for a certain number of registers?

Do all current Android devices on the market have about the same number of registers? Or, is there a register re-allocation performed during dex-loading? How does all this fit together?

© Stack Overflow or respective owner

Related posts about jvm

Related posts about dalvik