Automatic Generation of Code-clone Reference Corpus

코드클론 표본 집합체 자동 생성기

  • 이효섭 (한양대학교 컴퓨터공학과) ;
  • 도경구 (한양대학교 컴퓨터공학과)
  • Received : 2011.04.03
  • Accepted : 2011.05.07
  • Published : 2011.06.30

Abstract

To evaluate the quality of clone detection tools, we should know how many clones the tool misses. Hence we need to have the standard code-clone reference corpus for a carefully chosen set of sample source codes. The reference corpus available so far has been built by manually collecting clones from the results of various existing tools. This paper presents a tree-pattern-based clone detection tool that can be used for automatic generation of reference corpus. Our tool is compared with CloneDR for precision and Bellon's reference corpus for recall. Our tool finds no false positives and 2 to 3 times more clones than CloneDR. Compared to Bellon's reference corpus, our tools shows the 93%-to-100% recall rate and detects far more clones.

프로그램 내의 코드클론을 찾아주는 도구나 기술들을 평가하기 위해서는 해당 도구가 탐지하는 못하는 클론이 있는지 확인해야 한다. 이를 위해서 샘플 소스코드에 대해서 코드클론을 모두 모아놓은 표준 표본 집합체가 필요하다. 그런데 기존의 코드클론 표본 집합체는 여러 클론탐지 도구의 결과들을 참조해 수작업으로 구축하지만 평가 기준으로 사용하기에는 빠져있는 표본이 많다. 본 연구에서는 자동으로 코드클론 표본 집합체를 생성하는 방법을 제안하고 도구를 구현하였다. 이 도구는 프로그램 소스를 핵심구문트리로 변환한 뒤, 트리를 샅샅이 비교하여 클론 패턴을 찾아낸다. 본 도구는 오탐이 없으며, 특정한 패턴을 제외하고 미탐도 없어서 코드클론 표본 집합체를 자동으로 생성하기 적합하다. 실험결과 상용도구인 CloneDR에서 찾아낸 클론을 모두 포함하면서 2-3배 더 많은 클론들을 찾아내었고, Bellon의 기존 표본 집합체의 클론들을 거의 대부분 포함(93-100%)하면서 자동 구축한 표본 집합체의 크기가 훨씬 크다.

Keywords

Acknowledgement

본 연구는 교육과학기술부/한국연구재단 우수연구센터 육성사업의 지원으로 수행되었음(과제번호 2011-0000974).