Android系統已成為智慧型手機的第一大作業系統,其上的應用程式也有許多豐富的內容。Android上的應用程式是由Java撰寫,經過編譯成為class檔案之後,再經過Android SDK的dx工具轉換為dex檔案──它是一個register-based指令集,並且考量到行動裝置的架構及運算能力而制定的程式碼和格式。若能將這些程式碼轉換成為能夠再次利用的型式的話,不論是開發或研究上都會有相當的幫助。由於目前對於dex檔案的轉換工具尚不夠豐富,相對於已經有了許多研究的Java bytecode轉換,若能利用彼此之間的關係將dex檔案的轉換套入已有的Java最佳化資源當中,便能夠使dex檔案也能夠運用豐富的Java bytecode最佳化成果。 在套用既有資源做嘗試時,我們發現了幾個dx轉換時所改變的程式碼模式;由於這些模式都破壞了原來javac所編譯出來的程式碼樣式,因此使得既有的最佳化演算法無法處理。我們整理了這些模式以及它們對程式碼的影響,並且在實際的應用程式上測試了其效果。
The Android operating system had became the largest operating system in the smart phone area, and there are many rich contents in the applications of Android. These applications are written in Java, compiled to class files, and converted to dex files (which contains the register-based bytecode and optimized for the architecture and the limited computation power of smart phones) by the dx tool from Android SDK. Since there are few transformation tools for dex files compared to the abundance of resources of optimizing and analyzing Java class files, making these resource available to dex files can greatly improve the reusability and researching potential of them. When trying to use these resources to analyze dex files, we find that some optimization transformations done by the dx tool cannot fit in the original analyzing framework, since these transformations break the pattern of javac-complied programs and cannot be recognized by these algorithms. We collected the transformations we found that dx does and measured their effect on real applications.