8

Soot for dummies

Embed Size (px)

DESCRIPTION

Introduction to Soot, a Framework for analysing, transforming and optimising Java programs.

Citation preview

Page 1: Soot for dummies
Page 2: Soot for dummies

Soot

I Framework for analysis, transformation and optimization ofJava programs

I Support for both intra-procedural and inter-procedural

I Many built-in analyses and optimizations are available

I Provides intermediate representations of Java codeI Jimple, Shimple, Baf, Grimp

1 / 7

Page 3: Soot for dummies

Jimple

Main intermediate representation used in Soot.

Key characteristics:

I Stackless, typed 3-address code

I Simplified set of instructions

I Suitable for analysis and optimization

2 / 7

Page 4: Soot for dummies

From Java to Jimple: Example

3 / 7

Page 5: Soot for dummies

Processing of Java classes via Soot

1. Parsing Java sources or class files into Jimple IR2. Processing of various IRs in several phases

Figura : Intra-procedural execution flow

4 / 7

Page 6: Soot for dummies

Using data-flow framework

A checklist of your obligations:

1. Subclass*FlowAnalysisI ForwardFlowAnalysisI BackwardFlowAnalysisI ForwardBranchedFlowAnalysis

2. Implement abstraction: merge(), copy()

3. Implement flow function: flowThrough()

4. Implement initial values: newInitialFlow() andentryInitialFlow()

5. Implement constructor (it must call doAnalysis())

5 / 7

Page 7: Soot for dummies

Using data-flow framework:TrulyLiveVariables

6 / 7

Page 8: Soot for dummies

Soot for dummies

Leandro Lera Romero

1Departamento de ComputacionFacultad de Ciencias Exactas y Naturales

Universidad de Buenos Aires

5 de agosto de 2013