SlideShare uma empresa Scribd logo
1 de 14
Baixar para ler offline
⾃動プログラム修正による
マージ競合の⾃動解決を⽬指して
丸⼭勝久 邢⼩茜
⽴命館⼤学
@SES 2020 (2020年9⽉12⽇)
並⾏開発
1
共有
リポジトリ
取り出し
git-checkout テストケース TA
ソースコード SA
git-add
git-commit
pass
開発者Aの
ワークスペース
ソースコード SO
独⽴して開発可能 効率的
開発者Bの
ワークスペース
ソースコード SB
取り出し
git-checkout
git-add
git-commit
テストケース TB
pass
マージ競合と競合解決
2
SB
SA
マージ
git-merge
成功
ΔA
ΔB
SB をそのまま受け⼊れてしまうと
ΔA の内容が消えてしまうので
マージ
git-merge
✘
失敗
マージ競合(merge conflict)
競合の解決
SM
ΔAʼ ⊆ ΔA
ΔBʼ ⊆ ΔB
テストケース TM
pass
成功
マージ
git-merge
テストケース TB
pass
問題の定式化
3
TM を満たす
SM を⾃動⽣成
テストケース TM
pass
l 構⽂的競合
­ SM が構⽂解析に失敗
l 静的な意味的競合
­ SM がコンパイルに失敗
l 振る舞い競合
­ SM が予期しない振る舞いを実⾏
従来⼿法の
対象
public class Book {
private String priceInfo;
public Book(int price) {
if (price > 0) {
<<<<<<< HEAD
priceInfo = String.valueOf(price) + "-yen";
} else {
priceInfo = "Not on sale";
=======
this.price = price;
>>>>>>> branch-B
}
}
public String getPriceInfo() {
return priceInfo;
}
public String getPriceInfo() {
return String.valueOf(price) + "-yen";
}
}
SB
So
⼲渉
SM
?競合
ΔB
ΔA
派⽣
SA
提案⼿法
4
SB
SA
So
SM
ステップ(b)
APRシステムに
よる修正
TM
…
SI
ステップ(a)
初期ソース
プログラムの作成
TM
APR
(a) 初期ソースプログラムの作成
5
C[SA]
クラス C の中で
シグネチャが同じメンバ
C[SI]
mO1	
mO3	
mO5	
mA1	
mA2	
mA3	
mB1	
mB2	
mB5	
|	mA1	 mB1	
|	mA2	 mB2	
mA3	
So SA SB に存在
SA SB に存在
SB のみ存在
SA のみ存在
mOi ↔ mAi ↔	mBi
C[SB]
C[SO]
mA4	
mB6	
mB5	
mB6	
mA4	
mO7	
→ 排他的関係
→ 排他的関係
C[SI1] = {	mA1,	mA2,		mA3,		mA4,		mB5,		mB6	}
C[SI2] = { mA1,	mB2,		mA3,		mA4,		mB5,		mB6	}
C[SI3] = {	mB1,	mA2,		mA3,		mA4,		mB5,		mB6	}
C[SI4] = {	mB1,	mB2,		mA3,		mA4,		mB5,		mB6	}
①
②
③
③
④
④
①
②
③④
③④
(b) APRシステムによる修正
6
SM
テストケース TM
SIi
kGenProg
拡張3
条件式の置換を追加
SBSA
修正材料
拡張1
修正材料を
⾃由に指定可能
拡張2
修正範囲を限定可能
⽂の追加・
削除・置換
遺伝的プログラミング
実験
7
https://www.fse.cs.ritsumei.ac.jp/APR-based-Merge
対象 SO SA SB 競合⾏数
VS1 425 +313−35 +57−10 7
VS2 425 +315−44 +45−14 7
DT 2610 +479−24 +168−6 27+10
実験A
SO SA SB 競合⾏数
11 +8−4 +7−1 4
意図的に作成した
振る舞い競合
リファクタリング
& 機能変更
機能追加 & 機能追加
実験B
対象 SO SA SB 競合⾏数 SM
Jsoup 1 356† +12−6 +2−2 3 +12-6/+2-2/+12-6
Jsoup 7 807† +90−3 +25−23 11 +113−24/+25−23/+90−3
実験C
† 競合するソースファイルの⾏数
修正パッチの最⼤数を100個, シードを変えた10回の試⾏
OSSプロジェクトにおける振る舞い競合
実験Aの結果 〜 出⼒数
8
世代数G=10 世代数G=20
変異数V=20 78	/	5 / 2 213	/	7	/	2
変異数V=50 242	/	7	/ 5 833/	13	/	5
変異数V=100 590	/	12	/	5 1,498/	16	/	5
213個の出⼒に対して,
機械的な削減で7個,著者により
2個を受け⼊れ可能と判断
public class Book {
private String priceInfo;
private int price;
public Book(int price) {
if (price > 0) {
priceInfo = String.valueOf(price) + "-yen";
+ this.price = price;
} else {
priceInfo = "Not on sale";
}
}
public int getPrice() {
return price;
}
public String getPriceInfo() {
return priceInfo;
}
}
public class Book {
private String priceInfo;
private int price;
public Book(int price) {
if (price > 0) {
this.price = price;
}
}
public int getPrice() {
return price;
}
public String getPriceInfo() {
- return priceInfo;
+ if (price > 0) {
+ priceInfo = String.valueOf(price) + "-yen";
+ } else {
+ priceInfo = "Not on sale";
+ }
+ return priceInfo;
}
}
if (price > 0) {
this.price = price;
priceInfo = String.valueOf(price) + "-yen";
} else {
priceInfo = "Not on sale";
if (price > 0) {
priceInfo = String.valueOf(price) + "-yen";
} else {
priceInfo = "Not on sale";
}
...
実験Aの結果 〜 実⾏時間
9
世代数
G=10
世代数
G=20
世代数
G=30
世代数
G=40
世代数
G=50
変異数V=20 153	s	(2) 261	s	(2) 386	s	(3) 532	s	(3) 703	s	(3)
変異数V=50 259	s (5) 521	s	(5) 827	s	(5) 1,068	s	(5) 1,345	s	(5)
変異数V=100 418	s	(5) 903	s	(5) 1,332	s	(5) 1,773	s	(5) 2,222	s	(5)
37分2秒/40
40回の試⾏は並列で実施可能
→ 約6.5秒 (40回の試⾏時間が同じ場合)で出⼒可能
修正材料に SI を指定することの有意性を確認
5個の受け⼊れ可能なソースプログラムを
取得するまでに4分19秒
修正材料に SI を指定 → V = 50; G =10で5個出⼒
修正材料に SI を指定しない → V = 100; G =100でも出⼒は0個
実験Bの結果 〜 出⼒数と実⾏時間
10
対象
競合
⾏数
SI
世代数
G=10
VS1 7
2
(1)
変位数
V=50
2	/	0
87	s
変位数
V=100
45	/	1
295	s	
VS2 7 2
変位数
V=50
3	/	2
201	s
変位数
V=100
6	/	3
300	s
DT 37 2
変位数
V=50
11	/	2
858	s
変位数
V=100
15	/	2
1,463
修正範囲を限定することの有意性を確認(DT)
条件式の置換を採⽤することの意義を確認(VS2)
競合するメソッド外部(+1−1)で解決
式レベルでの変換により解決
修正範囲をテストに失敗したメソッドに
限定することで受け⼊れ可能な SM を
出⼒可能
競合メソッド内部(+4−1)で解決
=
VS1 7
2
(1)
2	/	0
87	s
45	/	1
295	s	
VS2 7 2
3	/	2
201	s
6	/	3
300	s
DT 37 2
11	/	2
858	s
15	/	2
1,463
) (2
( ) (
−
V 4 0 5 0
+1) G(
= 5 −
実験Cの結果 〜 出⼒数と実⾏時間
11
対象 コミット
マージ
コミット
マージ
競合
Java
競合
チャンク
数
テスト
あり
本⼿法
が利⽤
可能
Jsoup 1,363		 100 14 10 17 7 2
Lang 5,685 107 24 3 3 2 1
Mockito 5,230 427 9 8 114 6 3
対象 SI 変異数 出⼒数 重複排除 実⾏時間
Jsoup 1 2
V=20 21 16 1,021	s
V=50 44 38 2,646	s
V=100 59 53 4,887	s
Jsoup 7 2
V=20 81 81 2,388	s
V=50 207 204 5,912	s
V=100 353 346 6,240	s
Jsoup 1
Jsoup 7
振る舞い競合
GitHub
〜2020年3⽉12⽇
+2−2で解決
約17分/20
約44分/20
約104分/20
実績と等価
実績と⼀致
+25−23で解決
実プロジェクトにおける⾃動解決の可能性を確認
実績と等価
世代数G = 30, 修正範囲をテストに失敗したメソッドに限定
議論 〜 ⾃動解決を⽬指して
12
なぜ⽣成&検証(G&V)なのか?
なぜOSSプロジェクトを⽤いた⼤規模実験をしないのか?
受け⼊れ困難なソースプログラムが⼤量に出⼒
→ 機械的に選別できる仕組みが必須
実⾏時間の⻑さ
→ バックエンドにマージ専⽤(並列処理)サーバを設置
実際のソフトウェア開発で使えるのか?
マージ競合には開発者間のコンセンサスが必要
→ さまざまなマージ案を⾒ることが重要
振る舞い競合が観測されない
≠ 振る舞い競合が発⽣してない
13
APRによるマージ競合の⾃動解決の可能性を提⽰
ありがとうございました
丸⼭勝久
maru@cs.ritsumei.ac.jp
Q & A

Mais conteúdo relacionado

Destaque

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 

Destaque (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

⾃動プログラム修正による マージ競合の⾃動解決を⽬指して(SES 2020 発表資料)