在线阅读 --自然科学版 2020年3期《面向并发程序的重构一致性检测方法》
面向并发程序的重构一致性检测方法--[在线阅读]
张杨, 孙仕欣, 张冬雯, 东春浩, 乔柳
河北科技大学 信息科学与工程学院, 河北 石家庄 050018
起止页码: 200--208页
DOI: 10.13763/j.cnki.jhebnu.nse.2020.03.003
摘要
针对并发软件重构后可能带来的行为不一致问题,提出了一种重构一致性检测方法,该方法使用控制流分析和数据流分析检测重构前后的变化,使用同步依赖分析检测重构前后同步依赖关系的变化.针对对象重用性、静态共享字段、死锁3种典型的引起并发错误的情况,设计了3种检测算法对重构前后程序的不一致性进行检测.依据该方法,在WALA软件分析框架下实现了一个原型检测工具.在实验中,使用该工具在SPECjbb2005和HSQLDB测试程序上进行了验证,并与Schafer等提出的方法进行比较,实验结果表明,该方法能够有效地发现并发软件重构的不一致行为.

Consistency Detection Method for Concurrent Code Refactoring
ZHANG Yang, SUN Shixin, ZHANG Dongwen, DONG Chunhao, QIAO Liu
School of Information Science and Engineering, Hebei University of Science and Technology, Hebei Shijiazhuang 050018, China
Abstract:
To detect the inconsistent behaviors in concurrent software before and after refactoring,this paper proposes a novel refactoring consistency detection method.It uses control flow analysis and data flow analysis to detect code changes before and after refactoring,and uses synchronization dependency analysis to detect changes of synchronization dependencies.In view of three typical cases of concurrent errors caused by object reusability,static shared fields and deadlock,three kinds of detection algorithms are designed to detect the inconsistency of programs before and after refactoring.A prototype detection tool is implemented in WALA software analysis framework.In the experimentation,two benchmarks SPECjbb2005 and HSQLDB were selected for evaluation,and the results were compared with existing approach proposed by Schafer et al.The experimental results show that our method can effectively find the inconsistent behaviors of concurrent software before and after refactoring.

收稿日期: 2019-09-16
基金项目: 国家自然科学基金(61440012);河北省高等学校科学研究重点项目(ZD2019093);河北省自然科学基金重点项目(18960106)

参考文献:
[1]GRISWOLD W G,OPDYKE W F.The Birth of Refactoring:A Retrospective Look into the Nature of High-impact Software Engineering Research[J].IEEE Software,2015,32(6):1-1.doi:10.1109/MS.2015.107
[2]FOWLER M.Refactoring:Improving the Design of Existing Code[M].Boston:Addison-wesley Longman Publishing Co Inc,1999.doi:10.1007/3-540-45672-4_31
[3]OPDYKE W F,WILLIAM F.Refactoring Object-oriented Frameworks[D].Champaign:University of Illinois,1992.
[4]BRANT J,STEIMANN F.Refactoring Tools Are Trustworthy Enough[J].IEEE Software,2015,32(6):80-83.doi:10.1109/MS.2015.145
[5]SOARES G,GHEYI R,MASSONI T.Automated Behavioral Testing of Refactoring Engines[J].IEEE Transactions on Software Engineering,2013,39(2):147-162.doi:10.1109/TSE.2012.19
[6]SOARES G,GHEYI R,SEREY D,et al.Making Program Refactoring Safer[J].IEEE Software,2010,27(4):52-57.doi:10.1109/MS.2010.63
[7]MONGIOVI M,GHEYI R,SOARES G,et al.Making Refactoring Safer Through Impact Analysis[J].Science of Computer Programming,2014,93(11):39-64.doi:10.1016/j.scico.2013.11.001
[8]SILVA I P S C,ALVES E L G,ANDRADE W L.Analyzing Automatic Test Generation Tools for Refactoring Validation[C]//IEEE/ACM 12th International Workshop on Automation of Software Testing.Buenos Aires:IEEE Press Piscataway,2017:38-44.doi:10.1109/AST.2017.
[9]WANG K,ZHU C,CELIK A,et al.Towards Refactoring-aware Regression Test Selection[C]//PASQUALE L,ALRAJEH D,PEERSMAN C,et al.The 40th International Conference on Software Engineering.Gothenburg:IEEE Computer Society,2018:233-244.doi:10.1145/3180155.3180254
[10]SCHAFER M,DOLBY J,SRIDHARAN M,et al.Correct Refactoring of Concurrent Java Code[C]//AKINORI Y.The 24th European Conference on Object-oriented Programming.Maribor:Springer-verlag,2010:225-249.doi:10.1007/978-3-642-14107-2_11
[11]ZHANG C.Flexsync:An Aspect-oriented Approach to Java Synchronization[C]//31st International Conference on Software Engineering.Vancouver:IEEE Computer Society,2009:16-24.doi:10.1109/ICSE.2009.5070537
[12]MARUYAMA K,HAYASHI S,YOSHIDA N,et al.Frame-based Behavior Preservation in Refactoring[C]//IEEE 24th International Conference on Software Analysis.Klagenfurt:IEEE,2017:573-574.doi:10.1109/SANER.2017.7884683
[13]MENS T,TOURWE T.A Survey of Software Refactoring[J].IEEE Transactions on Software Engineering,2004,30(2):126-139.doi:10.1109/TSE.2004.1265817
[14]BAVOTA G,OLIVETO R,LUCIA A D,et al.Playing with Refactoring:Identifying Extract Class Opportunities Through Game Theory[C]//The 2010 IEEE International Conference on Software Maintenance.Timisoara:IEEE Computer Society,2010:1-5.doi:10.1109/ICSM.2010.5609739
[15]GHOSTFACTOR X,MURPHY-HILL E.Manual Refactoring Changes with Automated Refactoring Validation[M].New York:ACM,2014:1095-1105.
[16]DAO T H,TRINH T B,TRUONG N T.A Tool Support for Checking Consistency in Model Refactoring[C]//HA D T,THANG N V,DAT N T,et al.9th International Conference on Knowledge and Systems Engineering.Hue:IEEE,2017:100-105.doi:10.1109/KSE.2017.8119442
[17]TIP F.Refactoring Using Type Constraints[J].ACM Transactions on Programming Languages and Systems,2011,33(3):1-47.doi:10.1007/978-3-540-74061-2_1
[18]NAIL M,AIKEN A.Conditional Must Not Aliasing for Static Race Detection[C]//The 34th Annual ACM Sigplan-sigact Symposium on Principles of Programming Languages.Nice:ACM,2007:327-338.doi:10.1145/1190216.1190265