簡易檢索 / 詳目顯示

研究生: 吳致穎
Wu, Chih-Ying
論文名稱: Dryad: An Ahead of Time Compiler Optimization Framework for Android
Dryad: 適用於Android平台之提前式編譯優化架構
指導教授: 鍾葉青
Chung, Yeh-Ching
口試委員:
學位類別: 碩士
Master
系所名稱: 電機資訊學院 - 資訊工程學系
Computer Science
論文出版年: 2009
畢業學年度: 97
語文別: 英文
論文頁數: 54
中文關鍵詞: 編譯器提前式編譯器提前式優化技術
外文關鍵詞: Compiler, Ahead of Time Compiler, Ahead of Time Optimization
相關次數: 點閱:2下載:0
分享至:
查詢本校圖書館目錄 查詢臺灣博碩士論文知識加值系統 勘誤回報
  • Recently, embedded systems such as smart phones become popular since the growing of computing power. Google in 2007 launches the Android platform, which has been the modern open development platform. Android supports a complete Java development environment for developers. Different from the general Java environment, the Dalvik virtual machine (DVM) established by Google is used to interpret Android applications. Dex is the RISC-based intermediate representation (IR) adopted in DVM, which is designed to enhance the efficiency of the interpreting time. Nevertheless, Dalvik VM, as a general VM, can not avoid the problem that the interpreter constantly repeats some specific hot spot sections, which will degrade the performance and waste the computing power.
    In this thesis, we propose the Dryad framework, which is an ahead of time (AOTC) compiler framework for Android. The Dryad framework mainly analyzes and optimizes the input Dex code. With the profiling result, it finds out the hot spot codes and converts to native machine codes. We can speed up the program by avoiding redundant interpretations. We use indirect binary translation technique to perform hot spot codes translations, which translates the Dex code into C code at first and then compile it using the existing compiler to gain the further optimizations. The series of the design and optimization issues is mentioned the recovery problems. In the experiment results, for benchmark Embedded CaffeineMark 3.0, the speedup score of synthetic benchmark is up to 140X comparing to the original Android platform.


    近年來,隨著嵌入式系統運算能力的成長,智慧型手機的市場漸漸受到消費者青睞。Google於2007年推出Android平台,已成為近代極具有市場潛力與商業價值的開放式開發平台。Android平台使用JAVA語言,不同於傳統JAVA使用JVM,Android採用他們自行設計的Dalvik VM來進行軟體開發。Dalvik VM採用一種類似RISC架構語法的中介碼Dex來提升VM直譯時期的效率。儘管如此,Dalvik VM還是無法避免不斷直譯重複熱門程式片斷所造成的效能浪費問題。
    在本篇論文中,我們展示一種針對Android平台所設計的提前式編譯優化架構Dryad。一種在主機端預先針對模擬器所偵測得到熱門片段資訊,把關鍵性的Dex程式碼預先編譯以及優化成目標裝置機械碼,讓Dalvik VM在執行時期運行熱門片段時可以直接調用我們預先編譯的機械碼,來減少不斷直譯相同程式片段所造成的資源浪費以達到效能提升的功能。本篇論文參考間接式二進位轉換原理設計了一種Dex-to-C轉換機制,先把一種關鍵性的Dex程式轉換成高階語言C,其中提出針對低階語言轉換高階語言所遇到的資料還原問題、架構還原問題以及資料型態還原問題提出探討。在最後實驗結果,我們可以看到使用Dryad架構針對Embedded CaffeineMark以及一些常見的運算進行測試。結果證實在综合性效能評比項目中,我們獲得140x的效能分數提昇。

    Chapter 1. Introduction 1 Chapter 2. Preliminaries 6 2.1 Overview Generating Dex file 6 2.2 Execution Overview 8 Chapter 3. Design and Optimization 11 3.1 The structure of Dryad AOT Compiler 12 3.2 Disassembler phase 15 3.3 Ideal Analysis phase 15 3.3.1 The analysis step 16 3.3.2 The organization step 17 3.3.3 The annotation step 17 3.4 Dex-to-C phase 18 3.4.1 The COINS infrastructure 18 3.4.2 The Dex parser 19 3.4.3 Data Recovery problems 22 3.4.3.1 The data layout problem 23 3.4.3.2 The naming problem 25 3.4.3.3 The correction of variable 26 3.5 Optimization phase 26 3.5.1 Code layout optimization 27 3.5.1.1 Control flow reconstruction 28 3.5.1.2 Code pattern matchers 30 3.5.2 Live-range based optimization 33 3.5.2.1 Parameter propagation optimization 33 3.5.2.2 Reference pool optimization 34 3.5.2.3 Array optimization 35 3.5.2.4 Local native optimization 37 3.6 Cross compiler phase 38 3.7 Bridge library phase 38 3.7.1 The solution of bridge libraries 38 3.7.2 The solution of lightweight native libraries 39 Chapter 4. Experiment 41 4.1 Environment 41 4.2 Benchmark 41 4.3 The Simulation Results 43 Chapter 5. Conclusion 49 Chapter 6. References 51

    [1] "Open Handset Alliance," http://www.openhandsetalliance.com/index.html.
    [2] Google. "Android - An Open Handset Alliance Project," http://code.google.com/android/index.html
    [3] Google. "Android Developer's Guide," http://developer.android.com/guide/index.html.
    [4] D. Bornstein. "Dalvik VM Internals," http://sites.google.com/site/io/dalvik-vm-internals.
    [5] Google. "Dalvik Virtual Machine insights," http://www.dalvikvm.com/.
    [6] S. Micro. "The Java Language Specification," http://java.sun.com/docs/books/jls/.
    [7] Microsoft. "Microsoft .NET Framework 3.5 Administrator Deployment Guide," http://msdn.microsoft.com/library/cc160717.aspx.
    [8] L. Batyuk, A.-D. Schmidt, H.-G. Schmidt et al., "Developing and Benchmarking Native Linux Applications on Android," MobileWireless Middleware, Operating Systems, and Applications, pp. 381-392, 2009.
    [9] J. Aycock, “A brief history of just-in-time,” ACM Comput. Surv., vol. 35, no. 2, pp. 97-113, 2003.
    [10] T. Suganuma, T. Yasue, M. Kawahito et al., “Design and evaluation of dynamic optimizations for a Java just-in-time compiler,” ACM Trans. Program. Lang. Syst., vol. 27, no. 4, pp. 732-785, 2005.
    [11] T. Proebsting, G. Townsend, P. Bridges et al., “Toba: Java for applications: A way ahead of time (WAT) compiler,” in Proceedings of the 3rd Conference on Object-Oriented Technologies and Systems, Portland, Oregon, 1997, pp. 41-53.
    [12] M. Weiss, F. de Ferrière, B. Delsart et al., "TurboJ, a Java bytecode-to-native compiler," Languages, Compilers, and Tools for Embedded Systems, pp. 119-130, 1998.
    [13] G. Muller, and U. Schultz, “Harissa: A hybrid approach to Java execution,” IEEE software, vol. 16, no. 2, pp. 44-51, 1999.
    [14] A. Varma, “A retargetable optimizing Java-to-C compiler for embedded systems,” University of Maryland, 2003.
    [15] A. Varma, and S. S. Bhattacharyya, “Java-through-C compilation: an enabling technology for Java in embedded systems,” in Design, Automation and Test in Europe Conference and Exhibition, 2004. Proceedings, 2004, pp. 161-166 Vol.3.
    [16] S. Hong, J.-C. Kim, J. W. Shin et al., “Java client ahead-of-time compiler for embedded systems,” in Proceedings of the 2007 ACM SIGPLAN/SIGBED conference on Languages, compilers, and tools for embedded systems, San Diego, California, USA, 2007.
    [17] J. Dong-Heon, M. Soo-Mook, and B. Sung-Hwan, “Design and Optimization of a Java Ahead-of-Time Compiler for Embedded Systems,” in Embedded and Ubiquitous Computing, 2008. EUC '08. IEEE/IFIP International Conference on, 2008, pp. 169-175.
    [18] S. Hong, J.-C. Kim, S.-M. Moon et al., “Client ahead-of-time compiler for embedded Java platforms,” Softw. Pract. Exper., vol. 39, no. 3, pp. 259-278, 2009.
    [19] S. Hammond, and D. Lacey, "Loop Transformations in the Ahead-of-Time Optimization of Java Bytecode," Compiler Construction, pp. 109-123, 2006.
    [20] GNU. "The GNU Compiler for the JavaTM Programming Language," http://gcc.gnu.org/java/.
    [21] GNU. "GCC, the GNU Compiler Collection."
    [22] COINS. "COINS Compiler Infrastructure," http://www.coins-project.org/international/.
    [23] M. Sassa, T. Nakaya, M. Kohama et al., “Static single assignment form in the COINS compiler infrastructure,” Proc. SSGRR 2003w, 2003.
    [24] Cetus. "Cetus-A Source-to-Source Compiler Infrastructure for C Programs," http://cetus.ecn.purdue.edu/.
    [25] S.-I. Lee, T. A. Johnson, and R. Eigenmann, "Cetus – An Extensible Compiler Infrastructure for Source-to-Source Transformation," Languages and Compilers for Parallel Computing, pp. 539-553, 2004.
    [26] C. Cifuentes, D. Simon, and A. Fraboulet, “Assembly to high-level language translation,” in Software Maintenance, 1998. Proceedings. International Conference on, 1998, pp. 228-237.
    [27] C. Cifuentes, M. V. Emmerik, and N. Ramsey. "UQBT - A Resourceable and Retargetable Binary Translator," http://www.itee.uq.edu.au/~cristina/uqbt.html.
    [28] C. Cifuentes, and M. Van Emmerik, “UQBT: adaptable binary translation at low cost,” Computer, vol. 33, no. 3, pp. 60-66, 2000.
    [29] M. Angelone, V. Prevelakis, C. o. Arts et al., Approaches for Universal Static Binary Translation: Drexel University, 2006.
    [30] T. Lin, DisIRer: A Binary Translation Platform with GCC: National Chung-Cheng University, 2006.
    [31] Android. "Traceview: A Graphical Log Viewer," http://developer.android.com/guide/developing/tools/traceview.html.
    [32] B. Gruver. "smali, an assembler/disassembler for Android's dex format "; http://code.google.com/p/smali/.
    [33] Jasmin. "an assembler for the Java Virtual Machine," http://jasmin.sourceforge.net/.
    [34] S. Liang, The Java Native Interface: Programmer's Guide and Specification: Addison-Wesley Professional, 1999.
    [35] LINFO. "Pipes: A Brief Introduction by The Linux Information Project," http://www.linfo.org/pipe.html.
    [36] G. Paller. "Dedexer, a disassembler tool for DEX files," http://dedexer.sourceforge.net/.
    [37] A. T. Schreiner. "jay, a LALR(1) parser generator for Java," http://www.informatik.uni-osnabrueck.de/alumni/bernd/jay/.
    [38] L. Ramshaw, “Eliminating go to's while preserving program structure,” J. ACM, vol. 35, no. 4, pp. 893-920, 1988.
    [39] C. Cifuentes, “A structuring algorithm for decompilation,” in Proceedings of the XIX Conferencia Latinoamericana de Informatica, 1993, pp. 267–276.
    [40] C. Cifuentes, and K. Gough, “Decompilation of binary programs,” Software: Practice and Experience, vol. 25, no. 7, pp. 811–829, 1995.
    [41] T. A. Proebsting, and S. A. Watterson, “Krakatoa: decompilation in java (dose bytecode reveal source?),” in Proceedings of the 3rd conference on USENIX Conference on Object-Oriented Technologies (COOTS) - Volume 3, Portland, Oregon, 1997.
    [42] J. Miecznikowski, and L. Hendren, “Decompiling Java using staged encapsulation,” in Reverse Engineering, 2001. Proceedings. Eighth Working Conference on, 2001, pp. 368-374.
    [43] J. Miecznikowski, and L. Hendren, "Decompiling Java Bytecode: Problems, Traps and Pitfalls," Compiler Construction, pp. 153-184, 2002.
    [44] N. A. Naeem, and L. Hendren, “Programmer-friendly Decompiled Java,” in Program Comprehension, 2006. ICPC 2006. 14th IEEE International Conference on, 2006, pp. 327-336.
    [45] A. Aho, R. Sethi, and J. Ullman, “Compilers: principles, techniques, and tools,” Reading, MA, 1986.
    [46] H. Bae, and R. Eigenmann, "Performance Analysis of Symbolic Analysis Techniques for Parallelizing Compilers," Languages and Compilers for Parallel Computing, pp. 280-294, 2005.
    [47] M. Ziccardi. "FCCL, Free C++ Class Library," http://sourceforge.net/projects/fccl/.
    [48] P. S. Corporation. "Embedded CaffeineMark 3.0," http://www.benchmarkhq.ru/cm30/info.html.

    無法下載圖示 全文公開日期 本全文未授權公開 (校內網路)
    全文公開日期 本全文未授權公開 (校外網路)

    QR CODE