1 / 39

Detecting and Characterizing Semantic Inconsistencies in Ported Code

Baishakhi Ray * , Miryung Kim * , Suzette Person + , Neha Rungta !. Detecting and Characterizing Semantic Inconsistencies in Ported Code . * The University of Texas at Austin + NASA Langley Research Center ! NASA Ames Research Center . Motivation.

heidi
Download Presentation

Detecting and Characterizing Semantic Inconsistencies in Ported Code

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Baishakhi Ray*, Miryung Kim*, Suzette Person+, Neha Rungta! Detecting and Characterizing Semantic Inconsistencies in Ported Code * The University of Texas at Austin + NASA Langley Research Center ! NASA Ames Research Center

  2. Motivation • Port code from a reference to a target implementation. [Ray et al., Al-Ekramet al., Kim et al.] • Adapt ported changes to fit the target context. [Kim et al.] • Faulty adaptation often leads to porting-error. [Chou et al., Juergenset al., Li et al., Jiang et al.]. target reference

  3. Outline • Empirical study of porting errors • Classification scheme for porting errors • SPA: Semantic Porting Analysis • Evaluation • Conclusion

  4. How are porting errors introduced? Reference: ExportMemoryDialog.java if(!containsKey(IMemoryExporter)) setProperty(IMemoryExporter); Original Target: ImportMemoryDialog.java if(!containsKey(IMemoryExporter)) setProperty(IMemoryExporter); porting Fixed Target: ImportMemoryDialog.java if(!containsKey(IMemoryImporter)) setProperty(IMemoryImporter); fix

  5. Study Methodology Reference: ExportMemoryDialog.java if(!containsKey(IMemoryExporter)) setProperty(IMemoryExporter); Repertoire [Ray et al.] Original Target: ImportMemoryDialog.java if(!containsKey(IMemoryExporter)) setProperty(IMemoryExporter); git blame Fixed Target: ImportMemoryDialog.java Log:Fixcopy&pasteerror in last commit if(!containsKey(IMemoryImporter)) setProperty(IMemoryImporter);

  6. Empirical Study of Porting Errors Developers frequently introduce porting errors in the codebase.

  7. Outline • Empirical study of porting errors • Classification scheme for porting errors • SPA: Semantic Porting Analysis • Evaluation • Conclusion

  8. Inconsistent Control Flow

  9. Inconsistent Identifier Renamings

  10. Inconsistent Renamings of Related Identifiers

  11. Inconsistent Data Flow

  12. Redundant Operation

  13. Distribution of Porting Errors

  14. Outline • Empirical study of porting errors • Classification scheme for porting errors • SPA: Semantic Porting Analysis • Evaluation • Conclusion

  15. SPA Overview • Input: Reference and Target patches • Analyze the semantic differences between ported edits in reference and target context. • Output: Types of potential porting inconsistencies

  16. Motivating Example

  17. 1. Identify Edited Nodes Target Reference method_decl method_decl F T if (flags == 3) ret err ret err + cnt = .. + size = .. + err = .. ret 0 err = .. + if (size) + cnt = .. + size = .. + err = .. T + buf = ..

  18. 2. Compute Ported Nodes Reference Target method_decl method_decl if (flags == 3) + cnt = .. + size = .. + err = .. F ret err T ret 0 ret err + cnt = .. + size = .. + err = .. err = .. + if (size) T + buf = ..

  19. 3. Detect Impacted Nodes Reference Target method_decl method_decl if (flags == 3) + cnt = .. + size = .. + err = .. F ret err T ret 0 ret err + cnt = .. + size = .. + err = .. err = .. + if (size) T + buf = ..

  20. 4. Find Inconsistent Control Flow Reference Target method_decl method_decl if (flags == 3) + cnt = .. + size = .. + err = .. ret err F T ret 0 ret err + cnt = .. + size = .. + err = .. err = .. + if (size) T + buf = ..

  21. 4. Find Inconsistent Control Flow

  22. 5. Detect Inconsistent Renamings Target Reference method_decl method_decl if (flags == 3) F + cnt = .. + size = .. + err = .. ret err T ret 0 ret err • - R2. size = cnt + size(ostatfs); • - T3. size = cnt + size(stat); • - R1. cnt= bufsize /size(ostatfs); • - T2. cnt= bufsize / size(ostatfs); + cnt = .. + size = .. + err = .. err = .. + if (size) T + buf = ..

  23. 5. Detect Inconsistent Renamings

  24. 6. Identify Inconsistent Data Flow Reference Target method_decl method_decl if (flags == 3) + cnt = .. + size = .. + err = .. F ret err T ret 0 ret err + cnt = .. + size = .. + err = .. err = .. + if (size) T + buf = ..

  25. 6. Identify Inconsistent Data Flow

  26. 7. Detect Redundant Operation Target method_decl if (flags == 3) F T ret 0 ret err + cnt = .. + size = .. + err = copy() err = copy() + if (size) T + buf = ..

  27. 7. Detect Redundant Operation

  28. Outline • Empirical study of porting errors • Classification scheme for porting errors • SPA: Semantic Porting Analysis • Evaluation • Conclusion

  29. Evaluation • RQ1. Can SPA accurately detectporting inconsistencies? • RQ2. Can SPA accurately categorizeporting inconsistencies? Implementation • Java static analysis framework • Extends LASE, Sydit[Meng et al], and uses Crystal [Aldrich et al]

  30. RQ1. Can SPA accurately detectporting inconsistencies? SPA correctly reports No Inconsistency ✔ SPA incorrectly reports Inconsistency ✖

  31. RQ1. Can SPA accurately detectporting inconsistencies? SPA detects inconsistencies with 65% to 73% precision and 90% recall.

  32. RQ1. Can SPA accurately detectporting inconsistencies? SPA improves precision by 14 to 17 percentage points w.r.t. earlier tools.

  33. RQ2. Can SPA accurately categorizeporting inconsistencies?

  34. RQ2. Can SPA accurately categorizeporting inconsistencies? SPA incorrectly reports as Inconsistent data flow. ✖

  35. RQ2. Can SPA accurately categorizeporting inconsistencies? SPA categorizes inconsistencies with 58% to 63% precision and 92% to 100% recall.

  36. Summary • Study different types of porting errors in practice. • Detect and categorize potential porting errors successfully. Future Work • Integrate SPA with an integrated development environment (IDE). • Investigate other complementary approaches to detect porting errors.

  37. Baishakhi Ray*, Miryung Kim*, Suzette Person+, Neha Rungta! Detecting and Characterizing Semantic Inconsistencies in Ported Code * The University of Texas at Austin + NASA Langley Research Center ! NASA Ames Research Center

  38. Acknowledgement We thank Na Meng for the discussions and help to design and implement SPA. Google Summer Code 2012. Supported by National Science Foundation grants: CCF- 1149391, CCF-1117902, SHF-0910818, and CNS-1239498.

  39. RQ1. Can SPA accurately detectporting inconsistencies? SPA detects inconsistencies with 65% to 73% precision and 90% recall. SPA improves precision by 14 to 17 percentage points w.r.t. earlier tools.

More Related