标题: | 以控制样式分析物件导向程式之行为 Object-Oriented Program Behavior Analysis Based on Control Patterns |
作者: | 黄中见 CHUNG-CHIEN HWANG 陈登吉 Deng-Jyi Chen 资讯科学与工程研究所 |
关键字: | 物件导向程式;程式码样式;控制样式;测量程式;物件方法呼叫序列;限制输出函数;限制布林函数;控制样式探索工具;object-oriented program;code-patterns;control-pattern;benchmark;method invocation sequence;constraint output function;constraint Boolean function;control pattern mining tool |
公开日期: | 2001 |
摘要: | 物件导向(object-oriented, OO)程式设计已成为软体发展的主流方式。比起传统的程序导向方法,其设计出的程式较具扩充性、易管理及高再利用性,但却面临执行效率不彰与程式动态行为复杂,不易了解动态执行程序等困境。为改善或减轻此困境,进而提供更准确效能测量及提升程式执行效能,程式分析扮演重要的角色。目前程式分析方法如静态及动态分析不足以了解程式执行时的行为样式,同时也未有将行为样式量化的文献或报告。对程式语言而言,程式码样式(code patterns)是静态重复的结构,可在软体设计时加入以解决特定的问题。相对于程式码样式,控制样式(control pattern)是在程式执行时动态产生的重复结构,可应用于设计测量程式(benchmark)及了解程式执行的行为(runtime behavior),并对执行程式最佳化有帮助。 在论文中,我们分析Java程式多种度量方式(metric)与物件方法呼叫序列(method invocation sequence),我们提出以控制样式为基础的动态分析工具(profiler),控制样式包含一个有向图(directed graph)及两个函数,限制输出函数(constraint output function),限制布林函数(constraint Boolean function),可将程式执行的轨迹(run-time trace)以有向图(directed graph)表示,限制输出函数及限制布林函数来说明程式执行真正的路径。藉由此分析,希望能更了解Java程式执行时的行为。首先,我们修改了升阳公司的模拟Java虚拟机器软体(Java virtual machine),藉此得到Java程式动态执行时的资讯。然后设计与实作一个控制样式探索工具(control pattern mining tool)来分析所得到的动态执行资讯。同时,我们收集了18个Java程式做为控制样式分析实验程式。 物件导向程式的执行是藉由讯息呼叫(message invocation)而导致物件的产生与消灭(lifetime),控制样式叙述了物件之间控制权的转移。本论文藉由实验结果说明了控制样式的存在及提供量化分析,控制样式包括复杂的控制样式(complex control pattern)、复合式的控制样式(compound control pattern)和简单的控制样式(simple control pattern)在实验程式中占有不同的比例,且并非所有的程式都拥有这三类控制样式,但大部分的程式也都含有高比例不寻常的控制样式(nontrivial control pattern)。在此研究中,我们特别说明控制样式可应用于物件导向测量程式建构,建议一个以控制样式为基础的物件导向测量程式建构方法,另一方面,控制样式也可以提供给程式设计师设计较有效率的物件导向程式,同时,为了更容易了解,论文中使用许多范例来解释控制样式的应用方法。 Object-Oriented (OO) programming has played a major role in program design and implementation due to the fact that it is more extensible, maintainable, and reusable in the software system construction. Experiences of using Object-Oriented programming have indicated that there exist disadvantages with respect to its execution inefficiency and complicated runtime behaviors. Program analysis is essential for performance measurement and improvement. Current static and dynamic analysis using OO programming cannot characterize runtime behavior well and are also hard to quantify the measured results. In this dissertation, research work was performed to analyze several Java program metrics and method invocation sequence. The results not only provide us a better understanding of the runtime behavior but also present more information for different application domains. Code-patterns are statically recurring structure specifically related to a programming language. It can be used in parallel to help designing software systems for solving particular problems. In opposition to code-patterns’ role in assisting compilation, control-patterns are dynamically recurring structures invoked during program execution time. It can be used to understand the run-time behaviors of OO-programs for the underlying architecture such as Java-VM. We have proposed a run-time profiler based on control patterns to show that all run-time trace can be represented by a directed graph, a constrained output function, and a constraint Boolean function. It is known that the progress of program is the lifetime of objects by message invocation. Control pattern describes the model of control transfer among objects in OO program execution. In this research, several control patterns are proposed and discussed. Particularly, we have analyzed and collected several control patterns over several Java program corpora. The experimental results show that control pattern does exist and provide quantitative analysis. Simple pattern, compound pattern and complex pattern have different ratio respectively, according to a variety of different source programs. Not all benchmark programs contain all three kinds of patterns. There are high percentages of programs with nontrivial behaviors. Application of control patterns are addressed in this study specifically since control patterns can be used to design an OO benchmark for understanding the execution behaviors of OO systems. An OO benchmark design methodology is proposed for implementing such application. Also, control pattern can be used to provide guidelines for OO programmers to write more effective OO program. To make it clear, examples are also used to illustrate the applicability of these control patterns. |
URI: | http://140.113.39.130/cdrfb3/record/nctu/#NT900392009 http://hdl.handle.net/11536/68422 |
显示于类别: | Thesis |