ISSN 1673-9418 CODEN JKYTA8 E-mail: fcst@vip.163.com Journal of Frontiers of Computer Science and Technology http://www.ceaj.org 1673-9418/2011/05(03)-0229-09 Tel: +86-10-51616056 DOI: 10.3778/j.issn.1673-9418.2011.03.004 * 张广泉 1,2+, 黄静 1, 章晓芳 1,3, 刘长林 1. 苏州大学计算机科学与技术学院, 江苏苏州 215006 2. 中国科学院软件研究所计算机科学国家重点实验室, 北京 100190 3. 南京大学计算机软件新技术国家重点实验室, 南京 210093 1 Slicing of Aspect-Oriented Programs Based on Reduced Dynamic Dependence Graph * ZHANG Guangquan 1,2+, HUANG Jing 1, ZHANG Xiaofang 1,3, LIU Changlin 1 1. School of Computer Science and Technology, Soochow University, Suzhou, Jiangsu 215006, China 2. State Key Laboratory of Computer Science, Institute of Software, Chinese Academy of Sciences, Beijing 100190, China 3. State Key Laboratory for Novel Software Technology, Nanjing University, Nanjing 210093, China + Corresponding author: E-mail: gqzhang@suda.edu.cn ZHANG Guangquan, HUANG Jing, ZHANG Xiaofang, et al. Slicing of aspect-oriented programs based on reduced dynamic dependence graph. Journal of Frontiers of Computer Science and Technology, 2011, 5(3): 229-237. Abstract: Program slicing is an important technique for program analysis, which has many applications in various fields such as program debugging, testing, maintenance, etc. Aspect-oriented program is a new software development paradigm that enables modular implementation of cross-cutting concerns, and poses difficulties for slicing of aspect-oriented programs. From the two types: static slicing and dynamic slicing, a systematic analysis of the researches on slicing of aspect-oriented programs is conducted, and a dynamic slicing method of aspect-oriented programs based on reduced dynamic dependence graph is proposed, which can reduce the number of nodes and edges of dynamic dependence graph. The generated dynamic slice is accurate that helps people to better understand *The National Natural Science Foundation of China under Grant No. 60973149 ( ); the Open Funds of State Key Laboratory of Computer Science of Chinese Academy of Sciences under Grant No. SYSKF0908 ( ); the Natural Science Foundation of Jiangsu Higher Education Institutions of China under Grant No. 08KJB520010, 09KJB520012 ( ). Received 2010-07, Accepted 2010-09.
230 Journal of Frontiers of Computer Science and Technology 2011, 5(3) aspect-oriented programs. Key words: aspect-oriented program; static slicing; dynamic slicing; reduced dynamic dependence graph 程序切片是一种重要的程序分析技术, 广泛应用于程序的调试 测试与维护等领域 面向方面程序设计作为一种新的软件开发范型, 能够实现横切关注点的模块化, 其特有的语言元素和功能为切片增加了难度 从静态切片和动态切片两种类型, 讨论了面向方面程序切片技术 在此基础上, 提出了一种基于简化动态依赖图的面向方面程序切片方法, 可以减少动态依赖图中节点和边的数量, 生成准确的面向方面程序的动态切片, 从而有助于人们更好地对面向方面程序进行分析和理解 面向方面程序 ; 静态切片 ; 动态切片 ; 简化动态依赖图 A TP311 1 (program slicing) [1], Weiser 1979 [2],,,, (slicing criterion), <s, v>, s, v s,, <s, v>,,,,,,,,,,, : 2 ; 3, ; 4 ; 5 ; 2,,, Kiczales 1997 (aspect-oriented programming, AOP) [3] AOP,,,, (aspect),,,,,, AOP (core concerns) (cross-cutting concerns),
231,, AOP,, ( Java ), ( AspectJ, Java ), 1 AOP Fig.1 The process of AOP 1 AOP, AOP (1) (join point):,, AOP, (2) (pointcut): AOP,, (3) (advice):, (4) (aspect):, (object-oriented programming, OOP), (5) (introduction):, (6) (weaving):, 3, Zhao 2002 [4],,,, 3.1,, <s, v>, s, v s Weiser Zhao, [5 7], Horwitz [8], [9] Braak [10] 2006,, 2010, Ahmad, [11],,,,,, ( ) 3.2 <s,v,i 0 >, s, v s, I 0,,,,,,
232 Journal of Frontiers of Computer Science and Technology 2011, 5(3) Sahu Mohapatra [12] 2007, Zhao,,,, Mohapatra [13] 2008,,,, ( ),, 2, (a) Java, ; (b) AspectJ,, 2, args[0]=4, <1, 2, 3, 13, 14, 15, 4, 5, 6, 7 1, 8 1, 9 1, 7 2, 8 2, 9 2, 7 3, 8 3, 9 3, 7 4, 8 4, 9 4, 7 5, 16, 17, 11>,, 7 1 7, 7 2 7 2, 8 1 8 1, 3 7 while 4 <11, p, 4> ( args[0]=4, 11 p ), 11, ( ), {11, 17, 8, 16, 7, 8, 9, 7, 13, 5, 9, 7, 8, 9, 3, 2, 4, 7, 8, 9, 1, 15, 7, 6, 14},, {11, 17, 8, 16, 7, 9, 13, 5, 3, 2, 4, 1, 15, 6, 14}, 3,, Fig.2 An example of aspect-oriented program 2
233 Fig.3 Dynamic dependence graph for the aspect-oriented program 3,, ( ), 4,,, 4.1,, (reduced dynamic dependence graph),,, DefnNode PredNode, DefnNode, ; PredNode, ReachableNodes, S i,, ( v) S i, S i v, S i ReachableNodes v ReachableNodes, S i v,, S i ;, S i, S i DefnNode,,, PredNode, 2, args[0]=4, <1, 2, 3, 13, 14, 15, 4, 5, 6, 7 1, 8 1, 9 1, 7 2, 8 2, 9 2, 7 3, 8 3, 9 3, 7 4, 8 4, 9 4, 7 5, 16, 17, 11> 4
234 Journal of Frontiers of Computer Science and Technology 2011, 5(3) Fig.4 Reduced dynamic dependence graph for the aspect-oriented program 4, 4 3, 4 7, 3 7 5 4, 7 2 3 4 5 9, 7 2 3 4 5 ReachableNodes {1, 2, 4, 5, 7, 9, 14, 15} 9 ReachableNodes {1, 2, 4, 5, 7, 9, 14, 15} ; 8 3 4 2, 8 3 4 ReachableNodes {1, 2, 4, 5, 6, 7, 8, 9, 14, 15} 8 2 ReachableNodes {1, 2, 4, 5, 6, 7, 8, 9, 14, 15} ;, 9 2 3 4 9 1 4 while, 3, 4 1 ReachableNodes 4.2, v v DefnNode, ReachableNodes, v, Table 1 ReachableNodes set tied to each node in Fig.4 1 4 ReachableNodes ReachableNodes 1 {1} 2 {1, 2} 3 {1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 13, 14, 15, 16, 17} 13 {1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 13, 14, 15, 16, 17} 14 {14} 15 {14, 15} 4 {1, 2, 4, 14, 15} 5 {1, 2, 4, 5, 14, 15} 6 {1, 2, 4, 5, 6, 14, 15} 7 {1, 2, 4, 5, 7, 14, 15} 8 1 {1, 2, 4, 5, 6, 7, 8, 14, 15} 9,7 {1, 2, 4, 5, 7, 9, 14, 15} 8 2 {1, 2, 4, 5, 6, 7, 8, 9, 14, 15} 16 {1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 13, 14, 15, 16, 17} 17 {1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 13, 14, 15, 16, 17} 11 {1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 13, 14, 15, 16, 17}, 4 p, 11 ReachableNodes {1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 13, 14, 15, 16, 17}, 11 p, 1 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 13, 14, 15, 16, 17 Mohapatra [13] 2 p, 11 3 {11, 17, 8, 16,
235 7, 8, 9, 7, 13, 5, 9, 7, 8, 9, 9, 3, 2, 4, 7, 8, 9, 1, 15, 7, 6, 14},, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 13, 14, 15, 16, 17,,, 5,, Weiser [2], Ottenstein [14], Horwitz [8],,, Larsen Harrold [15], Zhao [16],, Zhao [4 5],, [9] Braak [10], Ahmad [11],,,,,,,,,, Korel Laski [17], Weiser, Agrawal [18] 4,, Sahu Mohapatra [12], Zhao,,,,,,,,,,,, ReachableNode, Mohapatra [13],,,,,,,,,,,, 6,,
236 Journal of Frontiers of Computer Science and Technology 2011, 5(3),,,,, ReachableNodes,,, References: [1] Li Bixin. Program slicing technique and its applications[m]. Beijing: Science Press, 2006. [2] Weiser M. Program slicing[j]. IEEE Transactions on Software Engineering, 1984, 10(4): 352 357. [3] Kiczales G, Lamping J, Mendhekar A, et al. Aspectoriented programming[c]//lecture Notes in Computer Science 1241: Proceedings of the 11th European Conference on Object-Oriented Programming, 1997: 220 242. [4] Zhao J. Slicing aspect-oriented software[c]//proceedings of the 10th IEEE International Workshop on Program Comprehension, 2002: 251 260. [5] Zhao J, Rinard M. System dependence graph construction for aspect-oriented programs, MIT-LCS-TR-891[R]. Laboratory for Computer Science, MIT, 2003. [6] Zhao J. Data-flow-based unit testing of aspect-oriented programs[c]//proceedings of the 27th Annual IEEE International Conference on Computer Software and Applications, 2003: 188 197. [7] Zhao J. Control-flow analysis and representation of aspectoriented programs[c]//proceedings of the 6th International Conference on Quality Software, 2006: 38 48. [8] Horwitz S, Reps T, Binkley D. Inter-procedural slicing using dependence graphs[j]. ACM Transactions on Programming Languages and Systems, 1990, 12(1): 26 60. [9] Shi Liang. Research on test data automatic generation[d]. Nanjing: Southeast University, 2006. [10] Braak T T. Extending program slicing in aspect-oriented programming with inter-type declarations[c]//proceedings of the 5th Twente Student Conference on IT, 2006. [11] Ahmad S, Ghani A, Sani F, et al. Slicing aspect oriented program using dependence flow graph for maintenance purpose[c]//proceedings of Regional Conference on Knowledge Integration in ICT, 2010: 236 241. [12] Sahu M, Mohapatra D P. A node marking technique for dynamic slicing of aspect-oriented programs[c]//proceedings of the 10th International Conference on Information Technology, 2007: 155 160. [13] Mohapatra D P, Sahu M, Kumar R, et al. Dynamic slicing of aspect-oriented programs[j]. Informatica, 2008, 32(3): 261 274. [14] Ottenstein K J, Ottenstein L M. The program dependence graph in a software development environment[j]. ACM SIGPLAN Notices, 1984, 19(5): 177 184. [15] Larsen L D, Harrold M J. Slicing object-oriented software[c]//proceedings of the 18th International Conference on Software Engineering, 1996: 495 505. [16] Zhao J. Dynamic slicing of object-oriented program, SE-98-119[R]. Information Processing Society of Japan, 1998. [17] Korel B, Laski J. Dynamic program slicing[j]. Information Processing Letters, 1988, 29(3): 155 163. [18] Agrawal H, Horgan J R. Dynamic program slicing[c]//proceedings of the ACM SIGPLAN 1990 Conference on Programming Languages Design and Implementation, 1990, 25(6): 246 256. 附中文参考文献 : [1]. [M]. :, 2006. [9]. [D]. :, 2006.
237 ZHANG Guangquan was born in 1965. He received his Ph.D. degree in Computer Software and Theory from Chongqing University in 1999. Now he is a professor at Soochow University, and the senior member of CCF. His research interests include software architecture, aspect-oriented technology, formal methods and program analysis, etc. (1965 ),,, 1999,, CCF,,, HUANG Jing was born in 1988. She is a master candidate at Soochow University. Her research interests include software testing and aspect-oriented software development, etc. (1988 ),,,,, ZHANG Xiaofang was born in 1980. She received her Ph.D. degree in Computer Software and Theory from Southeast University in 2008. Now she is a lecturer at Soochow University. Her research interests include program analysis and software testing, etc. (1980 ),,, 2008,,, LIU Changlin was born in 1985. He is a master candidate at Soochow University. His research interests include software architecture and aspect-oriented software development, etc. (1985 ),,,,,