Journal of Frontiers of Computer Science and Technology ›› 2013, Vol. 7 ›› Issue (5): 451-459.DOI: 10.3778/j.issn.1673-9418.1209005

Previous Articles     Next Articles

Automated Split Lock Refactoring for Java Programs

TAO Binxian, ZHANG Lei, QIAN Ju+   

  1. College of Computer Science and Technology, Nanjing University of Aeronautics and Astronautics, Nanjing 210016, China
  • Online:2013-05-01 Published:2013-05-03

Java程序自动锁分解重构

陶彬贤,张  磊,钱  巨+   

  1. 南京航空航天大学 计算机科学与技术学院,南京 210016

Abstract: Many concurrent programs use too coarse synchronizations to protect the accesses of shared data structures. To optimize such synchronizations, people use refactorings, e.g., split lock refactoring, to gradually evolve the synchronization code for better parallelization. However, manually identifying the refactoring opportunities is difficult and code transformations by hand are error-prone. To address the problems of manual refactoring, this paper proposes an automated split lock refactoring approach for Java programs. It can automatically analyze the source code to find the refactoring opportunities and make proper code transformations. The experiment shows that the approach can find effective split lock refactoring opportunities in real projects and correctly transform the refactoring code. This indicates that the approach is helpful for concurrent program evolution.

Key words:  Java, concurrency, synchronization, split lock, refactoring

摘要: 许多并发程序存在同步粒度过粗的问题,可以通过锁分解等代码重构来逐步演化同步结构,提高程序并行性。然而,手工重构一方面识别重构契机较为困难,另一方面代码转换也容易出错。为克服手工重构中存在的问题,提出了一种针对Java程序的自动锁分解重构方法。它可以根据已有的同步代码,自动识别锁分解重构契机,并对相关代码进行转换。实验表明,该方法可以有效识别真实程序中的可重构代码,并准确实施转换,为并发程序的演化提供支持。

关键词: Java, 并发, 同步, 锁分解, 重构