Running Java bytecode on the Android - Sun JVM on top of DalvikVM

后端 未结 7 1757
慢半拍i
慢半拍i 2021-02-02 13:17

Since both the java implementation (OpenJDK) and Android\'s virtual machine DalvikVM are opensource it must be possible to implement Sun\'s JavaVM on top Google\'s

7条回答
  •  醉梦人生
    2021-02-02 13:49

    The OpenJDK makes use of native code so it would be a non-trivial port... there is at least one VM (JikesRVM) that is written in Java, unfortunately it is not a completely working implementation of Java.

    Since DalvikVM runs classes that were converted from .class files it should be possible to convert the classes over. Then the "only" issue is when languages generate bytecode on the fly - for that it would require the extra step of converting the generated bytecode over to the DalvikVM format while the program is running on the DalvikVM.

    Hmmm.... sort of a JITT (Just In Time Translator) that covertes class files to a DalvikVM files at runtime on the phone. I wonder how slow that would be.

提交回复
热议问题