# Exploring Clear Clones Based on Splitting Iteration Structure and Selection Structure Chung Yung and Yen-Chang Lai Reporter: Qin-Xin Tu 1.

## Presentation on theme: "Exploring Clear Clones Based on Splitting Iteration Structure and Selection Structure Chung Yung and Yen-Chang Lai Reporter: Qin-Xin Tu 1."— Presentation transcript:

Exploring Clear Clones Based on Splitting Iteration Structure and Selection Structure Chung Yung and Yen-Chang Lai Reporter: Qin-Xin Tu 1

Outline:  Abstract  Definitions  Splitting Iteration Structure  Splitting Selection Structure  Conclusion 2

Abstract(1):  This paper focuses on finding clear clones.  If a fragment do not have any non-duplicate statements, we can extract it into a new procedure more easy. 3

Abstract(2):  For this reason, this paper present a new framework for finding clear clones : …Splitting iteration structure. …Splitting selection structure. 4

Definitions(1):  They present some definitions of symbols to finding clear clones: … :Ex a b 5

Definitions(3): …Use-Def : Ex (a) Use-Def (b) 6

Definitions(4): …Def-Def :Ex (a) Def-Def (b) 7

Definitions(5):  Splitting:  They use three buckets to place the statements: before bucket, after bucket, and marked bucket.  First, they place the clone into the market bucket. Then, they move the non-duplicate statements out the market.  Finally, they hope the statements in the market bucket can extract into a clear clone. 8

Definitions(2): …Def-Use: Ex (a) Def-Use (b) 9

Splitting Iteration Structure(1):  There have five steps show as following: Step1 Determining ordering constrains. Step2 Preserving the initial value of loop condition. Step3 Preserving the times of loop execution. Step4 Moving statements. Step5 Promoting remainder statement. 10

Splitting Iteration Structure(2):  I use the following fragment as my example: 11

Splitting Iteration Structure(3):  Step 1 : In the step, they determine the ordering constrain as following.  : ex (7) (9).  Def-Use: ex (2) Def-Use (9).  Use-Def: ex (1) Use-Def (8).  Def-Def: ex (5) Def-Def (9). 12

Splitting Iteration Structure(4):  Step 2 : In the step, they preserve the initial value of loop condition show as following: 13

Splitting Iteration Structure(5):  Step 3 : In the step, they hope the result after splitting can be the same as before splitting. They preserve the statements by the following four rules: (1)If x is a conditional statement of loop, y Def-Use x and x Use-Def y, the y is marked with ‘‘**’’. (2)If x is a statement marked with ‘‘’**’, y Def-Use x and x Use-Def y, the y marks with ‘‘**’’. 14

Splitting Iteration Structure(6):  Step 3 : (3) If x and y are two marked statements, x Def-Use y and x Use- Def y, the variables of x and y must be preserved. (4) If x is marked with ‘‘**’’, x is copied to other bucket, its conditional statement must be copied to the same bucket. ex Statement (8) must be marked because rule (1). Statement (3) and (6) must be marked because rule (2). Because rule (3), the variables of statement (6) must be preserved. 15

Splitting Iteration Structure(7):  Step 4 : In the step, they move the unmarked statements to other buckets by following rules: (1)If x is a clone statement, x Def-Use y, the y can be moved to after bucket. (2)If y is a clone statement, x Def-Use y, the x can be moved to before bucket. (3)If x is a clone statement and marked with ‘‘**’’, x Def-Use y, the y can be moved to after or before buckets. 16

Splitting Iteration Structure(8):  Step 4 : (4) If x is a clone statement, x Use-Def y, the y can not be moved to after bucket. (5) If y is a clone statement, x Use-Def y, the x can not be moved to before bucket. (6) If y is a clone statement and marked with ‘‘**’’, x Use-Def y, the x can be moved to after or before buckets. (7) If x is a clone statement, x Def-Def y, the y can be moved to after bucket. 17

Splitting Iteration Structure(9):  Step 4 : (8) If y is a clone statement, x Def-Def y, the x can be moved to before bucket. (9) If x is a clone statement and marked with ‘‘**’’, x Def-Def y, the y can be moved to after or before buckets. (10) If y is marked with ‘‘**’’, x Def-Def y, the x can be moved to after or before bucket. (11) If a statement is not clone, it do not change and do not use by other statements. The statement can be moved to after or before buckets. 18

Splitting Iteration Structure(10):  Step 4 : ex:  Because rule (2), statement (2) Def-Use (4). We can move statement (2) to before bucket.  Because rule (3), statement (3) Def-Use (5). We can move statement (5) to after or before buckets. 19

Splitting Iteration Structure(11):  Step 5 : In the step, they let those statements which are non- duplicate and can not be moved out become duplicate. They use the following holds to finding the statement (n) which needs be promoted: (1)The statement (n) is marked with ‘‘**’’, or (2)The statement (a) and (b) are clone, (a) (n) and (a) (b) 20

Splitting Iteration Structure(12):  The result after splitting iteration structure is show as following: 21

Splitting Selection Structure(1):  There have four steps show as following: Step1 Determining ordering constrains. Step2 Preserving the times of loop execution. Step3 Moving the unmarked statements. Step4 Promoting remainder statement. 22

Splitting Selection Structure(2):  I use the following fragment as my example: 23

Splitting Selection Structure(3):  Step 1 : In the step, they determine the ordering constrains as following.  : ex (1) (2),(3),(4),(5)and(6).  Def-Use: ex (2) Def-Use (5), (3) Def-Use (4).  Use-Def: ex (2) Use-Def (3), (5) Use-Def (6).  Def-Def: ex (4) Def-Def (6). 24

Splitting Selection Structure(4):  Step 2 : In the step, they preserve the initial value of loop condition show as following: 25

Splitting Selection Structure(5):  Step 3 : In the step, they move the non-duplicate statements out the market bucket by the ordering constrains in step 1. ex: From the figure in step 2, we find statements (4), (6), and (8) are non-duplicate. The statement (4) can be moved to before bucket, because (4) Use-Def (5) and (4) Def-Use (7). The statement (8) can be moved to after bucket, because (7) Use- Def (8). 26

Splitting Selection Structure(6):  Step 3 : The result shows as following: 27

Splitting Selection Structure(7):  Step 4 : After step 3, the market bucket may still have non-duplicate statement. They use the following holds to finding the statement (n) which needs be promoted: (1)(a) (n) and (n) (b) ex: From the figure in step 3, statement (7) is non-duplicate, and (6) (7), (7) (8). The statement (7) needs be promoted. 28

Splitting Selection Structure(8):  Step 4 : The result shows as following: 29

Conclusion(1):  We can get the clear clone by splitting iteration structure or splitting selection structure.  By the approach in the paper, we can the get clear clone from the clone which is in iteration structure or selection structure. Komondoor and Horwitz’s approach can not do it. 30

Download ppt "Exploring Clear Clones Based on Splitting Iteration Structure and Selection Structure Chung Yung and Yen-Chang Lai Reporter: Qin-Xin Tu 1."

Similar presentations