中国科学院软件研究所机构知识库
Advanced  
ISCAS OpenIR  > 中科院软件所  > 中科院软件所
题名:
Java编译技术的研究与实现
作者: 冀振燕
答辩日期: 1999
专业: 计算机软件与理论
授予单位: 中国科学院软件研究所
授予地点: 中国科学院软件研究所
学位: 博士
关键词: Java语言 ; 编译器 ; 优化 ; 中文化 ; 国际化
摘要: Java语言具有很多优点,这些优点使得Java语言得到了迅速地发展。但是由字节码的解释执行所带来的Java语言的低性能大大制约了Java语言的发展。为了改善Java语言的性能,Java编译及其优化技术已成为当今的一个研究热点。本论文主要研究了Java源代码到Java字节码的编译技术,以及独立于目标机的优化技术。本论文的主要工作如下:1.深入分析了各种Java编译系统,并对Java编译系统进行了分类,指出了它们的优缺点,进行了一些比较,为实现基于我国国产系统平台COSA/COSIX上的Java编译系统提供了很好的借鉴。2.给出了编译器的总体设计和中间表示设计。采用前、后端结构,使编译器可与不同的前端、后端结合构成不同的编译器,从而具有很好的可扩展性和可重用性。采用四遍扫描,将中间代码优化与语义分析分开,使优化模块具有很好的可重用性。采用基于抽象语法树的中间表示,在中间表示IRtree的设计中,采用面向对象的设计方式,给编译器的实现带来了很好的模块性和可扩展性。面向对象程序设计的多态性也给编译器的实现带来了很大的方便。3.给出了目标代码生成的形式描述,有利于编译器的设计与实现。4.给出了编译器各模块的实现方案。采用Java语言实现编译器,使编译器具有跨平台性。5.根据标识符在类文件常数池中的存储特点,提出了域名(field name)的优化算法,用简单的域名来代替复杂的域名,从而达到了减小存储空间的目的。根据tableswitch和lookupswitch指令的特点,提出了翻译switch语句时,如何选用指令的算法,从而达到了时间与空间的综合和优化。根据类文件中字节码的特点,设计了对goto、if , if_acmp、 if_icmp、ldc、 ldc_w、ldc2_w指令的优化。本编译器还采用了常数传播、常数折合、无用变量删除、无用代码删除的优化算法。这些优化不仅能减少类文件的存储空间,而且提高了程序的执行速度。6.总结了传统的本地化(中文化)实现方法,指出了本地化的缺点。深入分析了Java语言的内部编码和JDK对国际化的支持,指出了JDK的国际化中存在的问题。针对含有本地字符的类名的支持问题,提出了在加载类时采用对类名进行字符编码转换的解决方案;针对兼容性问题,提出了采用根据字符编码特点来选用不同编码转换机制的解决方案。设计并实现了支持国际化的编码器,采用字符编码转换的方案,使多语种字符、字符串的操作达到了和英文字符、字符串完全一致的目标,并节省了类文件的存储空间,也使程序具有有条件的字符集无关性,一定程度上解决了“万码奔腾”的问题。采用编译信息同与语境无关的程序代码分离的方案解决了提示信息的国际化问题。提出了含有本地字符的程序的真正跨平台问题的解决方案;采用小字库。最后,总结了全文,并给出了进一步工作。
英文摘要: Java programming language has a lot of advantages, which make Java expand quickly. But Java's performance problems caused by interpreting bytecodes restrict the application of Java language. To improve the performance of Java applications' execution, Java compiler technology and optimization technology have become researched hot spots. The compiler technology that compile Java source codes to bytecodes and the optimization technology independent of target machines are researched in the dissertation. The following is the main research work. 1. The dissertation analyses all kinds of Java compiler systems, sorts them into five categories, and points out the advantages and disadvantages of the systems, compares them, and provides reference for the implementation of the Java compiler system on COSA/COSIX. 2. The dissertation describes the design of our compiler and the intermediate representations of the compiler. The compiler is separated into a front end and a back end. With the front and back end structure, the compiler can be combined with different front ends or back ends to construct different compilers, and the compiler has good extensibility and reusability. The compiler is four passes. The optimization of the intermediate representations is separated from the semantic analysis. The optimization module has a good reusability. The compiler adopted the intermediate representations based on abstract syntax trees. T he implementation of intermediate representation IRtree adopts object-oriented design. With the design, the compiler has good modularity and extensibility. Polymorphism of object-oriented programming facilitates the compiler's implementation. 3. The dissertation uses the formal description to describe the generation scheme of bytecodes, and makes for the design and implementation of Java compilers. 4. The dissertation gives the implementation scheme of the modules of the compiler. The compiler has been implemented in Java, and the compiler is independent of platforms. 5. The dissertation advances an optimization algorithm about field names based on identifiers' storage characteristic. To save the storage space, simple field names are used to substitute complicated field names. The dissertation advances an optimization algorithm about choosing the instruction during translating switch statements based on tableswitch instruction's and lookupswitch instruction's characteristic. The optimization saves the storage space and applications' execution time. Based on bytecodes' characteristic, the dissertation designs the optimization about goto, if , if_acmp, if_icmp, ldc, ldc_w, and ldc2_w. Additionally, the compiler adopts constant propagation, constant folding, unnecessary variable elimination, and dead code elimination to optimize applications. The forenamed, optimizations not only save class files' storage space, but also improve applications' executing speed. 6. The dissertation summarizes the implementation of localization, and points out the disadvantages of localization. The dissertation analyzes Java's internal encoding and JDK internationalization profoundly, and points out the problems of JDK internationalization. To solve the problem of JVM supporting class names including local characters, the characters' encoding transformation should be performed during loading a class file. To solve compatibility problem, the different encoding transformation scheme should be chosen according to the character's encoding characteristic. The compiler supporting internationalization is designed and implemented. With the character encoding transformation scheme, international characters and strings have the same operations as the English characters and strings, the storage spaces of class files are saved, and the applications have conditional encoding-independence and the problem of many Chinese character sets is solved to some extent. Separating compiler messages from codes independent of locale context supports the implementation of international information. To implement the real platform-independence of applications including local characters, small font libraries are adopted. At the end of the dissertation, the dissertation is summarized and future work is put forward.
语种: 中文
内容类型: 学位论文
URI标识: http://ir.iscas.ac.cn/handle/311060/6032
Appears in Collections:中科院软件所

Files in This Item:
File Name/ File Size Content Type Version Access License
LW002846.pdf(1756KB)----限制开放-- 联系获取全文

Recommended Citation:
冀振燕. Java编译技术的研究与实现[D]. 中国科学院软件研究所. 中国科学院软件研究所. 1999-01-01.
Service
Recommend this item
Sava as my favorate item
Show this item's statistics
Export Endnote File
Google Scholar
Similar articles in Google Scholar
[冀振燕]'s Articles
CSDL cross search
Similar articles in CSDL Cross Search
[冀振燕]‘s Articles
Related Copyright Policies
Null
Social Bookmarking
Add to CiteULike Add to Connotea Add to Del.icio.us Add to Digg Add to Reddit
所有评论 (0)
暂无评论
 
评注功能仅针对注册用户开放,请您登录
您对该条目有什么异议,请填写以下表单,管理员会尽快联系您。
内 容:
Email:  *
单位:
验证码:   刷新
您在IR的使用过程中有什么好的想法或者建议可以反馈给我们。
标 题:
 *
内 容:
Email:  *
验证码:   刷新

Items in IR are protected by copyright, with all rights reserved, unless otherwise indicated.

 

 

Valid XHTML 1.0!
Copyright © 2007-2017  中国科学院软件研究所 - Feedback
Powered by CSpace