SlideShare a Scribd company logo
1 of 11
Static Analysis of Scala ProgramsStatic Analysis of Scala Programs
Himanshu Gupta
Knoldus Software LLP
Himanshu Gupta
Knoldus Software LLP
Topics CoveredTopics Covered
Overview
Motivation
Advantages
Disadvantages
Live Demo
Overview
Motivation
Advantages
Disadvantages
Live Demo
Static Analysis: Overview
● Static
– Performed at compile time, i.e., without executing the program
● Analysis
– Determination of interesting properties of the run-time behavior of the
program
● The goal is to
– Enable optimizations
– Find bugs, test, debug, ....
Static Analysis: Motivation ─
Optimization
The optimization:
x = 1 y = 1
y = x
is unsound if x is used in a later instruction:
x = 1
y = x y = 1
... ...
z = x z = x
Static Analysis: Motivation ─
Checking for Unreachable Code
def foo(x: Int): Int = { def bar(b: Boolean) {
return x if (b) { return }
x = x + 1 else { return }
x = x – 1 return
} }
We’d like to notify users about the above “ill-
formed” code.
Static Analysis: Motivation ─
Checking for Unused Vars.
def foo() = {
val x = 0
val y = 1
bar(y)
}
We’d like to notify users about the above
ill-formed code
Where to Perform Analysis?
● Static analysis may take place:
– at the source code level;
– at some intermediate level; or
– at the machine code level.
●
Static analysis may look at:
– basic blocks only;
– an entire function (intraprocedural); or
– the whole program (interprocedural).
●
The precision and cost of an analysis rises as we include more
information.
Advantages
● Makes Programs more efficient in terms of both,
Memory & Time.
● Increases the quality & reliability of code.
● Reduces the time spent by developers in tedious jobs
like regression testing, debugging, etc.
● Helps in developing platform independent S/Ws.
Disadvantages
● Extra effort has to be put to Static Analyzers for a
particular S/W.
● Increases the cost of development.
● Different tools for different languages and platforms.
– Eg :- Soot (for JVM based static code analysis only)
Live Demo
To run this Demo, follow these steps: -
1. Install Soot by following steps given on website
http://www.sable.mcgill.ca/soot/eclipse/updates/
2. Import Soot Libraries in your project by configuring Build Path
3. Download this project from :-
https://github.com/gupta-himanshu/static-analysis-scala
4. Run it as Java Application
ThanksThanks

More Related Content

What's hot

Valuable Information on Lexical Analysis in Compiler Design
Valuable Information on Lexical Analysis in Compiler DesignValuable Information on Lexical Analysis in Compiler Design
Valuable Information on Lexical Analysis in Compiler DesignLesa Cote
 
CMMi 4 techstaff
CMMi 4 techstaffCMMi 4 techstaff
CMMi 4 techstaffJean Pаoli
 
Algorithm and flowchart2010
Algorithm and flowchart2010Algorithm and flowchart2010
Algorithm and flowchart2010Jordan Delacruz
 
Guerrero rullan ppt
Guerrero rullan pptGuerrero rullan ppt
Guerrero rullan pptgeorge1616
 
Problem Solving Techniques and Introduction to C
Problem Solving Techniques and Introduction to CProblem Solving Techniques and Introduction to C
Problem Solving Techniques and Introduction to CPrabu U
 
Cmp104 lec 7 algorithm and flowcharts
Cmp104 lec 7 algorithm and flowchartsCmp104 lec 7 algorithm and flowcharts
Cmp104 lec 7 algorithm and flowchartskapil078
 
Logic Formulation 2
Logic Formulation 2Logic Formulation 2
Logic Formulation 2deathful
 
C program execution and algorithm
C program execution and algorithm C program execution and algorithm
C program execution and algorithm Kunal Pandhram
 
Designing multimedia
Designing multimediaDesigning multimedia
Designing multimediaGem WeBlog
 
FIT-Unit3 chapter 1 -computer program
FIT-Unit3 chapter 1 -computer programFIT-Unit3 chapter 1 -computer program
FIT-Unit3 chapter 1 -computer programraksharao
 
Algorithms and flowcharts
Algorithms and flowchartsAlgorithms and flowcharts
Algorithms and flowchartsSajib
 
Algorithm & flowchart
Algorithm & flowchartAlgorithm & flowchart
Algorithm & flowchartsaurabh sen sky
 

What's hot (20)

Qtp 101
Qtp 101Qtp 101
Qtp 101
 
LabVIEW: This Or That?
LabVIEW: This Or That?LabVIEW: This Or That?
LabVIEW: This Or That?
 
Valuable Information on Lexical Analysis in Compiler Design
Valuable Information on Lexical Analysis in Compiler DesignValuable Information on Lexical Analysis in Compiler Design
Valuable Information on Lexical Analysis in Compiler Design
 
algorithm
algorithmalgorithm
algorithm
 
Cd econtent link1
Cd econtent link1Cd econtent link1
Cd econtent link1
 
CMMi 4 techstaff
CMMi 4 techstaffCMMi 4 techstaff
CMMi 4 techstaff
 
Algorithm and flowchart2010
Algorithm and flowchart2010Algorithm and flowchart2010
Algorithm and flowchart2010
 
Guerrero rullan ppt
Guerrero rullan pptGuerrero rullan ppt
Guerrero rullan ppt
 
Next-gen Automation Framework
Next-gen Automation FrameworkNext-gen Automation Framework
Next-gen Automation Framework
 
Problem Solving Techniques and Introduction to C
Problem Solving Techniques and Introduction to CProblem Solving Techniques and Introduction to C
Problem Solving Techniques and Introduction to C
 
Cmp104 lec 7 algorithm and flowcharts
Cmp104 lec 7 algorithm and flowchartsCmp104 lec 7 algorithm and flowcharts
Cmp104 lec 7 algorithm and flowcharts
 
Logic Formulation 2
Logic Formulation 2Logic Formulation 2
Logic Formulation 2
 
Software Testing
Software TestingSoftware Testing
Software Testing
 
C program execution and algorithm
C program execution and algorithm C program execution and algorithm
C program execution and algorithm
 
Designing multimedia
Designing multimediaDesigning multimedia
Designing multimedia
 
Spiral Model
Spiral ModelSpiral Model
Spiral Model
 
FIT-Unit3 chapter 1 -computer program
FIT-Unit3 chapter 1 -computer programFIT-Unit3 chapter 1 -computer program
FIT-Unit3 chapter 1 -computer program
 
DISE - Programming Concepts
DISE - Programming ConceptsDISE - Programming Concepts
DISE - Programming Concepts
 
Algorithms and flowcharts
Algorithms and flowchartsAlgorithms and flowcharts
Algorithms and flowcharts
 
Algorithm & flowchart
Algorithm & flowchartAlgorithm & flowchart
Algorithm & flowchart
 

Similar to Knol x session

Life cycle models cccccccccccccccccccccccccccccccccccccccccccccccc.pdf
Life cycle models cccccccccccccccccccccccccccccccccccccccccccccccc.pdfLife cycle models cccccccccccccccccccccccccccccccccccccccccccccccc.pdf
Life cycle models cccccccccccccccccccccccccccccccccccccccccccccccc.pdfSohamChatterjee47
 
Software Development : Jeremy Gleason Iscope Digital
Software Development : Jeremy Gleason Iscope DigitalSoftware Development : Jeremy Gleason Iscope Digital
Software Development : Jeremy Gleason Iscope DigitalIscope Digital
 
agile with scrum methodology
agile with scrum methodology agile with scrum methodology
agile with scrum methodology rahul reddy
 
SE_Module1new.ppt
SE_Module1new.pptSE_Module1new.ppt
SE_Module1new.pptADARSHN40
 
SDLC models testing
SDLC models testingSDLC models testing
SDLC models testingJadavsejal
 
Matt Eakin - The New Tester Skillset
Matt Eakin - The New Tester SkillsetMatt Eakin - The New Tester Skillset
Matt Eakin - The New Tester SkillsetQA or the Highway
 
Software Development Life Cycle-SDLC
Software Development Life Cycle-SDLCSoftware Development Life Cycle-SDLC
Software Development Life Cycle-SDLCAdeel Rasheed
 
Software Testing - Day One
Software Testing - Day OneSoftware Testing - Day One
Software Testing - Day OneGovardhan Reddy
 
Agile Software Factory - Cloud Expo / DevOps Summit 2014 demo
Agile Software Factory - Cloud Expo / DevOps Summit 2014 demoAgile Software Factory - Cloud Expo / DevOps Summit 2014 demo
Agile Software Factory - Cloud Expo / DevOps Summit 2014 demoGrid Dynamics
 
TEST EXECUTION.ppt
TEST EXECUTION.pptTEST EXECUTION.ppt
TEST EXECUTION.pptChayapathiAR
 
HKG15-411: Browser Testing Framework for LHG
HKG15-411: Browser Testing Framework for LHGHKG15-411: Browser Testing Framework for LHG
HKG15-411: Browser Testing Framework for LHGLinaro
 
AdaCore Paris Tech Day 2016: Eric Perlade - Verification Solutions
AdaCore Paris Tech Day 2016: Eric Perlade - Verification SolutionsAdaCore Paris Tech Day 2016: Eric Perlade - Verification Solutions
AdaCore Paris Tech Day 2016: Eric Perlade - Verification Solutionsjamieayre
 
Software Development presentation basic only
Software Development presentation basic onlySoftware Development presentation basic only
Software Development presentation basic onlyAbhishekMishra498106
 
Manual testing by reddy
Manual testing by reddyManual testing by reddy
Manual testing by reddyKrishna Gurjar
 
Java Performance & Profiling
Java Performance & ProfilingJava Performance & Profiling
Java Performance & ProfilingIsuru Perera
 
The Extreme Programming (XP) Model
The Extreme Programming (XP) ModelThe Extreme Programming (XP) Model
The Extreme Programming (XP) ModelDamian T. Gordon
 

Similar to Knol x session (20)

2
22
2
 
2
22
2
 
Debugging
DebuggingDebugging
Debugging
 
Life cycle models cccccccccccccccccccccccccccccccccccccccccccccccc.pdf
Life cycle models cccccccccccccccccccccccccccccccccccccccccccccccc.pdfLife cycle models cccccccccccccccccccccccccccccccccccccccccccccccc.pdf
Life cycle models cccccccccccccccccccccccccccccccccccccccccccccccc.pdf
 
Software Development : Jeremy Gleason Iscope Digital
Software Development : Jeremy Gleason Iscope DigitalSoftware Development : Jeremy Gleason Iscope Digital
Software Development : Jeremy Gleason Iscope Digital
 
agile with scrum methodology
agile with scrum methodology agile with scrum methodology
agile with scrum methodology
 
SE_Module1new.ppt
SE_Module1new.pptSE_Module1new.ppt
SE_Module1new.ppt
 
Static code analysis
Static code analysisStatic code analysis
Static code analysis
 
SDLC models testing
SDLC models testingSDLC models testing
SDLC models testing
 
Matt Eakin - The New Tester Skillset
Matt Eakin - The New Tester SkillsetMatt Eakin - The New Tester Skillset
Matt Eakin - The New Tester Skillset
 
Software Development Life Cycle-SDLC
Software Development Life Cycle-SDLCSoftware Development Life Cycle-SDLC
Software Development Life Cycle-SDLC
 
Software Testing - Day One
Software Testing - Day OneSoftware Testing - Day One
Software Testing - Day One
 
Agile Software Factory - Cloud Expo / DevOps Summit 2014 demo
Agile Software Factory - Cloud Expo / DevOps Summit 2014 demoAgile Software Factory - Cloud Expo / DevOps Summit 2014 demo
Agile Software Factory - Cloud Expo / DevOps Summit 2014 demo
 
TEST EXECUTION.ppt
TEST EXECUTION.pptTEST EXECUTION.ppt
TEST EXECUTION.ppt
 
HKG15-411: Browser Testing Framework for LHG
HKG15-411: Browser Testing Framework for LHGHKG15-411: Browser Testing Framework for LHG
HKG15-411: Browser Testing Framework for LHG
 
AdaCore Paris Tech Day 2016: Eric Perlade - Verification Solutions
AdaCore Paris Tech Day 2016: Eric Perlade - Verification SolutionsAdaCore Paris Tech Day 2016: Eric Perlade - Verification Solutions
AdaCore Paris Tech Day 2016: Eric Perlade - Verification Solutions
 
Software Development presentation basic only
Software Development presentation basic onlySoftware Development presentation basic only
Software Development presentation basic only
 
Manual testing by reddy
Manual testing by reddyManual testing by reddy
Manual testing by reddy
 
Java Performance & Profiling
Java Performance & ProfilingJava Performance & Profiling
Java Performance & Profiling
 
The Extreme Programming (XP) Model
The Extreme Programming (XP) ModelThe Extreme Programming (XP) Model
The Extreme Programming (XP) Model
 

Recently uploaded

Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxpurnimasatapathy1234
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Serviceranjana rawat
 
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...RajaP95
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130Suhani Kapoor
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...Soham Mondal
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineeringmalavadedarshan25
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxpranjaldaimarysona
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Dr.Costas Sachpazis
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVRajaP95
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...ZTE
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxDeepakSakkari2
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile servicerehmti665
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingrakeshbaidya232001
 

Recently uploaded (20)

Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptx
 
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCRCall Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
 
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
 
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineering
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptx
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINEDJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
 
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptxExploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
 
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptx
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile service
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writing
 

Knol x session

  • 1. Static Analysis of Scala ProgramsStatic Analysis of Scala Programs Himanshu Gupta Knoldus Software LLP Himanshu Gupta Knoldus Software LLP
  • 2. Topics CoveredTopics Covered Overview Motivation Advantages Disadvantages Live Demo Overview Motivation Advantages Disadvantages Live Demo
  • 3. Static Analysis: Overview ● Static – Performed at compile time, i.e., without executing the program ● Analysis – Determination of interesting properties of the run-time behavior of the program ● The goal is to – Enable optimizations – Find bugs, test, debug, ....
  • 4. Static Analysis: Motivation ─ Optimization The optimization: x = 1 y = 1 y = x is unsound if x is used in a later instruction: x = 1 y = x y = 1 ... ... z = x z = x
  • 5. Static Analysis: Motivation ─ Checking for Unreachable Code def foo(x: Int): Int = { def bar(b: Boolean) { return x if (b) { return } x = x + 1 else { return } x = x – 1 return } } We’d like to notify users about the above “ill- formed” code.
  • 6. Static Analysis: Motivation ─ Checking for Unused Vars. def foo() = { val x = 0 val y = 1 bar(y) } We’d like to notify users about the above ill-formed code
  • 7. Where to Perform Analysis? ● Static analysis may take place: – at the source code level; – at some intermediate level; or – at the machine code level. ● Static analysis may look at: – basic blocks only; – an entire function (intraprocedural); or – the whole program (interprocedural). ● The precision and cost of an analysis rises as we include more information.
  • 8. Advantages ● Makes Programs more efficient in terms of both, Memory & Time. ● Increases the quality & reliability of code. ● Reduces the time spent by developers in tedious jobs like regression testing, debugging, etc. ● Helps in developing platform independent S/Ws.
  • 9. Disadvantages ● Extra effort has to be put to Static Analyzers for a particular S/W. ● Increases the cost of development. ● Different tools for different languages and platforms. – Eg :- Soot (for JVM based static code analysis only)
  • 10. Live Demo To run this Demo, follow these steps: - 1. Install Soot by following steps given on website http://www.sable.mcgill.ca/soot/eclipse/updates/ 2. Import Soot Libraries in your project by configuring Build Path 3. Download this project from :- https://github.com/gupta-himanshu/static-analysis-scala 4. Run it as Java Application