期刊文献+

一种在静态类型面向对象语言中构造VFCG的方法 被引量:1

AN APPROACH FOR CONSTRUCTING VFCG IN STATICALLY-TYPED OBJECT-ORIENTED LANGUAGE
下载PDF
导出
摘要 阐述了在静态类型面向对象语言中构造虚函数调用图 (VFCG)的方法 :先构造可见方法类层次图 (VM CHG) ,再计算继承集、改写集 ,确定改写边界 ,最后利用VM CHG和改写边界构造VFCG . A major advantage of object oriented languages is abstraction. The most important language feature that supports abstraction is the dynamic dispatch of methods based on the run time type of an object. In dynamically typed language like Smalltalk and SELF, all dispatches are considered dynamic, and eliminating these dynamic dispatches that has been essential to obtain high performance. In statically typed language, such as C++ , virtual function call is a both important and complicated problem, and programmers must explicitly request dynamic dispatch by declaring a method to be virtual. Virtual functions make code easier for programmers to reuse. But virtual function call makes it harder to analyze or understand C++ programs. We think there are at least 3 reasons: first, C++ programs suffer less of an initial performance penalty, at the cost of reduced flexibility and increased programmer effort in the presence of virtual function call. Second, if every potential target of a virtual function call is included in the call graph, the user will face with a vastly larger space of object types and functions that must be comprehended to understand the meaning of the program as a whole. Third, because of the existence of inheritance relationship (especially multiple inheritance relationship), all classes in a program form a complicated class hierarchy structure. We represent such structure with class hierarchy graph (CHG). Methods defined in some class can be either visible or invisible in its corresponding class node in CHG. We use visible method class hierarchy graph (VM CHG) to represent such CHG. Some child classes inherit their parent class' method; others override their parent class' method. We use inherit set to represent the set of classes that inherit their parent class' method, and override set to represent the set of classes that override their parent class' method. If some class has many base (or parent) classes and these base classes have only one super base class, it is hard to determine the inherited method by the derived class belongs to which base class or which version of super base class. In this paper, we present an approach for constructing VFCG in statically typed object oriented language so as to understand virtual function call easily. First,VM CHG is constructed to represent class hierarchy relationship between objects where method defined or inherited is visible. Then, inherit set (which represents the union of the set of classes that inherit a particular class' method m and the particular class that defines the method m) and override set(representing the set of classes that override a particular class' method)are computed, and override frontier is also determined by having computed inherit set and override set. Finally, VFCG is constructed with VM CHG and override frontier. On the other hand, we present all algorithms for constructing VM CHG, computing inherit set and override set, determining override frontier, and creating VFCG. Meantime, we discuss the importance of VFCG in resolving static object oriented virtual function call.
出处 《南京大学学报(自然科学版)》 CAS CSCD 2000年第2期163-170,共8页 Journal of Nanjing University(Natural Science)
基金 江苏省应用基础基金!(No :BJ970 36 )资助项目
关键词 继承集 改写集 VFCG 静态类型面向对象语言 VM CHG inherit set override set override frontier VFCG
  • 相关文献

参考文献8

  • 1[1]Srinivasan H, Sweeney P F. Evaluating virtual dispatch mechanisms for C + +[C]. Tech Rep RC-20330, IBM Thomas J Watson Research Center, 1996.
  • 2[2]Porat S, Berrustein D, Fedorov Y, et al. Compiler optimizarions of C+ + virtual function cans [C]. In:Proceeding of the Second Conference on Object-Oriented Technologies and System. Usenix Assocation,1996.3.
  • 3[3]Driesen K, Holzle U.The direct cost of virtual function calls in C+ + [C]. In: Proceeding of the1996 ACM Conference on Object-Oriented Programming Systems, Language, and Application. SIGPLANNot, 31,10,306.
  • 4[4]Dean J, Grove D, Chambers C.Optimization of object-oriented prograns using static class hierachy analysis[C]. In: Olthff W ed. Proceeding of the Ninth European Conferenee on Object-oriented Programming?ECOOP' 95, Volume 952 of Lecture Notes in Computer Science. Berlin: Springer-Verlag, 1995.77.
  • 5[5]David F B. Fast and effective optimization of statically typed object-oriented language[D]. Ph. D thesis,University of California at Berkley, 1997.17.
  • 6[6]Pande H D, Ryder B G. Staric type determination for C+ + [D]. In: Proceeding of the 1994 USENIX+ + Conference. Usenix Association, Berkeley, 1994.85.
  • 7[7]David F B. Rapid type inference for C+ + programs[C]. Technical report, IBM T.J. Watson Research Center, 1995.
  • 8[8]Paul R C, Michael H, Harini S. Flow-sensitive type analys is for C+ + [C]. IBM Research Report,1995.

同被引文献1

  • 1Marry Jean Harrold,Proc 20th Int Conf Software Engineering(ICSE 20),1998年,19页

引证文献1

二级引证文献15

相关作者

内容加载中请稍等...

相关机构

内容加载中请稍等...

相关主题

内容加载中请稍等...

浏览历史

内容加载中请稍等...
;
使用帮助 返回顶部