Citation: Heo, J.; Jeong, H.; Lee, E.
Patch It If You Can: Increasing the
Efficiency of Patch Generation Using
Context. Electronics 2023, 12, 179.
https://doi.org/10.3390/
electronics12010179
Academic Editor: Sanjay Misra
Received: 1 December 2022
Revised: 22 December 2022
Accepted: 24 December 2022
Published: 30 December 2022
Copyright: © 2022 by the authors.
Licensee MDPI, Basel, Switzerland.
This article is an open access article
distributed under the terms and
conditions of the Creative Commons
Attribution (CC BY) license (https://
creativecommons.org/licenses/by/
4.0/).
Article
Patch It If You Can: Increasing the Efficiency of Patch
Generation Using Context
Jinseok Heo
1,†
, Hohyeon Jeong
1,†
and Eunseok Lee
2,
*
1
Department of Electrical and Computer Engineering, Sungkyunkwan University,
Suwon 16419, Republic of Korea
2
College of Computing and Informatics, Sungkyunkwan University, Suwon 16419, Republic of Korea
* Correspondence: leees@skku.edu
† These authors contributed equally to this work.
Abstract:
Although program repair is a tremendous aspect of a software system, it can be extremely
challenging. An Automated Program Repair (APR) technique has been proposed to solve this
problem. Among them, template-based APR shows good performance. One of the key properties of
the template-based APR technique for practical use is its efficiency. However, because the existing
techniques mainly focus on performance improvement, they do not sufficiently consider the efficiency.
In this study, we propose EffiGenC, which efficiently explores the patch ingredient search space
to improve the overall efficiency of the template-based APR. EffiGenC defines the context using
the concept of extended reaching definition from compiler theory. EffiGenC constructs the search
space by collecting the ingredient required for patching in the context. We evaluated EffiGenC on
the Defects4j benchmark. EffiGenC decreases the number of candidate patches from 27% to 86%
compared to existing techniques. EffiGenC also correctly/plausibly fixes 47/72 bugs. For Future
work, we will solve the search space problem that exists in multiline bugs using context.
Keywords:
software verification and validation; automated program repair; search-based repair;
search space; patch ingredient; context
1. Introduction
An automated program repair(APR) can reduce the debugging costs by automatically
fixing a buggy code [
1
,
2
]. Moreover, the template-based APR technique is one of the
techniques showing good performance among the APR techniques [
3
–
5
]. It generates a
template from the commit history. FixMiner [
6
] collects patch history from open-source
repositories. It used a rich edit script to capture the structure of the AST and then used it to
generate the patch pattern. TBar [
3
] verifies templates from existing template-based APR.
It then checks the patches generated using such templates.
For patch generation, template-based APR approaches additionally leverage various
context information about the buggy code. ConFix [
7
] uses the AST node near the modifica-
tion point as a context to efficiently explore the patch history and changes. CAPGEN [
8
] uses
genetics, variables, and dependency similarities between suspicious codes and candidate
patches as context. Furthermore, it utilizes patch prioritization to increase performance.
The main metrics of existing template-based APR methods focus on a performance
evaluation [
9
]. Liu et al. [
9
] showed that the performance of the APR technique has steadily
improved. However, the efficiency, which is a key property for the practical use of the APR
technique, has not improved.
To improve efficiency, APR require an effective search strategy for search within a
reasonable amount of time. Among the benchmark Defects4j bugs, Figure 1 shows the
developer patches for the Lang-24 and Closure-125 bugs. Both patches can be generated
using the
Mutate Conditional Expression
template proposed by TBar, one of the latest
Electronics 2023, 12, 179. https://doi.org/10.3390/electronics12010179 https://www.mdpi.com/journal/electronics