Please use this identifier to cite or link to this item:
http://tdr.lib.ntu.edu.tw/jspui/handle/123456789/6851| Title: | 使用LLVM實作Ahead-of-Time編譯技術於Android NDK Implement Ahead-of-Time Compilation via LLVM on Android NDK |
| Authors: | Wen-Han Ku 谷汶翰 |
| Advisor: | 廖世偉(Shih-Wei Liao) |
| Keyword: | 動態連結庫,可移植性,碎片化, Android,NDK,DSO,LLVM,Portability,Fragmentation, |
| Publication Year : | 2012 |
| Degree: | 碩士 |
| Abstract: | Android作業系統近年來在智慧型手機及平板電腦上大放異彩,使用者開發的應用程式數量也愈來愈多。開發者可以選擇單純使用 Java語言,或額外選用與機器相關的原生語言,例如C/C++,透過NDK開發套件,與前者在程式運行時互相合作。由於原生語言與機器高度相關,因此在開發者本機端就必須先決定好要運行在哪一種裝置上,並且將產生出來的動態連結庫放入APK裡面。此作法不只限制了可以運行的裝置種類,也讓開發流程變得有不可移植性。
在本篇論文中,我們透過LLVM這個編譯器基礎設施的中間表示式,位元碼 (bitcode),作為一種可移植的發布格式。在開發者本機端,我們透過工具將原生語言轉換為 bitcode,包進APK裡面,待下載到裝置後,利用LLVM的元件編譯連結成原生的動態連結庫,這個動作是在運行之前做完的,不影響執行時的效率。目前已經將NDK現有的範例程式,例如Hello-jni、Bitmap-plasma、Native-plasma 等,以及其他較複雜龐大的範例,例如 Quake、Quake 2、Quake 3等第三方的程式,成功運行在現有Android裝置上不同的平台,例如X86、ARM上面。藉由這個實驗,我們對於傳統的編譯流程有了創新,並且也讓Android因為NDK編譯機制而造成的碎片化問題得到了解決。 Android operating system is more popular on mobile phones and tablets in these years. Correspondingly, developer’s applications are more and more. Developers can choose Java language, or native language, like C/C++, which can be embedded into Android packge (APK) by NDK, cooperating with the former. Since native language is highly machine-dependent, developers need to decide which targets they want to ship, and put the compiled DSO into APK. This approach limits the number of kinds of devices, and makes the development process not portable. In this paper, we exploit the intermediate representation of LLVM infrastructure, bitcode, as a portable public format. On the host side, we compile native language source codes to a LLVM bitcode and put it into APK. On the target side, we use LLVM components to compile the bitcode into a DSO, which is done before runtime without affecting runtime performance. Currently we have successfully run the existing samples of NDK, like Hello-jni, Bitmap-plasma, and other third-party samples, like Quake, Quake 2, Quake 3, on the existing various Android platforms, like X86 and ARM. Through this experiment, we innovate on the traditional compilation flow, and solve the fragmentation problem caused by NDK compilation mechanism on Android. |
| URI: | http://tdr.lib.ntu.edu.tw/jspui/handle/123456789/6851 |
| Fulltext Rights: | 同意授權(全球公開) |
| Appears in Collections: | 資訊工程學系 |
Files in This Item:
| File | Size | Format | |
|---|---|---|---|
| ntu-101-1.pdf | 569.01 kB | Adobe PDF | View/Open |
Items in DSpace are protected by copyright, with all rights reserved, unless otherwise indicated.
