Deckard: Scalable and Accurate Tree-based Detection of Code Clones. Lingxiao Jiang, Ghassan Misherghi, Zhendong Su, Stephane Glondu

Size: px
Start display at page:

Download "Deckard: Scalable and Accurate Tree-based Detection of Code Clones. Lingxiao Jiang, Ghassan Misherghi, Zhendong Su, Stephane Glondu"

Transcription

1 Deckard: Scalable and Accurate Tree-based Detection of Code Clones Lingxiao Jiang, Ghassan Misherghi, Zhendong Su, Stephane Glondu

2 The Problem Find similar code in large code bases, often referred to as Clone Detection. Many applications in software engineering Refactoring Evolution study Quality assessment Bug detection y[i] = ; y[i] = ; Code 1 Code 2 2

3 Clone Detection Techniques String-based E.g., Baker (1995, 1997) Token-based E.g., CCFinder (2002), CP-Miner (2004) Tree-based E.g., CloneDR (1998, 2004) Semantic-based E.g., Komondoor & Horwitz (2001) 3

4 Limitations of Existing techniques String-based, token-based Sensitive to code format E.g., x = a*b+c vs. z = c+a*b Tree-based, semantic-based Not scalable 4

5 Deckard s Goal More robust against code modification Scalable to million-line programs 5

6 Tree Similarity and Code Clones Well defined tree similarity problem Tree editing distance δ(t 1, T 2 ): root Minimal # of edit operations fun id argu = + (insert/delete a node or change labels) e f x y a b T 1 and T 2 are σ-similar if δ(t 1, T 2 ) < σ Code clones based on δ clone pair, if δ(t 1, T 2 ) < σ y[i] = ; y[i] = ; Code 1 Code 2 6

7 Not Scalable A clone detection directly based on the definition would not scale: Computing tree editing distance is expensive = root + x y a b Minimal # of edit operations O ( T 1 * T 2 * d 1 * d 2 ) (Zhang et al. 1989) id fun e argu f where d i is the minimum of the depth of T i and the number of leaves of T i Need to compare many pairs of subtrees Program.. Code 1 Code i Code n Quadratic # of Tree Comparison 7

8 The Idea Numerical Vectors Numerical vectors are much easier to compare than trees Suppose v 1 = <x 1,,x n > and v 2 = <y 1,, y n > Hamming distance (or the l 1 norm): Euclidean distance (or the l 2 norm): Program Characterize parse trees as numerical vectors Cluster vectors based on numerical distances Code corresponding to vectors within a same cluster are clones decl var var x root = y a + id call b e argu f v 1 v i v n v 1, v k, v j, v i v n, v m,, v y C 1,C k, C j, C i,c j C n,c m, C y 8

9 Deckard s High Level Architecture 9

10 Outline Define characteristic vectors for trees Relate H, D with δ Generate vectors Evaluate Deckard Implement Deckard Cluster vectors with Locality-Sensitive Hashing 10

11 Characteristic Vectors for Trees Definitions q-level atomic patterns Labeled complete binary trees of height q E.g., 2-level + id id q 2 1 At most L patterns, where L is the set of labels q-level vector for a tree or tree-forest T 2 1 <b 1,, b k >, where k L Each b i counts # of i-th pattern in T q 11

12 An Sample Characteristic Vector 1-level patterns: <id, lit, assign_e, incr_e, array_e, cond_e, expr_s, decl, for_s> 12

13 An Sample Characteristic Vector 1-level patterns: <id, lit, assign_e, incr_e, array_e, cond_e, expr_s, decl, for_s> 13

14 Relate H(T 1,T 2 ), D(v 1,v 2 ), and δ(v 1,v 2 ) Theorem 1 (Yang et al. 2005): If δ(t 1,T 2 ) = k, then H ( v, v ) (4q 3) k Theorem 2: for integer vectors, Hv (, v) Dv (, v) Hv (, v) Theorem 3: for tree characteristic vectors, 1 2 Hv ( 1, v2) Dv ( 1, v2) Hv ( 1, v2) k 4q 3 4q 3 4q 3 14

15 Map Trees to Numerical Vectors (1) <id, lit, assign_e, incr_e, array_e, cond_e, expr_s, decl, for_s> Subtree vectors: 15

16 Map Trees to Numerical Vectors (1) <id, lit, assign_e, incr_e, array_e, cond_e, expr_s, decl, for_s> Subtree vectors: 16

17 Map Trees to Numerical Vectors (1) <id, lit, assign_e, incr_e, array_e, cond_e, expr_s, decl, for_s> Subtree vectors: 17

18 Map Trees to Numerical Vectors (1) <id, lit, assign_e, incr_e, array_e, cond_e, expr_s, decl, for_s> Subtree vectors: 18

19 Map Trees to Numerical Vectors (1) <id, lit, assign_e, incr_e, array_e, cond_e, expr_s, decl, for_s> Subtree vectors: 19

20 Map Trees to Numerical Vectors (1) <id, lit, assign_e, incr_e, array_e, cond_e, expr_s, decl, for_s> Subtree vectors: 20

21 Map Trees to Numerical Vectors (1) <id, lit, assign_e, incr_e, array_e, cond_e, expr_s, decl, for_s> Subtree vectors: 21

22 Map Trees to Numerical Vectors (1) <id, lit, assign_e, incr_e, array_e, cond_e, expr_s, decl, for_s> Subtree vectors: 22

23 Map Trees to Numerical Vectors (2) Forest vectors For sequences of program elements Why needed? S1; S2; S3; S4; S0; S5; S2; S3; S6 list list list S6 list S4 list S3 list S3 list S2 S1 S2 S0 S5 23

24 Map Trees to Numerical Vectors (2) <id, lit, assign_e, incr_e, array_e, cond_e, expr_s, decl, for_s> Forest vectors: 24

25 Map Trees to Numerical Vectors (2) <id, lit, assign_e, incr_e, array_e, cond_e, expr_s, decl, for_s> Forest vectors: 25

26 Map Trees to Numerical Vectors (2) <id, lit, assign_e, incr_e, array_e, cond_e, expr_s, decl, for_s> Forest vectors: 26

27 Map Trees to Numerical Vectors (2) <id, lit, assign_e, incr_e, array_e, cond_e, expr_s, decl, for_s> Forest vectors: 27

28 Map Trees to Numerical Vectors (2) <id, lit, assign_e, incr_e, array_e, cond_e, expr_s, decl, for_s> All vectors: 28

29 Vector Clustering Have millions of generated vectors Need to efficiently cluster close vectors together Hashing Locality-sensitive hashing (LSH) A family of hash functions, s.t., with high probability, Similar vectors hashed to a same hash value Distant vectors hashed to different hash values 29

30 LSH-based Clone Detection (1) Rely on LSH to construct hash tables for vectors h(v i ) v 1 v i v n L S H h(v 1 ) h(v n ) h( ) 30

31 LSH-based Clone Detection (2) Query LSH for vector clusters v 1, v k, v j, v i v n, v m,, v y v 1 Close neighbors of v 1 L S H h(v 1 ) h(v i ) h(v n ) h( ) 31

32 LSH-based Clone Detection (2) Query LSH for vector clusters v 1, v k, v j, v v n, v m, i, v y v i v i Close neighbors of v i L S H h(v 1 ) h(v i ) h(v n ) h( ) 32

33 LSH-based Clone Detection (2) Query LSH for vector clusters v 1, v k, v j, v v n, v m, i, v y v n Close neighbors of v n L S H h(v 1 ) h(v i ) h(v n ) h( ) Post-process to reduce false clones Small clones Overlapping/duplicate clones 33

34 Implementation Modified bison for constructing parse trees 1-level characteristic vectors for trees Group vectors according to their sizes Able to handle size-sensitive clones Less stress on LSH Easy to parallelize 34

35 Evaluation Results Comparison with two state-of-the-art tools Tree-based: CloneDR (for Java) An evaluation version of a commercial tool Token-based: CP-Miner (for C) Evaluation metrics Clone quantity (% of cloned code) Clone quality (% of false clones) Scalability 35

36 Test Programs Application Language # files # lines Linux kernel C 7,988 5,287,090 JDK Java 8,534 2,418,767 GCC C 7,828 1,246,322 PostgreSQL C ,015 Derby Java 1, ,939 Apache C ,287 36

37 Test Programs Application Language # files # lines Linux kernel C 7,988 5,287,090 JDK Java 8,534 2,418,767 GCC C 7,828 1,246,322 PostgreSQL C ,015 Derby Java 1, ,939 Apache C ,287 37

38 Detected More Clones (1) JDK (Deckard vs. CloneDR) Cloned LoC (# / 10^5) Similarity minimum clone size: 50 tokens, stride: 4 CloneDR w/ optimal parameters 38

39 Detected More Clones (2) Linux kernel (Deckard vs. CP-Miner) Gap: # of statement insertions, deletions, and modifications LoC in Clones (# / 10^5) Similarity minimun clone size: 50 tokens; stride: 4 CP-Miner min size: 50 tokens; Gap 0 CP-Miner min size: 50 tokens; Gap 1 39

40 Clone Quality (1) Examined 100 clone clusters Randomly selected from JDK Used parameters Similarity: 1.0 Minimum clone size in tokens: 50 Stride: 4 Among the 100 clusters 93 are clearly real clones The remaining 7 are difficult to assess But they are structurally similar 40

41 Clone Quality (2) if else if (option.equalsignorecase(``basic'')) { bbasictraceon = true; } else if (option.equalsignorecase(``net'')) { bnettraceon = true; } else if (option.equalsignorecase(``security'')) { bsecuritytraceon = true; } else if else if (opt.equals(``-nohelp'')) { nohelp = true; } else if (opt.equals(``-splitindex'')) { splitindex = true; } else if (opt.equals(``-noindex'')) { createindex = false; } else

42 Scalability (1) JDK (Deckard vs. CloneDR) Running Time (min) Similarity minimum clone size: 50 tokens; stride 4 CloneDR w/ optimal parameters 42

43 Scalability (2) Linux kernel (Deckard vs. CP-Miner) Gap: # of statement insertions, deletions, and modifications Running Time (min) minimum clone size: 50 tokens; stride 4 CP-Miner min size: 50 tokens; Gap 0 CP-Miner min size: 50 tokens; Gap Similarity 43

44 Conclusion New algorithm for tree similarity checking Map trees to numerical vectors Cluster similar vectors efficiently Application of the algorithm on clone detection Similarity checking on parse trees Promising results: scalable and accurate 44

45 Thank you! Questions? 45

DECKARD: Scalable and Accurate Tree-based Detection of Code Clones

DECKARD: Scalable and Accurate Tree-based Detection of Code Clones DECKARD: Scalable and Accurate Tree-based Detection of Code Clones Lingxiao Jiang Ghassan Misherghi Zhendong Su University of California, Davis {lxjiang,ghassanm,su}@ucdavis.edu Stéphane Glondu ENS de

More information

Automatic Mining of Functionally Equivalent Code Fragments via Random Testing. Lingxiao Jiang and Zhendong Su

Automatic Mining of Functionally Equivalent Code Fragments via Random Testing. Lingxiao Jiang and Zhendong Su Automatic Mining of Functionally Equivalent Code Fragments via Random Testing Lingxiao Jiang and Zhendong Su Cloning in Software Development How New Software Product Cloning in Software Development Search

More information

Context-Based Detection of Clone-Related Bugs. Lingxiao Jiang, Zhendong Su, Edwin Chiu University of California at Davis

Context-Based Detection of Clone-Related Bugs. Lingxiao Jiang, Zhendong Su, Edwin Chiu University of California at Davis Context-Based Detection of Clone-Related Bugs Lingxiao Jiang, Zhendong Su, Edwin Chiu University of California at Davis 1 Outline Introduction and samples of cloning errors Definitions of inconsistencies

More information

Lecture 25 Clone Detection CCFinder. EE 382V Spring 2009 Software Evolution - Instructor Miryung Kim

Lecture 25 Clone Detection CCFinder. EE 382V Spring 2009 Software Evolution - Instructor Miryung Kim Lecture 25 Clone Detection CCFinder Today s Agenda (1) Recap of Polymetric Views Class Presentation Suchitra (advocate) Reza (skeptic) Today s Agenda (2) CCFinder, Kamiya et al. TSE 2002 Recap of Polymetric

More information

A Novel Technique for Retrieving Source Code Duplication

A Novel Technique for Retrieving Source Code Duplication A Novel Technique for Retrieving Source Code Duplication Yoshihisa Udagawa Computer Science Department, Faculty of Engineering Tokyo Polytechnic University Atsugi-city, Kanagawa, Japan udagawa@cs.t-kougei.ac.jp

More information

Software Clone Detection. Kevin Tang Mar. 29, 2012

Software Clone Detection. Kevin Tang Mar. 29, 2012 Software Clone Detection Kevin Tang Mar. 29, 2012 Software Clone Detection Introduction Reasons for Code Duplication Drawbacks of Code Duplication Clone Definitions in the Literature Detection Techniques

More information

Adaptive Binary Quantization for Fast Nearest Neighbor Search

Adaptive Binary Quantization for Fast Nearest Neighbor Search IBM Research Adaptive Binary Quantization for Fast Nearest Neighbor Search Zhujin Li 1, Xianglong Liu 1*, Junjie Wu 1, and Hao Su 2 1 Beihang University, Beijing, China 2 Stanford University, Stanford,

More information

Searching for Configurations in Clone Evaluation A Replication Study

Searching for Configurations in Clone Evaluation A Replication Study Searching for Configurations in Clone Evaluation A Replication Study Chaiyong Ragkhitwetsagul 1, Matheus Paixao 1, Manal Adham 1 Saheed Busari 1, Jens Krinke 1 and John H. Drake 2 1 University College

More information

Keywords Code cloning, Clone detection, Software metrics, Potential clones, Clone pairs, Clone classes. Fig. 1 Code with clones

Keywords Code cloning, Clone detection, Software metrics, Potential clones, Clone pairs, Clone classes. Fig. 1 Code with clones Volume 4, Issue 4, April 2014 ISSN: 2277 128X International Journal of Advanced Research in Computer Science and Software Engineering Research Paper Available online at: www.ijarcsse.com Detection of Potential

More information

A Tree Kernel Based Approach for Clone Detection

A Tree Kernel Based Approach for Clone Detection A Tree Kernel Based Approach for Clone Detection Anna Corazza 1, Sergio Di Martino 1, Valerio Maggio 1, Giuseppe Scanniello 2 1) University of Naples Federico II 2) University of Basilicata Outline Background

More information

Near Neighbor Search in High Dimensional Data (1) Dr. Anwar Alhenshiri

Near Neighbor Search in High Dimensional Data (1) Dr. Anwar Alhenshiri Near Neighbor Search in High Dimensional Data (1) Dr. Anwar Alhenshiri Scene Completion Problem The Bare Data Approach High Dimensional Data Many real-world problems Web Search and Text Mining Billions

More information

International Journal of Scientific & Engineering Research, Volume 8, Issue 2, February ISSN

International Journal of Scientific & Engineering Research, Volume 8, Issue 2, February ISSN International Journal of Scientific & Engineering Research, Volume 8, Issue 2, February-2017 164 DETECTION OF SOFTWARE REFACTORABILITY THROUGH SOFTWARE CLONES WITH DIFFRENT ALGORITHMS Ritika Rani 1,Pooja

More information

Software Clone Detection Using Cosine Distance Similarity

Software Clone Detection Using Cosine Distance Similarity Software Clone Detection Using Cosine Distance Similarity A Dissertation SUBMITTED IN PARTIAL FULFILLMENT OF THE REQUIREMENT FOR THE AWARD OF DEGREE OF MASTER OF TECHNOLOGY IN COMPUTER SCIENCE & ENGINEERING

More information

Sub-clones: Considering the Part Rather than the Whole

Sub-clones: Considering the Part Rather than the Whole Sub-clones: Considering the Part Rather than the Whole Robert Tairas 1 and Jeff Gray 2 1 Department of Computer and Information Sciences, University of Alabama at Birmingham, Birmingham, AL 2 Department

More information

Code Similarity in TouchDevelop: Harnessing Clones

Code Similarity in TouchDevelop: Harnessing Clones Code Similarity in TouchDevelop: Harnessing Clones Marat Akhin Nikolai Tillmann Manuel Fahndrich Jonathan de Halleux Michal Moskal Microsoft Research One Microsoft Way, Redmond WA 98052, USA {t-marata,nikolait,maf,jhalleux,micmo}@microsoft.com

More information

COMPARISON AND EVALUATION ON METRICS

COMPARISON AND EVALUATION ON METRICS COMPARISON AND EVALUATION ON METRICS BASED APPROACH FOR DETECTING CODE CLONE D. Gayathri Devi 1 1 Department of Computer Science, Karpagam University, Coimbatore, Tamilnadu dgayadevi@gmail.com Abstract

More information

Incremental Clone Detection and Elimination for Erlang Programs

Incremental Clone Detection and Elimination for Erlang Programs Incremental Clone Detection and Elimination for Erlang Programs Huiqing Li and Simon Thompson School of Computing, University of Kent, UK {H.Li, S.J.Thompson}@kent.ac.uk Abstract. A well-known bad code

More information

DCCD: An Efficient and Scalable Distributed Code Clone Detection Technique for Big Code

DCCD: An Efficient and Scalable Distributed Code Clone Detection Technique for Big Code DCCD: An Efficient and Scalable Distributed Code Clone Detection Technique for Big Code Junaid Akram (Member, IEEE), Zhendong Shi, Majid Mumtaz and Luo Ping State Key Laboratory of Information Security,

More information

CSE 332 Spring 2013: Midterm Exam (closed book, closed notes, no calculators)

CSE 332 Spring 2013: Midterm Exam (closed book, closed notes, no calculators) Name: Email address: Quiz Section: CSE 332 Spring 2013: Midterm Exam (closed book, closed notes, no calculators) Instructions: Read the directions for each question carefully before answering. We will

More information

Master Thesis. Type-3 Code Clone Detection Using The Smith-Waterman Algorithm

Master Thesis. Type-3 Code Clone Detection Using The Smith-Waterman Algorithm Master Thesis Title Type-3 Code Clone Detection Using The Smith-Waterman Algorithm Supervisor Prof. Shinji KUSUMOTO by Hiroaki MURAKAMI February 5, 2013 Department of Computer Science Graduate School of

More information

Performance Evaluation and Comparative Analysis of Code- Clone-Detection Techniques and Tools

Performance Evaluation and Comparative Analysis of Code- Clone-Detection Techniques and Tools , pp. 31-50 http://dx.doi.org/10.14257/ijseia.2017.11.3.04 Performance Evaluation and Comparative Analysis of Code- Clone-Detection Techniques and Tools Harpreet Kaur 1 * (Assistant Professor) and Raman

More information

Code Clone Detector: A Hybrid Approach on Java Byte Code

Code Clone Detector: A Hybrid Approach on Java Byte Code Code Clone Detector: A Hybrid Approach on Java Byte Code Thesis submitted in partial fulfillment of the requirements for the award of degree of Master of Engineering in Software Engineering Submitted By

More information

1/30/18. Overview. Code Clones. Code Clone Categorization. Code Clones. Code Clone Categorization. Key Points of Code Clones

1/30/18. Overview. Code Clones. Code Clone Categorization. Code Clones. Code Clone Categorization. Key Points of Code Clones Overview Code Clones Definition and categories Clone detection Clone removal refactoring Spiros Mancoridis[1] Modified by Na Meng 2 Code Clones Code clone is a code fragment in source files that is identical

More information

SOURCE CODE RETRIEVAL USING SEQUENCE BASED SIMILARITY

SOURCE CODE RETRIEVAL USING SEQUENCE BASED SIMILARITY SOURCE CODE RETRIEVAL USING SEQUENCE BASED SIMILARITY Yoshihisa Udagawa Faculty of Engineering, Tokyo Polytechnic University, Atsugi City, Kanagawa, Japan udagawa@cs.t-kougei.ac.jp ABSTRACT Duplicate code

More information

Lecture 11: Multiway and (2,4) Trees. Courtesy to Goodrich, Tamassia and Olga Veksler

Lecture 11: Multiway and (2,4) Trees. Courtesy to Goodrich, Tamassia and Olga Veksler Lecture 11: Multiway and (2,4) Trees 9 2 5 7 10 14 Courtesy to Goodrich, Tamassia and Olga Veksler Instructor: Yuzhen Xie Outline Multiway Seach Tree: a new type of search trees: for ordered d dictionary

More information

SEMANTIC ANALYSIS TYPES AND DECLARATIONS

SEMANTIC ANALYSIS TYPES AND DECLARATIONS SEMANTIC ANALYSIS CS 403: Type Checking Stefan D. Bruda Winter 2015 Parsing only verifies that the program consists of tokens arranged in a syntactically valid combination now we move to check whether

More information

What is a compiler? var a var b mov 3 a mov 4 r1 cmpi a r1 jge l_e mov 2 b jmp l_d l_e: mov 3 b l_d: ;done

What is a compiler? var a var b mov 3 a mov 4 r1 cmpi a r1 jge l_e mov 2 b jmp l_d l_e: mov 3 b l_d: ;done What is a compiler? What is a compiler? Traditionally: Program that analyzes and translates from a high level language (e.g., C++) to low-level assembly language that can be executed by hardware int a,

More information

CS246: Mining Massive Datasets Jure Leskovec, Stanford University

CS246: Mining Massive Datasets Jure Leskovec, Stanford University CS246: Mining Massive Datasets Jure Leskovec, Stanford University http://cs246.stanford.edu /2/8 Jure Leskovec, Stanford CS246: Mining Massive Datasets 2 Task: Given a large number (N in the millions or

More information

Classification of Java Programs in SPARS-J. Kazuo Kobori, Tetsuo Yamamoto, Makoto Matsusita and Katsuro Inoue Osaka University

Classification of Java Programs in SPARS-J. Kazuo Kobori, Tetsuo Yamamoto, Makoto Matsusita and Katsuro Inoue Osaka University Classification of Java Programs in SPARS-J Kazuo Kobori, Tetsuo Yamamoto, Makoto Matsusita and Katsuro Inoue Osaka University Background SPARS-J Reuse Contents Similarity measurement techniques Characteristic

More information

Clustering. Chapter 10 in Introduction to statistical learning

Clustering. Chapter 10 in Introduction to statistical learning Clustering Chapter 10 in Introduction to statistical learning 16 14 12 10 8 6 4 2 0 2 4 6 8 10 12 14 1 Clustering ² Clustering is the art of finding groups in data (Kaufman and Rousseeuw, 1990). ² What

More information

CS246: Mining Massive Datasets Jure Leskovec, Stanford University

CS246: Mining Massive Datasets Jure Leskovec, Stanford University CS46: Mining Massive Datasets Jure Leskovec, Stanford University http://cs46.stanford.edu /7/ Jure Leskovec, Stanford C46: Mining Massive Datasets Many real-world problems Web Search and Text Mining Billions

More information

On Refactoring for Open Source Java Program

On Refactoring for Open Source Java Program On Refactoring for Open Source Java Program Yoshiki Higo 1,Toshihiro Kamiya 2, Shinji Kusumoto 1, Katsuro Inoue 1 and Yoshio Kataoka 3 1 Graduate School of Information Science and Technology, Osaka University

More information

Problem 1: Complexity of Update Rules for Logistic Regression

Problem 1: Complexity of Update Rules for Logistic Regression Case Study 1: Estimating Click Probabilities Tackling an Unknown Number of Features with Sketching Machine Learning for Big Data CSE547/STAT548, University of Washington Emily Fox January 16 th, 2014 1

More information

These are not polished as solutions, but ought to give a correct idea of solutions that work. Note that most problems have multiple good solutions.

These are not polished as solutions, but ought to give a correct idea of solutions that work. Note that most problems have multiple good solutions. CSE 591 HW Sketch Sample Solutions These are not polished as solutions, but ought to give a correct idea of solutions that work. Note that most problems have multiple good solutions. Problem 1 (a) Any

More information

An Exploratory Study on Interface Similarities in Code Clones

An Exploratory Study on Interface Similarities in Code Clones 1 st WETSoDA, December 4, 2017 - Nanjing, China An Exploratory Study on Interface Similarities in Code Clones Md Rakib Hossain Misu, Abdus Satter, Kazi Sakib Institute of Information Technology University

More information

Locality-Sensitive Hashing

Locality-Sensitive Hashing Locality-Sensitive Hashing & Image Similarity Search Andrew Wylie Overview; LSH given a query q (or not), how do we find similar items from a large search set quickly? Can t do all pairwise comparisons;

More information

Code Clone Analysis and Application

Code Clone Analysis and Application Code Clone Analysis and Application Katsuro Inoue Osaka University Talk Structure Clone Detection CCFinder and Associate Tools Applications Summary of Code Clone Analysis and Application Clone Detection

More information

Clone Detection Using Scope Trees

Clone Detection Using Scope Trees Int'l Conf. Software Eng. Research and Practice SERP'18 193 Clone Detection Using Scope Trees M. Mohammed and J. Fawcett Department of Computer Science and Electrical Engineering, Syracuse University,

More information

CS246: Mining Massive Datasets Jure Leskovec, Stanford University

CS246: Mining Massive Datasets Jure Leskovec, Stanford University CS246: Mining Massive Datasets Jure Leskovec, Stanford University http://cs246.stanford.edu [Kumar et al. 99] 2/13/2013 Jure Leskovec, Stanford CS246: Mining Massive Datasets, http://cs246.stanford.edu

More information

Re-engineering Software Variants into Software Product Line

Re-engineering Software Variants into Software Product Line Re-engineering Software Variants into Software Product Line Présentation extraite de la soutenance de thèse de M. Ra'Fat AL-Msie'Deen University of Montpellier Software product variants 1. Software product

More information

Incremental Code Clone Detection: A PDG-based Approach

Incremental Code Clone Detection: A PDG-based Approach Incremental Code Clone Detection: A PDG-based Approach Yoshiki Higo, Yasushi Ueda, Minoru Nishino, Shinji Kusumoto Graduate School of Information Science and Technology, Osaka University, 1-5, Yamadaoka,

More information

Locality-Sensitive Codes from Shift-Invariant Kernels Maxim Raginsky (Duke) and Svetlana Lazebnik (UNC)

Locality-Sensitive Codes from Shift-Invariant Kernels Maxim Raginsky (Duke) and Svetlana Lazebnik (UNC) Locality-Sensitive Codes from Shift-Invariant Kernels Maxim Raginsky (Duke) and Svetlana Lazebnik (UNC) Goal We want to design a binary encoding of data such that similar data points (similarity measures

More information

Locality- Sensitive Hashing Random Projections for NN Search

Locality- Sensitive Hashing Random Projections for NN Search Case Study 2: Document Retrieval Locality- Sensitive Hashing Random Projections for NN Search Machine Learning for Big Data CSE547/STAT548, University of Washington Sham Kakade April 18, 2017 Sham Kakade

More information

CS 315 Data Structures mid-term 2

CS 315 Data Structures mid-term 2 CS 315 Data Structures mid-term 2 1) Shown below is an AVL tree T. Nov 14, 2012 Solutions to OPEN BOOK section. (a) Suggest a key whose insertion does not require any rotation. 18 (b) Suggest a key, if

More information

MACHINE LEARNING FOR SOFTWARE MAINTAINABILITY

MACHINE LEARNING FOR SOFTWARE MAINTAINABILITY MACHINE LEARNING FOR SOFTWARE MAINTAINABILITY Anna Corazza, Sergio Di Martino, Valerio Maggio Alessandro Moschitti, Andrea Passerini, Giuseppe Scanniello, Fabrizio Silverstri JIMSE 2012 August 28, 2012

More information

Intermediate Code Generation

Intermediate Code Generation Intermediate Code Generation In the analysis-synthesis model of a compiler, the front end analyzes a source program and creates an intermediate representation, from which the back end generates target

More information

A Novel Ontology Metric Approach for Code Clone Detection Using FusionTechnique

A Novel Ontology Metric Approach for Code Clone Detection Using FusionTechnique A Novel Ontology Metric Approach for Code Clone Detection Using FusionTechnique 1 Syed MohdFazalulHaque, 2 Dr. V Srikanth, 3 Dr. E. Sreenivasa Reddy 1 Maulana Azad National Urdu University, 2 Professor,

More information

On Refactoring Support Based on Code Clone Dependency Relation

On Refactoring Support Based on Code Clone Dependency Relation On Refactoring Support Based on Code Dependency Relation Norihiro Yoshida 1, Yoshiki Higo 1, Toshihiro Kamiya 2, Shinji Kusumoto 1, Katsuro Inoue 1 1 Graduate School of Information Science and Technology,

More information

Instructions. Definitions. Name: CMSC 341 Fall Question Points I. /12 II. /30 III. /10 IV. /12 V. /12 VI. /12 VII.

Instructions. Definitions. Name: CMSC 341 Fall Question Points I. /12 II. /30 III. /10 IV. /12 V. /12 VI. /12 VII. CMSC 341 Fall 2013 Data Structures Final Exam B Name: Question Points I. /12 II. /30 III. /10 IV. /12 V. /12 VI. /12 VII. /12 TOTAL: /100 Instructions 1. This is a closed-book, closed-notes exam. 2. You

More information

Semantic Analysis. Outline. The role of semantic analysis in a compiler. Scope. Types. Where we are. The Compiler so far

Semantic Analysis. Outline. The role of semantic analysis in a compiler. Scope. Types. Where we are. The Compiler so far Outline Semantic Analysis The role of semantic analysis in a compiler A laundry list of tasks Scope Static vs. Dynamic scoping Implementation: symbol tables Types Statically vs. Dynamically typed languages

More information

CSIT5300: Advanced Database Systems

CSIT5300: Advanced Database Systems CSIT5300: Advanced Database Systems L08: B + -trees and Dynamic Hashing Dr. Kenneth LEUNG Department of Computer Science and Engineering The Hong Kong University of Science and Technology Hong Kong SAR,

More information

Machine Learning. Nonparametric methods for Classification. Eric Xing , Fall Lecture 2, September 12, 2016

Machine Learning. Nonparametric methods for Classification. Eric Xing , Fall Lecture 2, September 12, 2016 Machine Learning 10-701, Fall 2016 Nonparametric methods for Classification Eric Xing Lecture 2, September 12, 2016 Reading: 1 Classification Representing data: Hypothesis (classifier) 2 Clustering 3 Supervised

More information

Coriolis: Scalable VM Clustering in Clouds

Coriolis: Scalable VM Clustering in Clouds 1 / 21 Coriolis: Scalable VM Clustering in Clouds Daniel Campello 1 Carlos Crespo 1 Akshat Verma 2 RajuRangaswami 1 Praveen Jayachandran 2 1 School of Computing and Information Sciences

More information

Clone Detection via Structural Abstraction

Clone Detection via Structural Abstraction Clone Detection via Structural Abstraction William S. Evans will@cs.ubc.ca Christopher W. Fraser cwfraser@gmail.com Fei Ma Fei.Ma@microsoft.com Abstract This paper describes the design, implementation,

More information

Optimizing Out-of-Core Nearest Neighbor Problems on Multi-GPU Systems Using NVLink

Optimizing Out-of-Core Nearest Neighbor Problems on Multi-GPU Systems Using NVLink Optimizing Out-of-Core Nearest Neighbor Problems on Multi-GPU Systems Using NVLink Rajesh Bordawekar IBM T. J. Watson Research Center bordaw@us.ibm.com Pidad D Souza IBM Systems pidsouza@in.ibm.com 1 Outline

More information

Syntax and Grammars 1 / 21

Syntax and Grammars 1 / 21 Syntax and Grammars 1 / 21 Outline What is a language? Abstract syntax and grammars Abstract syntax vs. concrete syntax Encoding grammars as Haskell data types What is a language? 2 / 21 What is a language?

More information

PLEASE HAND IN UNIVERSITY OF TORONTO Faculty of Arts and Science

PLEASE HAND IN UNIVERSITY OF TORONTO Faculty of Arts and Science PLEASE HAND IN UNIVERSITY OF TORONTO Faculty of Arts and Science APRIL 2017 EXAMINATIONS CSC 104 H1S Instructor(s): G. Baumgartner Duration 3 hours PLEASE HAND IN No Aids Allowed Student Number: Last (Family)

More information

CSE 332 Autumn 2013: Midterm Exam (closed book, closed notes, no calculators)

CSE 332 Autumn 2013: Midterm Exam (closed book, closed notes, no calculators) Name: Email address: Quiz Section: CSE 332 Autumn 2013: Midterm Exam (closed book, closed notes, no calculators) Instructions: Read the directions for each question carefully before answering. We will

More information

CSCE 531 Spring 2009 Final Exam

CSCE 531 Spring 2009 Final Exam CSCE 531 Spring 2009 Final Exam Do all problems. Write your solutions on the paper provided. This test is open book, open notes, but no electronic devices. For your own sake, please read all problems before

More information

Predictive Indexing for Fast Search

Predictive Indexing for Fast Search Predictive Indexing for Fast Search Sharad Goel, John Langford and Alex Strehl Yahoo! Research, New York Modern Massive Data Sets (MMDS) June 25, 2008 Goel, Langford & Strehl (Yahoo! Research) Predictive

More information

CBCD: Cloned Buggy Code Detector. Technical Report UW-CSE May 2, 2011 (Revised March 20, 2012)

CBCD: Cloned Buggy Code Detector. Technical Report UW-CSE May 2, 2011 (Revised March 20, 2012) CBCD: Cloned Buggy Code Detector Technical Report UW-CSE-11-05-02 May 2, 2011 (Revised March 20, 2012) Jingyue Li DNV Research&Innovation Høvik, Norway Jingyue.Li@dnv.com Michael D. Ernst U. of Washington

More information

MeCC: Memory Comparison-based Clone Detector

MeCC: Memory Comparison-based Clone Detector MeCC: Memory Comparison-based Clone Detector Heejung Kim, Yungbum Jung, Sunghun Kim, Kwangkeun Yi Seoul National University, Seoul, Korea {hjkim,dreameye,kwang}@ropas.snu.ac.kr The Hong Kong University

More information

Estimation of Similarity between Functions Extracted from x86 Executable Files

Estimation of Similarity between Functions Extracted from x86 Executable Files SERBIAN JOURNAL OF ELECTRICAL ENGINEERING Vol. 12, No. 2, June 2015, 253-262 UDC: 004.4`22:[004.415.3+004.424.46 DOI: 10.2298/SJEE1502253B Estimation of Similarity between Functions Extracted from x86

More information

Semantic actions for declarations and expressions

Semantic actions for declarations and expressions Semantic actions for declarations and expressions Semantic actions Semantic actions are routines called as productions (or parts of productions) are recognized Actions work together to build up intermediate

More information

Code Clone Detection Technique Using Program Execution Traces

Code Clone Detection Technique Using Program Execution Traces 1,a) 2,b) 1,c) Code Clone Detection Technique Using Program Execution Traces Masakazu Ioka 1,a) Norihiro Yoshida 2,b) Katsuro Inoue 1,c) Abstract: Code clone is a code fragment that has identical or similar

More information

Nearest Neighbor with KD Trees

Nearest Neighbor with KD Trees Case Study 2: Document Retrieval Finding Similar Documents Using Nearest Neighbors Machine Learning/Statistics for Big Data CSE599C1/STAT592, University of Washington Emily Fox January 22 nd, 2013 1 Nearest

More information

Section 05: Midterm Review

Section 05: Midterm Review Section 05: Midterm Review 1. Asymptotic Analysis (a) Applying definitions For each of the following, choose a c and n 0 which show f(n) O(g(n)). Explain why your values of c and n 0 work. (i) f(n) = 5000n

More information

Semantic actions for declarations and expressions. Monday, September 28, 15

Semantic actions for declarations and expressions. Monday, September 28, 15 Semantic actions for declarations and expressions Semantic actions Semantic actions are routines called as productions (or parts of productions) are recognized Actions work together to build up intermediate

More information

A Simple Syntax-Directed Translator

A Simple Syntax-Directed Translator Chapter 2 A Simple Syntax-Directed Translator 1-1 Introduction The analysis phase of a compiler breaks up a source program into constituent pieces and produces an internal representation for it, called

More information

COMP 250 Winter 2010 Exercises 6 - trees March 2010

COMP 250 Winter 2010 Exercises 6 - trees March 2010 Questions 1. Consider the polynomial 5y 2 3y + 2. (a) Write the polynomial as an expression tree that obeys the usual ordering of operations. Hint: to clarify the ordering for yourself, first write the

More information

Semantic Clone Detection Using Machine Learning

Semantic Clone Detection Using Machine Learning Semantic Clone Detection Using Machine Learning Abdullah Sheneamer University of Colorado Colorado Springs, CO USA 80918 Email: asheneam@uccs.edu Jugal Kalita University of Colorado Colorado Springs, CO

More information

An Experience Report on Analyzing Industrial Software Systems Using Code Clone Detection Techniques

An Experience Report on Analyzing Industrial Software Systems Using Code Clone Detection Techniques An Experience Report on Analyzing Industrial Software Systems Using Code Clone Detection Techniques Norihiro Yoshida (NAIST) Yoshiki Higo, Shinji Kusumoto, Katsuro Inoue (Osaka University) Outline 1. What

More information

Geometric data structures:

Geometric data structures: Geometric data structures: Machine Learning for Big Data CSE547/STAT548, University of Washington Sham Kakade Sham Kakade 2017 1 Announcements: HW3 posted Today: Review: LSH for Euclidean distance Other

More information

VK Multimedia Information Systems

VK Multimedia Information Systems VK Multimedia Information Systems Mathias Lux, mlux@itec.uni-klu.ac.at Dienstags, 16.oo Uhr c.t., E.1.42 This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Indexing

More information

Fast Inbound Top- K Query for Random Walk with Restart

Fast Inbound Top- K Query for Random Walk with Restart Fast Inbound Top- K Query for Random Walk with Restart Chao Zhang, Shan Jiang, Yucheng Chen, Yidan Sun, Jiawei Han University of Illinois at Urbana Champaign czhang82@illinois.edu 1 Outline Background

More information

Semantic Analysis. Outline. The role of semantic analysis in a compiler. Scope. Types. Where we are. The Compiler Front-End

Semantic Analysis. Outline. The role of semantic analysis in a compiler. Scope. Types. Where we are. The Compiler Front-End Outline Semantic Analysis The role of semantic analysis in a compiler A laundry list of tasks Scope Static vs. Dynamic scoping Implementation: symbol tables Types Static analyses that detect type errors

More information

Interpreters. Prof. Clarkson Fall Today s music: Step by Step by New Kids on the Block

Interpreters. Prof. Clarkson Fall Today s music: Step by Step by New Kids on the Block Interpreters Prof. Clarkson Fall 2017 Today s music: Step by Step by New Kids on the Block Review Previously in 3110: functional programming modular programming data structures Today: new unit of course:

More information

2IS55 Software Evolution. Code duplication. Alexander Serebrenik

2IS55 Software Evolution. Code duplication. Alexander Serebrenik 2IS55 Software Evolution Code duplication Alexander Serebrenik Assignments Assignment 2: February 28, 2014, 23:59. Assignment 3 already open. Code duplication Individual Deadline: March 17, 2013, 23:59.

More information

1 Metric spaces. d(x, x) = 0 for all x M, d(x, y) = d(y, x) for all x, y M,

1 Metric spaces. d(x, x) = 0 for all x M, d(x, y) = d(y, x) for all x, y M, 1 Metric spaces For completeness, we recall the definition of metric spaces and the notions relating to measures on metric spaces. A metric space is a pair (M, d) where M is a set and d is a function from

More information

Articulated Pose Estimation with Flexible Mixtures-of-Parts

Articulated Pose Estimation with Flexible Mixtures-of-Parts Articulated Pose Estimation with Flexible Mixtures-of-Parts PRESENTATION: JESSE DAVIS CS 3710 VISUAL RECOGNITION Outline Modeling Special Cases Inferences Learning Experiments Problem and Relevance Problem:

More information

Problematic Code Clones Identification using Multiple Detection Results

Problematic Code Clones Identification using Multiple Detection Results Problematic Code Clones Identification using Multiple Detection Results Yoshiki Higo, Ken-ichi Sawa, and Shinji Kusumoto Graduate School of Information Science and Technology, Osaka University, 1-5, Yamadaoka,

More information

Geometric Routing: Of Theory and Practice

Geometric Routing: Of Theory and Practice Geometric Routing: Of Theory and Practice PODC 03 F. Kuhn, R. Wattenhofer, Y. Zhang, A. Zollinger [KWZ 02] [KWZ 03] [KK 00] Asymptotically Optimal Geometric Mobile Ad-Hoc Routing Worst-Case Optimal and

More information

By Atul S. Kulkarni Graduate Student, University of Minnesota Duluth. Under The Guidance of Dr. Richard Maclin

By Atul S. Kulkarni Graduate Student, University of Minnesota Duluth. Under The Guidance of Dr. Richard Maclin By Atul S. Kulkarni Graduate Student, University of Minnesota Duluth Under The Guidance of Dr. Richard Maclin Outline Problem Statement Background Proposed Solution Experiments & Results Related Work Future

More information

A Survey of Software Clone Detection Techniques

A Survey of Software Clone Detection Techniques A Survey of Software Detection Techniques Abdullah Sheneamer Department of Computer Science University of Colorado at Colo. Springs, USA Colorado Springs, USA asheneam@uccs.edu Jugal Kalita Department

More information

How am I going to skim through these data?

How am I going to skim through these data? How am I going to skim through these data? 1 Trends Computers keep getting faster But data grows faster yet! Remember? BIG DATA! Queries are becoming more complex Remember? ANALYTICS! 2 Analytic Queries

More information

CSE 332, Spring 2010, Midterm Examination 30 April 2010

CSE 332, Spring 2010, Midterm Examination 30 April 2010 CSE 332, Spring 2010, Midterm Examination 30 April 2010 Please do not turn the page until the bell rings. Rules: The exam is closed-book, closed-note. You may use a calculator for basic arithmetic only.

More information

Recursively Defined Functions

Recursively Defined Functions Section 5.3 Recursively Defined Functions Definition: A recursive or inductive definition of a function consists of two steps. BASIS STEP: Specify the value of the function at zero. RECURSIVE STEP: Give

More information

Shingling Minhashing Locality-Sensitive Hashing. Jeffrey D. Ullman Stanford University

Shingling Minhashing Locality-Sensitive Hashing. Jeffrey D. Ullman Stanford University Shingling Minhashing Locality-Sensitive Hashing Jeffrey D. Ullman Stanford University 2 Wednesday, January 13 Computer Forum Career Fair 11am - 4pm Lawn between the Gates and Packard Buildings Policy for

More information

Code Duplication. Harald Gall seal.ifi.uzh.ch/evolution

Code Duplication. Harald Gall seal.ifi.uzh.ch/evolution Code Duplication Harald Gall seal.ifi.uzh.ch/evolution Code is Copied Small Example from the Mozilla Distribution (Milestone 9) Extract from /dom/src/base/nslocation.cpp [432] NS_IMETHODIMP [467] NS_IMETHODIMP

More information

Proactive Detection of Inadequate Diagnostic Messages for Software Configuration Errors

Proactive Detection of Inadequate Diagnostic Messages for Software Configuration Errors Proactive Detection of Inadequate Diagnostic Messages for Software Configuration Errors Sai Zhang Google Research Michael D. Ernst University of Washington Goal: helping developers improve software error

More information

MeCC: Memory Comparison-based Clone Detector

MeCC: Memory Comparison-based Clone Detector MeCC: Memory Comparison-based Clone Detector ABSTRACT Heejung Kim Seoul National University hjkim@ropas.snu.ac.kr Sunghun Kim The Hong Kong University of Science and Technology hunkim@cse.ust.hk In this

More information

Formal Languages and Grammars. Chapter 2: Sections 2.1 and 2.2

Formal Languages and Grammars. Chapter 2: Sections 2.1 and 2.2 Formal Languages and Grammars Chapter 2: Sections 2.1 and 2.2 Formal Languages Basis for the design and implementation of programming languages Alphabet: finite set Σ of symbols String: finite sequence

More information

Clustering & Classification (chapter 15)

Clustering & Classification (chapter 15) Clustering & Classification (chapter 5) Kai Goebel Bill Cheetham RPI/GE Global Research goebel@cs.rpi.edu cheetham@cs.rpi.edu Outline k-means Fuzzy c-means Mountain Clustering knn Fuzzy knn Hierarchical

More information

Gábor Imre MADFAST SIMILARITY SEARCH

Gábor Imre MADFAST SIMILARITY SEARCH Gábor Imre MADFAST SIMILARITY SEARCH How fast is MadFast? Some numbers measured on an Amazon EC2 c3.8xlarge/r3.8xlarge machine How fast is MadFast? Some numbers measured on an Amazon EC2 c3.8xlarge/r3.8xlarge

More information

Accuracy Enhancement in Code Clone Detection Using Advance Normalization

Accuracy Enhancement in Code Clone Detection Using Advance Normalization Accuracy Enhancement in Code Clone Detection Using Advance Normalization 1 Ritesh V. Patil, 2 S. D. Joshi, 3 Digvijay A. Ajagekar, 4 Priyanka A. Shirke, 5 Vivek P. Talekar, 6 Shubham D. Bankar 1 Research

More information

M-ary Search Tree. B-Trees. B-Trees. Solution: B-Trees. B-Tree: Example. B-Tree Properties. Maximum branching factor of M Complete tree has height =

M-ary Search Tree. B-Trees. B-Trees. Solution: B-Trees. B-Tree: Example. B-Tree Properties. Maximum branching factor of M Complete tree has height = M-ary Search Tree B-Trees Section 4.7 in Weiss Maximum branching factor of M Complete tree has height = # disk accesses for find: Runtime of find: 2 Solution: B-Trees specialized M-ary search trees Each

More information

The Kinect Sensor. Luís Carriço FCUL 2014/15

The Kinect Sensor. Luís Carriço FCUL 2014/15 Advanced Interaction Techniques The Kinect Sensor Luís Carriço FCUL 2014/15 Sources: MS Kinect for Xbox 360 John C. Tang. Using Kinect to explore NUI, Ms Research, From Stanford CS247 Shotton et al. Real-Time

More information

2IMP25 Software Evolution. Code duplication. Alexander Serebrenik

2IMP25 Software Evolution. Code duplication. Alexander Serebrenik 2IMP25 Software Evolution Code duplication Alexander Serebrenik Assignments Assignment 1 Median 7, mean 6.87 My grades: 3-3-1-1-2-1-4 You ve done much better than me ;-) Clear, fair grading BUT tedious

More information

(2,4) Trees. 2/22/2006 (2,4) Trees 1

(2,4) Trees. 2/22/2006 (2,4) Trees 1 (2,4) Trees 9 2 5 7 10 14 2/22/2006 (2,4) Trees 1 Outline and Reading Multi-way search tree ( 10.4.1) Definition Search (2,4) tree ( 10.4.2) Definition Search Insertion Deletion Comparison of dictionary

More information