Department of Computer Science A Static Program Analyzer to increase software reuse Ramakrishnan Venkitaraman and Gopal Gupta.

Slides:



Advertisements
Similar presentations
Symbol Table.
Advertisements

Garbage collection David Walker CS 320. Where are we? Last time: A survey of common garbage collection techniques –Manual memory management –Reference.
Chapter 9 Code optimization Section 0 overview 1.Position of code optimizer 2.Purpose of code optimizer to get better efficiency –Run faster –Take less.
Architecture-dependent optimizations Functional units, delay slots and dependency analysis.
Data-Flow Analysis Framework Domain – What kind of solution is the analysis looking for? Ex. Variables have not yet been defined – Algorithm assigns a.
Programming Languages Marjan Sirjani 2 2. Language Design Issues Design to Run efficiently : early languages Easy to write correctly : new languages.
Programming Types of Testing.
Chapter 8 Runtime Support. How program structures are implemented in a computer memory? The evolution of programming language design has led to the creation.
Addressing Optimization for Loop Execution Targeting DSP with Auto-Increment/Decrement Architecture Wei-Kai Cheng Youn-Long Lin* Computer & Communications.
(Page 554 – 564) Ping Perez CS 147 Summer 2001 Alternative Parallel Architectures  Dataflow  Systolic arrays  Neural networks.
Multiscalar processors
Overview of program analysis Mooly Sagiv html://
C++ Programming: Program Design Including Data Structures, Fifth Edition Chapter 17: Linked Lists.
Programming Fundamentals (750113) Ch1. Problem Solving
Copyright © 2006 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill Technology Education Copyright © 2006 by The McGraw-Hill Companies,
5.3 Machine-Independent Compiler Features
Optimization software for apeNEXT Max Lukyanov,  apeNEXT : a VLIW architecture  Optimization basics  Software optimizer for apeNEXT  Current.
CMSC 345 Fall 2000 Unit Testing. The testing process.
COP4020 Programming Languages
CSC3315 (Spring 2009)1 CSC 3315 Programming Languages Hamid Harroud School of Science and Engineering, Akhawayn University
Chapter 12 Recursion, Complexity, and Searching and Sorting
Prepared By Ms.R.K.Dharme Head Computer Department.
The Functions of Operating Systems Interrupts. Learning Objectives Explain how interrupts are used to obtain processor time. Explain how processing of.
© 2011 Pearson Addison-Wesley. All rights reserved. Addison Wesley is an imprint of Stewart Venit ~ Elizabeth Drake Developing a Program.
C++ History C++ was designed at AT&T Bell Labs by Bjarne Stroustrup in the early 80's Based on the ‘C’ programming language C++ language standardised in.
Static Program Analysis of Embedded Software Ramakrishnan Venkitaraman Graduate Student, Computer Science Advisor: Dr. Gopal Gupta.
Static Program Analyses of DSP Software Systems Ramakrishnan Venkitaraman and Gopal Gupta.
1.  10% Assignments/ class participation  10% Pop Quizzes  05% Attendance  25% Mid Term  50% Final Term 2.
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Memory: Relocation.
Static Program Analysis of Embedded Software Ramakrishnan Venkitaraman Graduate Student, Computer Science Advisor: Dr. Gopal Gupta
CMP-MX21: Lecture 5 Repetitions Steve Hordley. Overview 1. Repetition using the do-while construct 2. Repetition using the while construct 3. Repetition.
1 Compiler Design (40-414)  Main Text Book: Compilers: Principles, Techniques & Tools, 2 nd ed., Aho, Lam, Sethi, and Ullman, 2007  Evaluation:  Midterm.
Java Basics Hussein Suleman March 2007 UCT Department of Computer Science Computer Science 1015F.
CSCI1600: Embedded and Real Time Software Lecture 33: Worst Case Execution Time Steven Reiss, Fall 2015.
CS212: Object Oriented Analysis and Design Lecture 19: Exception Handling.
Pointers. Variable Declarations Declarations served dual purpose –Specification of range of values and operations –Specification of Storage requirement.
TM Design Macro Language D and SD MA/CSSE 474 Theory of Computation.
CS412/413 Introduction to Compilers Radu Rugina Lecture 18: Control Flow Graphs 29 Feb 02.
1 Control Flow Graphs. 2 Optimizations Code transformations to improve program –Mainly: improve execution time –Also: reduce program size Can be done.
2/22/2016© Hal Perkins & UW CSEP-1 CSE P 501 – Compilers Register Allocation Hal Perkins Winter 2008.
Static Analysis of Executable Assembly Code to Ensure QA and Reuse Ramakrishnan Venkitaraman Graduate Student, Research Track Computer Science, UT-Dallas.
1 Asstt. Prof Navjot Kaur Computer Dept PRESENTED BY.
Flow Control in Imperative Languages. Activity 1 What does the word: ‘Imperative’ mean? 5mins …having CONTROL and ORDER!
Presented by : A best website designer company. Chapter 1 Introduction Prof Chung. 1.
Framework for Safe Reuse Of Software Binaries Ramakrishnan Venkitaraman Advisor: Gopal Gupta The University of Texas at Dallas 11/15/2004.
Analyzing and Transforming Binary Code (for Fun & Profit) Gopal Gupta R. Venkitaraman, R. Reghuramalingam The University of Texas at Dallas 11/15/2004.
CS223: Software Engineering Lecture 26: Software Testing.
1 Chapter10: Code generator. 2 Code Generator Source Program Target Program Semantic Analyzer Intermediate Code Generator Code Optimizer Code Generator.
Compilers Principles, Techniques, & Tools Taught by Jing Zhang
Invitation to Computer Science 6th Edition
Code Optimization.
Chapter 1 Introduction.
Definition CASE tools are software systems that are intended to provide automated support for routine activities in the software process such as editing.
CS 3304 Comparative Languages
SOFTWARE DESIGN AND ARCHITECTURE
DATA STRUCTURES AND OBJECT ORIENTED PROGRAMMING IN C++
Chapter 1 Introduction.
CSCI1600: Embedded and Real Time Software
Programming Fundamentals (750113) Ch1. Problem Solving
Programming Fundamentals (750113) Ch1. Problem Solving
Processor Fundamentals
Test Case Test case Describes an input Description and an expected output Description. Test case ID Section 1: Before execution Section 2: After execution.
Programming Fundamentals (750113) Ch1. Problem Solving
Programming Fundamentals (750113) Ch1. Problem Solving
Course Overview PART I: overview material PART II: inside a compiler
Compilers Principles, Techniques, & Tools Taught by Jing Zhang
TARGET CODE GENERATION
CSE P 501 – Compilers SSA Hal Perkins Autumn /31/2019
CSCI1600: Embedded and Real Time Software
Software Testing and QA Theory and Practice (Chapter 5: Data Flow Testing) © Naik & Tripathy 1 Software Testing and Quality Assurance Theory and Practice.
Presentation transcript:

Department of Computer Science A Static Program Analyzer to increase software reuse Ramakrishnan Venkitaraman and Gopal Gupta

Source: Data and Analysis center for Software Cost of software always on the rise

Why do we need a software standard? Lack of software reuse because of lack of software standards Non availability of a rich set of COTS components Time to market new products measured in years rather than months Incompatibilities make integration of software from multiple vendors impossible The discussion refers mainly to DSP software but the problems are comparable to any software development process

TI TMS320 DSP Algorithm Standard Contains 34 rules and 15 guidelines Intended to enable a rich set of COTS marketplace and significantly reduce the time to market for new products Will allow system integrators to integrate compliant algorithms from multiple vendors into a single system Reduces time to market, increases software quality and software reuse

General Programming Rules No tool currently exists to check for compliance Programs must be relocatable No hard coded data memory locations No hard coded program memory locations Programs must be reusable Algorithms must be re-entrant

Hard Coded Addresses Generally a bad programming practice unless you are programming for device drivers Results in non relocatable code Results in non reusable code A pointer variable is said to be NOT hard coded if a) If the address is derived from a call to memory allocation routines like “malloc” or “calloc” b) If the address is derived as a function of the “stack pointer” c) If the address is derived from another pointer that is legitimate.

Static Program Analysis Static program analysis (or static analysis for brevity) is defined as any analysis of a program carried out without completely executing the program The traditional data-flow analysis found in compiler back-ends is an example of static analysis Another example of static analysis is abstract interpretation, in which a program's data and operations are approximated and the program abstractly executed

Basic Blocks and Flow Graphs A “Basic Block” is a sequence of consecutive statements in which flow of control enters at the beginning and leaves at the end without halting or possibility of branching except at the end. The basic blocks form the nodes in a directed graph called the “Control Flow-Graph”. This graph will help us to visualize and arrive at all possible paths through which program control could flow at runtime. All such paths must be analyzed for compliance.

Overview of our approach Input: Object Code of the algorithm Output: Compliant / Not Compliant status Activity Diagram for our Static Analyzer

Our Algorithm for Static Analysis 1) Get the disassembled code from the input object code 2) From the disassembled code, get the basic blocks and construct the flow-graph 3) Analyze the flow-graph and check for the dereferencing of pointer variables 4) For each such dereferencing, scan back and find out from where did this pointer get its value from (involves the formation of unsafe sets which are explained later) If the original source of this pointer is hard coded, then declare that the algorithm is not compliant (“unsafe") If the original source from of this pointer is legitimate then declare that dereferencing is safe 5) The algorithm is declared to be safe if and only if all such pointer dereferencing are safe

Phases in Static Analysis of the Flow Graph  Phase 1: The analyzer detects statements in the disassembled code which correspond to the dereferencing of pointer variables by scanning downwards in the flow graph  Phase 2: The analyzer checks whether any dereferencing detected in phase 1 is safe by scanning upwards in the flow graph

Building Unsafe Sets “Unsafe Set” is the set of registers which may potentially contain hard coded references First element is added to the unsafe set when phase 1 detects dereferencing of a pointer Example: If we find “ *Reg ” in the analyzed code, the unsafe set is initialized to {*Reg} Note: Most Examples used in the presentation use the ‘C’ programming language for easy understanding while the real analysis is done at the Assembly Language level.

Building unsafe sets (continued) Phase 2 populates the equivalence set by “scanning backwards” For example if we find Reg = Reg1 + Reg2, the element “Reg” is deleted from the unsafe set and the elements “Reg1” and “Reg2” are inserted into the unsafe set Contents of the unsafe set will now become {Reg1, Reg2} Now we scan backwards searching for both “Reg1” and “Reg2” in this case

Analysis Stops when… All pointer dereferencing in the program are declared to be “safe” (not hard coded) OR At least one of the pointer dereferencing in the program is declared to be “unsafe” (hard coded)

Handling Loops Complex because the number of iterations of the loop may not be known until runtime We scan and cycle through the loop until the unsafe set reaches a “Fixed Point” A Fixed Point is reached when The unsafe set repeats itself at the same point in the loop during successive iterations No new information is added to the unsafe set during successive iterations

Handling Function Calls Similar to a Branch statement Marks the beginning and end of basic blocks Recursive function calls are handled as if they were looping constructs

Handling Parallelism The || characters signify that an instruction is to execute in parallel with the previous instruction Instructions A, B, C are executed in parellel Example Instruction A || Instruction B || Instruction C Handle/Skip parallel instructions encountered during phase 2 until an instruction in the previous cycle is found

Current Work Current work includes fine tuning the handling of loops and extending our system for the remaining rules The development and testing of the tool is currently in progress The system is being developed using the ‘C’ programming language

Related Work and Conclusion Compared to Dynamic Analysis, Static Analysis can give correct results for a larger set of cases because of the very nature of the analysis Our work so far can be regarded as an attempt to demonstrate the efficacy of static analysis to perform these checks and aid in software reuse

References Ramakrishnan Venkitaraman and Gopal Gupta, “Static Program Analysis to Detect Hard Coded Addresses and its Application to TI's DSP Processor”, CS department technical report UTD CS For More information, contact

Questions……….