SlideShare a Scribd company logo
1 of 52
Download to read offline
Exploiting linearity in sharing analysis of object-oriented
programs
Gianluca Amato
Universit`a di Chieti–Pescara
Pescara, Italy
16th Italian Conference on Theoretical Computer Science
ICTCS 2015, 9-11 September 2015, Firenze
(joint work with M. C. Meo and F. Scozzari)
Gianluca Amato Sharing and linearity ICTCS 2015 1 / 27
Overview
Context
Data-flow analysis
Abstract interpretation
Pointer analysis
Plan of the talk
1 Sharing analysis
2 Adding linearity
3 Adding information for fields
4 The domain of ALPs-graphs
5 Conclusion
Gianluca Amato Sharing and linearity ICTCS 2015 2 / 27
Overview
Context
Data-flow analysis
Abstract interpretation
Pointer analysis
Plan of the talk
1 Sharing analysis
2 Adding linearity
3 Adding information for fields
4 The domain of ALPs-graphs
5 Conclusion
Gianluca Amato Sharing and linearity ICTCS 2015 3 / 27
Sharing analysis
Sharing analysis aims to determine variables which are be bound to
overlapping data structures at execution time.
Example
class Tree {
Tree left;
Tree right
}
T a = new Tree ();
T b = new Tree ();
a.right = new Tree ();
b.right = a.right;
Heap
a b
At the end of this program,
variables a and b share.
Gianluca Amato Sharing and linearity ICTCS 2015 4 / 27
Possible pair-sharing analysis
We represent sharing information with a set of unordered pairs of variables
in scope. A pair (a,b) means that a and b may share during execution.
Formalized by Spoto & Secci, SAS 2005.
Example
{}
Tree a = new Tree ();
Tree b = new Tree ();
a.right = new Tree ();
b.right = a.right;
Gianluca Amato Sharing and linearity ICTCS 2015 5 / 27
Possible pair-sharing analysis
We represent sharing information with a set of unordered pairs of variables
in scope. A pair (a,b) means that a and b may share during execution.
Formalized by Spoto & Secci, SAS 2005.
Example
{}
Tree a = new Tree ();
{(a,a)} a may be not null
Tree b = new Tree ();
a.right = new Tree ();
b.right = a.right;
Gianluca Amato Sharing and linearity ICTCS 2015 5 / 27
Possible pair-sharing analysis
We represent sharing information with a set of unordered pairs of variables
in scope. A pair (a,b) means that a and b may share during execution.
Formalized by Spoto & Secci, SAS 2005.
Example
{}
Tree a = new Tree ();
{(a,a)} a may be not null
Tree b = new Tree ();
{(a,a),(b,b)} a and b may be not null
a.right = new Tree ();
b.right = a.right;
Gianluca Amato Sharing and linearity ICTCS 2015 5 / 27
Possible pair-sharing analysis
We represent sharing information with a set of unordered pairs of variables
in scope. A pair (a,b) means that a and b may share during execution.
Formalized by Spoto & Secci, SAS 2005.
Example
{}
Tree a = new Tree ();
{(a,a)} a may be not null
Tree b = new Tree ();
{(a,a),(b,b)} a and b may be not null
a.right = new Tree ();
{(a,a),(b,b)} a and b may be not null
b.right = a.right;
Gianluca Amato Sharing and linearity ICTCS 2015 5 / 27
Possible pair-sharing analysis
We represent sharing information with a set of unordered pairs of variables
in scope. A pair (a,b) means that a and b may share during execution.
Formalized by Spoto & Secci, SAS 2005.
Example
{}
Tree a = new Tree ();
{(a,a)} a may be not null
Tree b = new Tree ();
{(a,a),(b,b)} a and b may be not null
a.right = new Tree ();
{(a,a),(b,b)} a and b may be not null
b.right = a.right;
{(a,a),(b,b),(a,b)} a and b may be not null, a and b may share
Gianluca Amato Sharing and linearity ICTCS 2015 5 / 27
Other kind of pointer analysis
Points-to analysis
Relates a variable with the possible locations it may points. Locations are
generally identified by occurrences of a new instruction.
If two variables may point to the same location they may share.
Alias analysis
Determines whether two variable points to the same location.
If two variables are aliases they share.
Reachability anaysis
Determines whether from a variable a it is possible to reach the location
pointed to by variable b.
If a → b, then and b share
Gianluca Amato Sharing and linearity ICTCS 2015 6 / 27
Overview
Context
Data-flow analysis
Abstract interpretation
Pointer analysis
Plan of the talk
1 Sharing analysis
2 Adding linearity
3 Adding information for fields
4 The domain of ALPs-graphs
5 Conclusion
Gianluca Amato Sharing and linearity ICTCS 2015 7 / 27
The need for linearity
Example (Creating List)
// create a list of length n>0
Tree create_list(int n) {
Tree head = new Tree ();
Tree current = head;
while (n>0) {
current.left = new Tree ();
current.right = new Tree ();
current = current.right;
n = n-1;
}
return head;
}
Heap
head current
Gianluca Amato Sharing and linearity ICTCS 2015 8 / 27
The need for linearity (2)
We would like to prove that a1, a2 and a3 do not share.
It is obvious reasoning on the concrete heap.
Example (Using List)
// extract first 3 elements
Tree list = create_list (5);
Tree a1 = list.left
list = list.right
Tree a2 = list.left
list = list.right
Tree a3 = list.left
Heap
lista1a2a3
Gianluca Amato Sharing and linearity ICTCS 2015 9 / 27
The need for linearity (2)
We would like to prove that a1, a2 and a3 do not share.
It is obvious reasoning on the concrete heap.
Example (Using List)
// extract first 3 elements
Tree list = create_list (5);
Tree a1 = list.left
list = list.right
Tree a2 = list.left
list = list.right
Tree a3 = list.left
Heap
lista1a2a3
Gianluca Amato Sharing and linearity ICTCS 2015 9 / 27
The need for linearity (2)
We would like to prove that a1, a2 and a3 do not share.
It is obvious reasoning on the concrete heap.
Example (Using List)
// extract first 3 elements
Tree list = create_list (5);
Tree a1 = list.left
list = list.right
Tree a2 = list.left
list = list.right
Tree a3 = list.left
Heap
lista1a2a3
Gianluca Amato Sharing and linearity ICTCS 2015 9 / 27
The need for linearity (2)
We would like to prove that a1, a2 and a3 do not share.
It is obvious reasoning on the concrete heap.
Example (Using List)
// extract first 3 elements
Tree list = create_list (5);
Tree a1 = list.left
list = list.right
Tree a2 = list.left
list = list.right
Tree a3 = list.left
Heap
lista1a2a3
Gianluca Amato Sharing and linearity ICTCS 2015 9 / 27
The need for linearity (3)
Only sharing information at the level of variables.
Example (Analysis of the main program)
{}
Tree list = create_list (5);
Possile concretization
list
Possile (bad) concretization
list
Gianluca Amato Sharing and linearity ICTCS 2015 10 / 27
The need for linearity (3)
Only sharing information at the level of variables.
Example (Analysis of the main program)
{}
Tree list = create_list (5);
{(list, list)}
Possile concretization
list
Possile (bad) concretization
list
Gianluca Amato Sharing and linearity ICTCS 2015 10 / 27
The need for linearity (3)
Only sharing information at the level of variables.
Example (Analysis of the main program)
{}
Tree list = create_list (5);
{(list, list)}
Possile concretization
list
Possile (bad) concretization
list
Gianluca Amato Sharing and linearity ICTCS 2015 10 / 27
The need for linearity (3)
Only sharing information at the level of variables.
Example (Analysis of the main program)
{}
Tree list = create_list (5);
{(list, list)}
Possile concretization
list
Possile (bad) concretization
list
Gianluca Amato Sharing and linearity ICTCS 2015 10 / 27
Linearity
Definition (Linearity)
A variable v is non-linear if there is a location which is reachable from v
following two different chains of field.
Linear heap
list
Non-linear heap
list
Complex heap
a b
Gianluca Amato Sharing and linearity ICTCS 2015 11 / 27
Analysis with linearity
sh lin: sh is the sharing information and lin a set of linear variables.
Example (Analysis of the main program)
{}
Tree list = create_list (5);
Possile concretization
list
Possile (bad) concretization
list
Gianluca Amato Sharing and linearity ICTCS 2015 12 / 27
Analysis with linearity
sh lin: sh is the sharing information and lin a set of linear variables.
Example (Analysis of the main program)
{}
Tree list = create_list (5);
{(list, list)} {list}
Possile concretization
list
Possile (bad) concretization
list
Gianluca Amato Sharing and linearity ICTCS 2015 12 / 27
Analysis with linearity
sh lin: sh is the sharing information and lin a set of linear variables.
Example (Analysis of the main program)
{}
Tree list = create_list (5);
{(list, list)} {list}
Possile concretization
list
Possile (bad) concretization
list
Gianluca Amato Sharing and linearity ICTCS 2015 12 / 27
Overview
Context
Data-flow analysis
Abstract interpretation
Pointer analysis
Plan of the talk
1 Sharing analysis
2 Adding linearity
3 Adding information for fields
4 The domain of ALPs-graphs
5 Conclusion
Gianluca Amato Sharing and linearity ICTCS 2015 13 / 27
The need for fields (1)
Example (Analysis with fields)
{}
Tree list = create_list (5);
{(list, list)} {list}
Tree a1 = list.left
Good concretization
lista1
Bad concretization
lista1
Gianluca Amato Sharing and linearity ICTCS 2015 14 / 27
The need for fields (1)
Example (Analysis with fields)
{}
Tree list = create_list (5);
{(list, list)} {list}
Tree a1 = list.left
{(a1, a1), (list, list), (a1, list)} {list, a1}
Good concretization
lista1
Bad concretization
lista1
Gianluca Amato Sharing and linearity ICTCS 2015 14 / 27
The need for fields (1)
Example (Analysis with fields)
{}
Tree list = create_list (5);
{(list, list)} {list}
Tree a1 = list.left
{(a1, a1), (list, list), (a1, list)} {list, a1}
Good concretization
lista1
Bad concretization
lista1
Gianluca Amato Sharing and linearity ICTCS 2015 14 / 27
The need for fields (2)
Example
{}
Tree list = create_list (5);
Tree a1 = list.left
Good concretization
lista1
Bad concretization
lista1
Gianluca Amato Sharing and linearity ICTCS 2015 15 / 27
The need for fields (2)
Example
{}
Tree list = create_list (5);
{(list, list), (list.left, list.left), (list.right, list.right)} {list}
Tree a1 = list.left
Good concretization
lista1
Bad concretization
lista1
Gianluca Amato Sharing and linearity ICTCS 2015 15 / 27
The need for fields (2)
Example
{}
Tree list = create_list (5);
{(list, list), (list.left, list.left), (list.right, list.right)} {list}
Tree a1 = list.left
{(a1, a1), (list.left, a1), (list, a1), (list, list), (list.left, list.left),
(list.right, list.right)} {list, a1}
Good concretization
lista1
Bad concretization
lista1
Gianluca Amato Sharing and linearity ICTCS 2015 15 / 27
The need for fields (3)
Example
{}
Tree list = create_list (5);
{(list, list), (list.left, list.left), (list.right, list.right)} {list}
Tree a1 = list.left
{(a1,a1), (list.left, a1), (list, a1), (list, list), (list.left, list.left),
(list.right, list.right)} {list, a1}
list = list.right
We have done it!
list.left and list.right do not share because list is linear.
same abstract information we had after create list. . .
we can iterate without losing information
Gianluca Amato Sharing and linearity ICTCS 2015 16 / 27
The need for fields (3)
Example
{}
Tree list = create_list (5);
{(list, list), (list.left, list.left), (list.right, list.right)} {list}
Tree a1 = list.left
{(a1,a1), (list.left, a1), (list, a1), (list, list), (list.left, list.left),
(list.right, list.right)} {list, a1}
list = list.right
{(a1, a1), (list, list), (list.left, list.left), (list.right, list.right)}
{list, a1}
We have done it!
list.left and list.right do not share because list is linear.
same abstract information we had after create list. . .
we can iterate without losing information
Gianluca Amato Sharing and linearity ICTCS 2015 16 / 27
Overview
Context
Data-flow analysis
Abstract interpretation
Pointer analysis
Plan of the talk
1 Sharing analysis
2 Adding linearity
3 Adding information for fields
4 The domain of ALPs-graphs
5 Conclusion
Gianluca Amato Sharing and linearity ICTCS 2015 17 / 27
The domain of ALPs-graphs
Instead of keeping aliasing, sharing and linearity information as separate
entities, we encode them in an ALPs-graph.
Heap
a b c
Abstraction
a bc
left right right
Gianluca Amato Sharing and linearity ICTCS 2015 18 / 27
Operators
An extract from the definition of abstract operators:
SCI
τ v:=exp (G) = prune((N E [v → (res), res → ⊥]) sh nl )
SCI
τ v.f:=exp (G) =



⊥ if (v) = ⊥
cl(prune((N ∪ Nnew E  Edel ∪ Enew [res → ⊥])
sh ∪ shnew nl ∪ {n (x) | n (x) ∈ Nnew , (x.f) ∈ nl }))
if (v) = ⊥ and (res) = ⊥
cl(prune((N ∪ Nnew E  Edel ∪ Enew [res → ⊥])
sh ∪ shnew nl ∪ nlnew ∪ {n (x) | n (x) ∈ Nnew , (x.f) ∈ nl }))
otherwise
SCI
τ
if v = null
then com1 else com2
(G) =
SCI
τ com1 (G) if (v) = ⊥
SCI
τ com1 (G|v=null) SCI
τ com2 (G) otherwise
SCI
τ
if v = w
then com1 else com2
(G) =
SCI
τ com1 (G) if (v) = (w)
SCI
τ com1 (G|v=w ) SCI
τ com2 (G) otherwise
SCI
τ {com1; . . . ; comp} = (λs ∈ ALPsτ .s) ◦ SCI
τ comp ◦ · · · ◦ SCI
τ com1
Gianluca Amato Sharing and linearity ICTCS 2015 19 / 27
Restriction to null
Program code
// G1
if (v == null) {
// G2
cmd
Question: How do we obtain G2 from G1?
Answer: We delete the node labeled by v and
all its descendants.
Example (G1)
a b v
left right right
left
Example (G2)
a
left right
Gianluca Amato Sharing and linearity ICTCS 2015 20 / 27
Restriction to null
Program code
// G1
if (v == null) {
// G2
cmd
Question: How do we obtain G2 from G1?
Answer: We delete the node labeled by v and
all its descendants.
Example (G1)
a b v
left right right
left
Example (G2)
a
left right
Gianluca Amato Sharing and linearity ICTCS 2015 20 / 27
Field Assignment
Program code
// G1
v.right = null
// G2
Question: How do we obtain G2 from G1?
Answer: Delete arrow from v labeled by
right... but consider possible aliases
of v
Example (G1)
a v
left right right
left
Example (G2 incorrect)
a v
left right
left
Gianluca Amato Sharing and linearity ICTCS 2015 21 / 27
Field Assignment
Program code
// G1
v.right = null
// G2
Question: How do we obtain G2 from G1?
Answer: Delete arrow from v labeled by
right... but consider possible aliases
of v
Example (G1)
a v
left right right
left
Example (G2 incorrect)
a v
left right
left
Gianluca Amato Sharing and linearity ICTCS 2015 21 / 27
Field Assignment
Program code
// G1
v.right = null
// G2
Question: How do we obtain G2 from G1?
Answer: Delete arrow from v labeled by
right... but consider possible aliases
of v
Example (G1)
a v
left right right
left
Example (G2 correct)
a v
left right
left
Gianluca Amato Sharing and linearity ICTCS 2015 21 / 27
Overview
Context
Data-flow analysis
Abstract interpretation
Pointer analysis
Plan of the talk
1 Sharing analysis
2 Adding linearity
3 Adding information for fields
4 The domain of ALPs-graphs
5 Conclusion
Gianluca Amato Sharing and linearity ICTCS 2015 22 / 27
What we have done
Formally define ALPs graphs
a Galois connection with the powerset of concrete heaps
using concrete heap as formalized in [Secci & Spoto 05]
Define abstract operators needed to analyze Java code
on the concrete semantics defined in [Secci & Spoto 05]
Prove correctness of these operators
Gianluca Amato Sharing and linearity ICTCS 2015 23 / 27
What we have done
Formally define ALPs graphs
a Galois connection with the powerset of concrete heaps
using concrete heap as formalized in [Secci & Spoto 05]
Define abstract operators needed to analyze Java code
on the concrete semantics defined in [Secci & Spoto 05]
Prove correctness of these operators
Gianluca Amato Sharing and linearity ICTCS 2015 23 / 27
What we have done
Formally define ALPs graphs
a Galois connection with the powerset of concrete heaps
using concrete heap as formalized in [Secci & Spoto 05]
Define abstract operators needed to analyze Java code
on the concrete semantics defined in [Secci & Spoto 05]
Prove correctness of these operators
Gianluca Amato Sharing and linearity ICTCS 2015 23 / 27
Todo
Experimental evaluation
developing an implementation in our static analyzer Jandom
https://github.com/jandom-devel/Jandom
Determine computational complexity of operators
easy
all operators in PTIME
Optimality of the semantic operators
are the abstract operators as precise as possible?
hard and not very rewarding
Many possible tricks and variations
possible aliasing (helps assignment)
variable depths of ALPs graphs
Gianluca Amato Sharing and linearity ICTCS 2015 24 / 27
Todo
Experimental evaluation
developing an implementation in our static analyzer Jandom
https://github.com/jandom-devel/Jandom
Determine computational complexity of operators
easy
all operators in PTIME
Optimality of the semantic operators
are the abstract operators as precise as possible?
hard and not very rewarding
Many possible tricks and variations
possible aliasing (helps assignment)
variable depths of ALPs graphs
Gianluca Amato Sharing and linearity ICTCS 2015 24 / 27
Todo
Experimental evaluation
developing an implementation in our static analyzer Jandom
https://github.com/jandom-devel/Jandom
Determine computational complexity of operators
easy
all operators in PTIME
Optimality of the semantic operators
are the abstract operators as precise as possible?
hard and not very rewarding
Many possible tricks and variations
possible aliasing (helps assignment)
variable depths of ALPs graphs
Gianluca Amato Sharing and linearity ICTCS 2015 24 / 27
Todo
Experimental evaluation
developing an implementation in our static analyzer Jandom
https://github.com/jandom-devel/Jandom
Determine computational complexity of operators
easy
all operators in PTIME
Optimality of the semantic operators
are the abstract operators as precise as possible?
hard and not very rewarding
Many possible tricks and variations
possible aliasing (helps assignment)
variable depths of ALPs graphs
Gianluca Amato Sharing and linearity ICTCS 2015 24 / 27
Thanks
Gianluca Amato Sharing and linearity ICTCS 2015 25 / 27
Variants of sharing analysis
Pair sharing and set sharing
Pair sharing Only pair of variables are considered.
Set sharing Sets of variables are considered.
{a, b, c} means that there is an object which is reachable
from a, b and c. This is different from (a, b), (b, c), (a, c).
May/must sharing
May sharing (a, b) means that variables a and b might share. Also called
possible sharing and definite non-sharing.
Must sharing (a, b) means that variables a and b must share. Also called
definite sharing and possible non-sharing.
Gianluca Amato Sharing and linearity ICTCS 2015 26 / 27
History
Possible sharing has been thoroughly investigated for logic programs.
Pair sharing analysis for Java:
S. Secci and F. Spoto
“Pair-Sharing. Analysis of Object-Oriented Programs”
SAS 2005
Set sharing analysis for Java:
M. M´endez-Lozo, M. V. Hermenegildo
“Precise set-sharing analysis for Java-style programs”
VMCAI 2008
Gianluca Amato Sharing and linearity ICTCS 2015 27 / 27

More Related Content

What's hot

Unit 1 linked list
Unit 1 linked listUnit 1 linked list
Unit 1 linked listLavanyaJ28
 
Ds important questions
Ds important questionsDs important questions
Ds important questionsLavanyaJ28
 
Ch 1 intriductions
Ch 1 intriductionsCh 1 intriductions
Ch 1 intriductionsirshad17
 
An Invitation to Functional Programming
An Invitation to Functional ProgrammingAn Invitation to Functional Programming
An Invitation to Functional ProgrammingSonat Süer
 
Skipl List implementation - Part 1
Skipl List implementation - Part 1Skipl List implementation - Part 1
Skipl List implementation - Part 1Amrith Krishna
 
Abstract algebra & its applications (1)
Abstract algebra & its applications (1)Abstract algebra & its applications (1)
Abstract algebra & its applications (1)drselvarani
 
IRJET- Dynamic Implementation of Stack using Single Linked List
IRJET- Dynamic Implementation of Stack using Single Linked ListIRJET- Dynamic Implementation of Stack using Single Linked List
IRJET- Dynamic Implementation of Stack using Single Linked ListIRJET Journal
 
Data structures: linear lists
Data structures: linear listsData structures: linear lists
Data structures: linear listsToniyaP1
 
My presentation
My presentationMy presentation
My presentationSaifur13
 
List Data Structure
List Data StructureList Data Structure
List Data StructureZidny Nafan
 
lecture 9
lecture 9lecture 9
lecture 9sajinsc
 

What's hot (16)

Unit 1 linked list
Unit 1 linked listUnit 1 linked list
Unit 1 linked list
 
Ds important questions
Ds important questionsDs important questions
Ds important questions
 
Lecture3b searching
Lecture3b searchingLecture3b searching
Lecture3b searching
 
Ch 1 intriductions
Ch 1 intriductionsCh 1 intriductions
Ch 1 intriductions
 
Application of Stack, Link list , and Queue in Programming .
Application of Stack, Link list , and Queue in Programming .Application of Stack, Link list , and Queue in Programming .
Application of Stack, Link list , and Queue in Programming .
 
An Invitation to Functional Programming
An Invitation to Functional ProgrammingAn Invitation to Functional Programming
An Invitation to Functional Programming
 
Skipl List implementation - Part 1
Skipl List implementation - Part 1Skipl List implementation - Part 1
Skipl List implementation - Part 1
 
Abstract algebra & its applications (1)
Abstract algebra & its applications (1)Abstract algebra & its applications (1)
Abstract algebra & its applications (1)
 
Lecture 2c stacks
Lecture 2c stacksLecture 2c stacks
Lecture 2c stacks
 
IRJET- Dynamic Implementation of Stack using Single Linked List
IRJET- Dynamic Implementation of Stack using Single Linked ListIRJET- Dynamic Implementation of Stack using Single Linked List
IRJET- Dynamic Implementation of Stack using Single Linked List
 
Data structures: linear lists
Data structures: linear listsData structures: linear lists
Data structures: linear lists
 
My presentation
My presentationMy presentation
My presentation
 
Algorithm and Programming (Searching)
Algorithm and Programming (Searching)Algorithm and Programming (Searching)
Algorithm and Programming (Searching)
 
Group theory
Group theoryGroup theory
Group theory
 
List Data Structure
List Data StructureList Data Structure
List Data Structure
 
lecture 9
lecture 9lecture 9
lecture 9
 

Similar to ICTCS 2015 - Exploiting linearity in sharing analysis of object-oriented programs

Asymptotic Notation and Data Structures
Asymptotic Notation and Data StructuresAsymptotic Notation and Data Structures
Asymptotic Notation and Data StructuresAmrinder Arora
 
105575916 maths-edit-new
105575916 maths-edit-new105575916 maths-edit-new
105575916 maths-edit-newhomeworkping7
 
Introduction to Data Structure
Introduction to Data StructureIntroduction to Data Structure
Introduction to Data StructureJazz Jinia Bhowmik
 
Application of Graph Theory in Computer science using Data Structure.pdf
Application of Graph Theory in Computer science using Data Structure.pdfApplication of Graph Theory in Computer science using Data Structure.pdf
Application of Graph Theory in Computer science using Data Structure.pdfNancy Ideker
 
Exploratory data analysis project
Exploratory data analysis project Exploratory data analysis project
Exploratory data analysis project BabatundeSogunro
 
Introductiont To Aray,Tree,Stack, Queue
Introductiont To Aray,Tree,Stack, QueueIntroductiont To Aray,Tree,Stack, Queue
Introductiont To Aray,Tree,Stack, QueueGhaffar Khan
 
Introduction to Data Structures .
Introduction to Data Structures        .Introduction to Data Structures        .
Introduction to Data Structures .Ashutosh Satapathy
 
Statistical Clustering and Portfolio Management
Statistical Clustering and Portfolio ManagementStatistical Clustering and Portfolio Management
Statistical Clustering and Portfolio ManagementJuan Andrés Serur
 
A Distributed Tableau Algorithm for Package-based Description Logics
A Distributed Tableau Algorithm for Package-based Description LogicsA Distributed Tableau Algorithm for Package-based Description Logics
A Distributed Tableau Algorithm for Package-based Description LogicsJie Bao
 
Looking for Invariant Operators in Argumentation
Looking for Invariant Operators in ArgumentationLooking for Invariant Operators in Argumentation
Looking for Invariant Operators in ArgumentationCarlo Taticchi
 
Graph theory and life
Graph theory and lifeGraph theory and life
Graph theory and lifeMilan Joshi
 
for sbi so Ds c c++ unix rdbms sql cn os
for sbi so   Ds c c++ unix rdbms sql cn osfor sbi so   Ds c c++ unix rdbms sql cn os
for sbi so Ds c c++ unix rdbms sql cn osalisha230390
 
Module System in Standard ML
Module System in Standard MLModule System in Standard ML
Module System in Standard MLKeheliya Gallaba
 
Wk 5 Individual Preparing for Working in Teams [due Day#]Top of.docx
Wk 5 Individual Preparing for Working in Teams [due Day#]Top of.docxWk 5 Individual Preparing for Working in Teams [due Day#]Top of.docx
Wk 5 Individual Preparing for Working in Teams [due Day#]Top of.docxhelzerpatrina
 

Similar to ICTCS 2015 - Exploiting linearity in sharing analysis of object-oriented programs (20)

CS8391 Data Structures 2 mark Questions - Anna University Questions
CS8391 Data Structures 2 mark Questions - Anna University QuestionsCS8391 Data Structures 2 mark Questions - Anna University Questions
CS8391 Data Structures 2 mark Questions - Anna University Questions
 
Asymptotic Notation and Data Structures
Asymptotic Notation and Data StructuresAsymptotic Notation and Data Structures
Asymptotic Notation and Data Structures
 
105575916 maths-edit-new
105575916 maths-edit-new105575916 maths-edit-new
105575916 maths-edit-new
 
Introduction to Data Structure
Introduction to Data StructureIntroduction to Data Structure
Introduction to Data Structure
 
Application of Graph Theory in Computer science using Data Structure.pdf
Application of Graph Theory in Computer science using Data Structure.pdfApplication of Graph Theory in Computer science using Data Structure.pdf
Application of Graph Theory in Computer science using Data Structure.pdf
 
Exploratory data analysis project
Exploratory data analysis project Exploratory data analysis project
Exploratory data analysis project
 
Set Theory and its Applications
Set Theory and its ApplicationsSet Theory and its Applications
Set Theory and its Applications
 
3.ppt
3.ppt3.ppt
3.ppt
 
3.ppt
3.ppt3.ppt
3.ppt
 
Introductiont To Aray,Tree,Stack, Queue
Introductiont To Aray,Tree,Stack, QueueIntroductiont To Aray,Tree,Stack, Queue
Introductiont To Aray,Tree,Stack, Queue
 
General Data structures
General Data structuresGeneral Data structures
General Data structures
 
Introduction to Data Structures .
Introduction to Data Structures        .Introduction to Data Structures        .
Introduction to Data Structures .
 
Statistical Clustering and Portfolio Management
Statistical Clustering and Portfolio ManagementStatistical Clustering and Portfolio Management
Statistical Clustering and Portfolio Management
 
A Distributed Tableau Algorithm for Package-based Description Logics
A Distributed Tableau Algorithm for Package-based Description LogicsA Distributed Tableau Algorithm for Package-based Description Logics
A Distributed Tableau Algorithm for Package-based Description Logics
 
Looking for Invariant Operators in Argumentation
Looking for Invariant Operators in ArgumentationLooking for Invariant Operators in Argumentation
Looking for Invariant Operators in Argumentation
 
Graph theory and life
Graph theory and lifeGraph theory and life
Graph theory and life
 
for sbi so Ds c c++ unix rdbms sql cn os
for sbi so   Ds c c++ unix rdbms sql cn osfor sbi so   Ds c c++ unix rdbms sql cn os
for sbi so Ds c c++ unix rdbms sql cn os
 
Persistent Search Trees
Persistent Search TreesPersistent Search Trees
Persistent Search Trees
 
Module System in Standard ML
Module System in Standard MLModule System in Standard ML
Module System in Standard ML
 
Wk 5 Individual Preparing for Working in Teams [due Day#]Top of.docx
Wk 5 Individual Preparing for Working in Teams [due Day#]Top of.docxWk 5 Individual Preparing for Working in Teams [due Day#]Top of.docx
Wk 5 Individual Preparing for Working in Teams [due Day#]Top of.docx
 

Recently uploaded

GBSN - Microbiology (Unit 1)
GBSN - Microbiology (Unit 1)GBSN - Microbiology (Unit 1)
GBSN - Microbiology (Unit 1)Areesha Ahmad
 
Physiochemical properties of nanomaterials and its nanotoxicity.pptx
Physiochemical properties of nanomaterials and its nanotoxicity.pptxPhysiochemical properties of nanomaterials and its nanotoxicity.pptx
Physiochemical properties of nanomaterials and its nanotoxicity.pptxAArockiyaNisha
 
GBSN - Microbiology (Unit 2)
GBSN - Microbiology (Unit 2)GBSN - Microbiology (Unit 2)
GBSN - Microbiology (Unit 2)Areesha Ahmad
 
Forensic Biology & Its biological significance.pdf
Forensic Biology & Its biological significance.pdfForensic Biology & Its biological significance.pdf
Forensic Biology & Its biological significance.pdfrohankumarsinghrore1
 
VIRUSES structure and classification ppt by Dr.Prince C P
VIRUSES structure and classification ppt by Dr.Prince C PVIRUSES structure and classification ppt by Dr.Prince C P
VIRUSES structure and classification ppt by Dr.Prince C PPRINCE C P
 
Chromatin Structure | EUCHROMATIN | HETEROCHROMATIN
Chromatin Structure | EUCHROMATIN | HETEROCHROMATINChromatin Structure | EUCHROMATIN | HETEROCHROMATIN
Chromatin Structure | EUCHROMATIN | HETEROCHROMATINsankalpkumarsahoo174
 
Biopesticide (2).pptx .This slides helps to know the different types of biop...
Biopesticide (2).pptx  .This slides helps to know the different types of biop...Biopesticide (2).pptx  .This slides helps to know the different types of biop...
Biopesticide (2).pptx .This slides helps to know the different types of biop...RohitNehra6
 
GBSN - Biochemistry (Unit 1)
GBSN - Biochemistry (Unit 1)GBSN - Biochemistry (Unit 1)
GBSN - Biochemistry (Unit 1)Areesha Ahmad
 
CALL ON ➥8923113531 🔝Call Girls Kesar Bagh Lucknow best Night Fun service 🪡
CALL ON ➥8923113531 🔝Call Girls Kesar Bagh Lucknow best Night Fun service  🪡CALL ON ➥8923113531 🔝Call Girls Kesar Bagh Lucknow best Night Fun service  🪡
CALL ON ➥8923113531 🔝Call Girls Kesar Bagh Lucknow best Night Fun service 🪡anilsa9823
 
Raman spectroscopy.pptx M Pharm, M Sc, Advanced Spectral Analysis
Raman spectroscopy.pptx M Pharm, M Sc, Advanced Spectral AnalysisRaman spectroscopy.pptx M Pharm, M Sc, Advanced Spectral Analysis
Raman spectroscopy.pptx M Pharm, M Sc, Advanced Spectral AnalysisDiwakar Mishra
 
Labelling Requirements and Label Claims for Dietary Supplements and Recommend...
Labelling Requirements and Label Claims for Dietary Supplements and Recommend...Labelling Requirements and Label Claims for Dietary Supplements and Recommend...
Labelling Requirements and Label Claims for Dietary Supplements and Recommend...Lokesh Kothari
 
Green chemistry and Sustainable development.pptx
Green chemistry  and Sustainable development.pptxGreen chemistry  and Sustainable development.pptx
Green chemistry and Sustainable development.pptxRajatChauhan518211
 
fundamental of entomology all in one topics of entomology
fundamental of entomology all in one topics of entomologyfundamental of entomology all in one topics of entomology
fundamental of entomology all in one topics of entomologyDrAnita Sharma
 
Isotopic evidence of long-lived volcanism on Io
Isotopic evidence of long-lived volcanism on IoIsotopic evidence of long-lived volcanism on Io
Isotopic evidence of long-lived volcanism on IoSérgio Sacani
 
Hire 💕 9907093804 Hooghly Call Girls Service Call Girls Agency
Hire 💕 9907093804 Hooghly Call Girls Service Call Girls AgencyHire 💕 9907093804 Hooghly Call Girls Service Call Girls Agency
Hire 💕 9907093804 Hooghly Call Girls Service Call Girls AgencySheetal Arora
 
Chemistry 4th semester series (krishna).pdf
Chemistry 4th semester series (krishna).pdfChemistry 4th semester series (krishna).pdf
Chemistry 4th semester series (krishna).pdfSumit Kumar yadav
 
DIFFERENCE IN BACK CROSS AND TEST CROSS
DIFFERENCE IN  BACK CROSS AND TEST CROSSDIFFERENCE IN  BACK CROSS AND TEST CROSS
DIFFERENCE IN BACK CROSS AND TEST CROSSLeenakshiTyagi
 
Unlocking the Potential: Deep dive into ocean of Ceramic Magnets.pptx
Unlocking  the Potential: Deep dive into ocean of Ceramic Magnets.pptxUnlocking  the Potential: Deep dive into ocean of Ceramic Magnets.pptx
Unlocking the Potential: Deep dive into ocean of Ceramic Magnets.pptxanandsmhk
 
Pulmonary drug delivery system M.pharm -2nd sem P'ceutics
Pulmonary drug delivery system M.pharm -2nd sem P'ceuticsPulmonary drug delivery system M.pharm -2nd sem P'ceutics
Pulmonary drug delivery system M.pharm -2nd sem P'ceuticssakshisoni2385
 
Botany krishna series 2nd semester Only Mcq type questions
Botany krishna series 2nd semester Only Mcq type questionsBotany krishna series 2nd semester Only Mcq type questions
Botany krishna series 2nd semester Only Mcq type questionsSumit Kumar yadav
 

Recently uploaded (20)

GBSN - Microbiology (Unit 1)
GBSN - Microbiology (Unit 1)GBSN - Microbiology (Unit 1)
GBSN - Microbiology (Unit 1)
 
Physiochemical properties of nanomaterials and its nanotoxicity.pptx
Physiochemical properties of nanomaterials and its nanotoxicity.pptxPhysiochemical properties of nanomaterials and its nanotoxicity.pptx
Physiochemical properties of nanomaterials and its nanotoxicity.pptx
 
GBSN - Microbiology (Unit 2)
GBSN - Microbiology (Unit 2)GBSN - Microbiology (Unit 2)
GBSN - Microbiology (Unit 2)
 
Forensic Biology & Its biological significance.pdf
Forensic Biology & Its biological significance.pdfForensic Biology & Its biological significance.pdf
Forensic Biology & Its biological significance.pdf
 
VIRUSES structure and classification ppt by Dr.Prince C P
VIRUSES structure and classification ppt by Dr.Prince C PVIRUSES structure and classification ppt by Dr.Prince C P
VIRUSES structure and classification ppt by Dr.Prince C P
 
Chromatin Structure | EUCHROMATIN | HETEROCHROMATIN
Chromatin Structure | EUCHROMATIN | HETEROCHROMATINChromatin Structure | EUCHROMATIN | HETEROCHROMATIN
Chromatin Structure | EUCHROMATIN | HETEROCHROMATIN
 
Biopesticide (2).pptx .This slides helps to know the different types of biop...
Biopesticide (2).pptx  .This slides helps to know the different types of biop...Biopesticide (2).pptx  .This slides helps to know the different types of biop...
Biopesticide (2).pptx .This slides helps to know the different types of biop...
 
GBSN - Biochemistry (Unit 1)
GBSN - Biochemistry (Unit 1)GBSN - Biochemistry (Unit 1)
GBSN - Biochemistry (Unit 1)
 
CALL ON ➥8923113531 🔝Call Girls Kesar Bagh Lucknow best Night Fun service 🪡
CALL ON ➥8923113531 🔝Call Girls Kesar Bagh Lucknow best Night Fun service  🪡CALL ON ➥8923113531 🔝Call Girls Kesar Bagh Lucknow best Night Fun service  🪡
CALL ON ➥8923113531 🔝Call Girls Kesar Bagh Lucknow best Night Fun service 🪡
 
Raman spectroscopy.pptx M Pharm, M Sc, Advanced Spectral Analysis
Raman spectroscopy.pptx M Pharm, M Sc, Advanced Spectral AnalysisRaman spectroscopy.pptx M Pharm, M Sc, Advanced Spectral Analysis
Raman spectroscopy.pptx M Pharm, M Sc, Advanced Spectral Analysis
 
Labelling Requirements and Label Claims for Dietary Supplements and Recommend...
Labelling Requirements and Label Claims for Dietary Supplements and Recommend...Labelling Requirements and Label Claims for Dietary Supplements and Recommend...
Labelling Requirements and Label Claims for Dietary Supplements and Recommend...
 
Green chemistry and Sustainable development.pptx
Green chemistry  and Sustainable development.pptxGreen chemistry  and Sustainable development.pptx
Green chemistry and Sustainable development.pptx
 
fundamental of entomology all in one topics of entomology
fundamental of entomology all in one topics of entomologyfundamental of entomology all in one topics of entomology
fundamental of entomology all in one topics of entomology
 
Isotopic evidence of long-lived volcanism on Io
Isotopic evidence of long-lived volcanism on IoIsotopic evidence of long-lived volcanism on Io
Isotopic evidence of long-lived volcanism on Io
 
Hire 💕 9907093804 Hooghly Call Girls Service Call Girls Agency
Hire 💕 9907093804 Hooghly Call Girls Service Call Girls AgencyHire 💕 9907093804 Hooghly Call Girls Service Call Girls Agency
Hire 💕 9907093804 Hooghly Call Girls Service Call Girls Agency
 
Chemistry 4th semester series (krishna).pdf
Chemistry 4th semester series (krishna).pdfChemistry 4th semester series (krishna).pdf
Chemistry 4th semester series (krishna).pdf
 
DIFFERENCE IN BACK CROSS AND TEST CROSS
DIFFERENCE IN  BACK CROSS AND TEST CROSSDIFFERENCE IN  BACK CROSS AND TEST CROSS
DIFFERENCE IN BACK CROSS AND TEST CROSS
 
Unlocking the Potential: Deep dive into ocean of Ceramic Magnets.pptx
Unlocking  the Potential: Deep dive into ocean of Ceramic Magnets.pptxUnlocking  the Potential: Deep dive into ocean of Ceramic Magnets.pptx
Unlocking the Potential: Deep dive into ocean of Ceramic Magnets.pptx
 
Pulmonary drug delivery system M.pharm -2nd sem P'ceutics
Pulmonary drug delivery system M.pharm -2nd sem P'ceuticsPulmonary drug delivery system M.pharm -2nd sem P'ceutics
Pulmonary drug delivery system M.pharm -2nd sem P'ceutics
 
Botany krishna series 2nd semester Only Mcq type questions
Botany krishna series 2nd semester Only Mcq type questionsBotany krishna series 2nd semester Only Mcq type questions
Botany krishna series 2nd semester Only Mcq type questions
 

ICTCS 2015 - Exploiting linearity in sharing analysis of object-oriented programs

  • 1. Exploiting linearity in sharing analysis of object-oriented programs Gianluca Amato Universit`a di Chieti–Pescara Pescara, Italy 16th Italian Conference on Theoretical Computer Science ICTCS 2015, 9-11 September 2015, Firenze (joint work with M. C. Meo and F. Scozzari) Gianluca Amato Sharing and linearity ICTCS 2015 1 / 27
  • 2. Overview Context Data-flow analysis Abstract interpretation Pointer analysis Plan of the talk 1 Sharing analysis 2 Adding linearity 3 Adding information for fields 4 The domain of ALPs-graphs 5 Conclusion Gianluca Amato Sharing and linearity ICTCS 2015 2 / 27
  • 3. Overview Context Data-flow analysis Abstract interpretation Pointer analysis Plan of the talk 1 Sharing analysis 2 Adding linearity 3 Adding information for fields 4 The domain of ALPs-graphs 5 Conclusion Gianluca Amato Sharing and linearity ICTCS 2015 3 / 27
  • 4. Sharing analysis Sharing analysis aims to determine variables which are be bound to overlapping data structures at execution time. Example class Tree { Tree left; Tree right } T a = new Tree (); T b = new Tree (); a.right = new Tree (); b.right = a.right; Heap a b At the end of this program, variables a and b share. Gianluca Amato Sharing and linearity ICTCS 2015 4 / 27
  • 5. Possible pair-sharing analysis We represent sharing information with a set of unordered pairs of variables in scope. A pair (a,b) means that a and b may share during execution. Formalized by Spoto & Secci, SAS 2005. Example {} Tree a = new Tree (); Tree b = new Tree (); a.right = new Tree (); b.right = a.right; Gianluca Amato Sharing and linearity ICTCS 2015 5 / 27
  • 6. Possible pair-sharing analysis We represent sharing information with a set of unordered pairs of variables in scope. A pair (a,b) means that a and b may share during execution. Formalized by Spoto & Secci, SAS 2005. Example {} Tree a = new Tree (); {(a,a)} a may be not null Tree b = new Tree (); a.right = new Tree (); b.right = a.right; Gianluca Amato Sharing and linearity ICTCS 2015 5 / 27
  • 7. Possible pair-sharing analysis We represent sharing information with a set of unordered pairs of variables in scope. A pair (a,b) means that a and b may share during execution. Formalized by Spoto & Secci, SAS 2005. Example {} Tree a = new Tree (); {(a,a)} a may be not null Tree b = new Tree (); {(a,a),(b,b)} a and b may be not null a.right = new Tree (); b.right = a.right; Gianluca Amato Sharing and linearity ICTCS 2015 5 / 27
  • 8. Possible pair-sharing analysis We represent sharing information with a set of unordered pairs of variables in scope. A pair (a,b) means that a and b may share during execution. Formalized by Spoto & Secci, SAS 2005. Example {} Tree a = new Tree (); {(a,a)} a may be not null Tree b = new Tree (); {(a,a),(b,b)} a and b may be not null a.right = new Tree (); {(a,a),(b,b)} a and b may be not null b.right = a.right; Gianluca Amato Sharing and linearity ICTCS 2015 5 / 27
  • 9. Possible pair-sharing analysis We represent sharing information with a set of unordered pairs of variables in scope. A pair (a,b) means that a and b may share during execution. Formalized by Spoto & Secci, SAS 2005. Example {} Tree a = new Tree (); {(a,a)} a may be not null Tree b = new Tree (); {(a,a),(b,b)} a and b may be not null a.right = new Tree (); {(a,a),(b,b)} a and b may be not null b.right = a.right; {(a,a),(b,b),(a,b)} a and b may be not null, a and b may share Gianluca Amato Sharing and linearity ICTCS 2015 5 / 27
  • 10. Other kind of pointer analysis Points-to analysis Relates a variable with the possible locations it may points. Locations are generally identified by occurrences of a new instruction. If two variables may point to the same location they may share. Alias analysis Determines whether two variable points to the same location. If two variables are aliases they share. Reachability anaysis Determines whether from a variable a it is possible to reach the location pointed to by variable b. If a → b, then and b share Gianluca Amato Sharing and linearity ICTCS 2015 6 / 27
  • 11. Overview Context Data-flow analysis Abstract interpretation Pointer analysis Plan of the talk 1 Sharing analysis 2 Adding linearity 3 Adding information for fields 4 The domain of ALPs-graphs 5 Conclusion Gianluca Amato Sharing and linearity ICTCS 2015 7 / 27
  • 12. The need for linearity Example (Creating List) // create a list of length n>0 Tree create_list(int n) { Tree head = new Tree (); Tree current = head; while (n>0) { current.left = new Tree (); current.right = new Tree (); current = current.right; n = n-1; } return head; } Heap head current Gianluca Amato Sharing and linearity ICTCS 2015 8 / 27
  • 13. The need for linearity (2) We would like to prove that a1, a2 and a3 do not share. It is obvious reasoning on the concrete heap. Example (Using List) // extract first 3 elements Tree list = create_list (5); Tree a1 = list.left list = list.right Tree a2 = list.left list = list.right Tree a3 = list.left Heap lista1a2a3 Gianluca Amato Sharing and linearity ICTCS 2015 9 / 27
  • 14. The need for linearity (2) We would like to prove that a1, a2 and a3 do not share. It is obvious reasoning on the concrete heap. Example (Using List) // extract first 3 elements Tree list = create_list (5); Tree a1 = list.left list = list.right Tree a2 = list.left list = list.right Tree a3 = list.left Heap lista1a2a3 Gianluca Amato Sharing and linearity ICTCS 2015 9 / 27
  • 15. The need for linearity (2) We would like to prove that a1, a2 and a3 do not share. It is obvious reasoning on the concrete heap. Example (Using List) // extract first 3 elements Tree list = create_list (5); Tree a1 = list.left list = list.right Tree a2 = list.left list = list.right Tree a3 = list.left Heap lista1a2a3 Gianluca Amato Sharing and linearity ICTCS 2015 9 / 27
  • 16. The need for linearity (2) We would like to prove that a1, a2 and a3 do not share. It is obvious reasoning on the concrete heap. Example (Using List) // extract first 3 elements Tree list = create_list (5); Tree a1 = list.left list = list.right Tree a2 = list.left list = list.right Tree a3 = list.left Heap lista1a2a3 Gianluca Amato Sharing and linearity ICTCS 2015 9 / 27
  • 17. The need for linearity (3) Only sharing information at the level of variables. Example (Analysis of the main program) {} Tree list = create_list (5); Possile concretization list Possile (bad) concretization list Gianluca Amato Sharing and linearity ICTCS 2015 10 / 27
  • 18. The need for linearity (3) Only sharing information at the level of variables. Example (Analysis of the main program) {} Tree list = create_list (5); {(list, list)} Possile concretization list Possile (bad) concretization list Gianluca Amato Sharing and linearity ICTCS 2015 10 / 27
  • 19. The need for linearity (3) Only sharing information at the level of variables. Example (Analysis of the main program) {} Tree list = create_list (5); {(list, list)} Possile concretization list Possile (bad) concretization list Gianluca Amato Sharing and linearity ICTCS 2015 10 / 27
  • 20. The need for linearity (3) Only sharing information at the level of variables. Example (Analysis of the main program) {} Tree list = create_list (5); {(list, list)} Possile concretization list Possile (bad) concretization list Gianluca Amato Sharing and linearity ICTCS 2015 10 / 27
  • 21. Linearity Definition (Linearity) A variable v is non-linear if there is a location which is reachable from v following two different chains of field. Linear heap list Non-linear heap list Complex heap a b Gianluca Amato Sharing and linearity ICTCS 2015 11 / 27
  • 22. Analysis with linearity sh lin: sh is the sharing information and lin a set of linear variables. Example (Analysis of the main program) {} Tree list = create_list (5); Possile concretization list Possile (bad) concretization list Gianluca Amato Sharing and linearity ICTCS 2015 12 / 27
  • 23. Analysis with linearity sh lin: sh is the sharing information and lin a set of linear variables. Example (Analysis of the main program) {} Tree list = create_list (5); {(list, list)} {list} Possile concretization list Possile (bad) concretization list Gianluca Amato Sharing and linearity ICTCS 2015 12 / 27
  • 24. Analysis with linearity sh lin: sh is the sharing information and lin a set of linear variables. Example (Analysis of the main program) {} Tree list = create_list (5); {(list, list)} {list} Possile concretization list Possile (bad) concretization list Gianluca Amato Sharing and linearity ICTCS 2015 12 / 27
  • 25. Overview Context Data-flow analysis Abstract interpretation Pointer analysis Plan of the talk 1 Sharing analysis 2 Adding linearity 3 Adding information for fields 4 The domain of ALPs-graphs 5 Conclusion Gianluca Amato Sharing and linearity ICTCS 2015 13 / 27
  • 26. The need for fields (1) Example (Analysis with fields) {} Tree list = create_list (5); {(list, list)} {list} Tree a1 = list.left Good concretization lista1 Bad concretization lista1 Gianluca Amato Sharing and linearity ICTCS 2015 14 / 27
  • 27. The need for fields (1) Example (Analysis with fields) {} Tree list = create_list (5); {(list, list)} {list} Tree a1 = list.left {(a1, a1), (list, list), (a1, list)} {list, a1} Good concretization lista1 Bad concretization lista1 Gianluca Amato Sharing and linearity ICTCS 2015 14 / 27
  • 28. The need for fields (1) Example (Analysis with fields) {} Tree list = create_list (5); {(list, list)} {list} Tree a1 = list.left {(a1, a1), (list, list), (a1, list)} {list, a1} Good concretization lista1 Bad concretization lista1 Gianluca Amato Sharing and linearity ICTCS 2015 14 / 27
  • 29. The need for fields (2) Example {} Tree list = create_list (5); Tree a1 = list.left Good concretization lista1 Bad concretization lista1 Gianluca Amato Sharing and linearity ICTCS 2015 15 / 27
  • 30. The need for fields (2) Example {} Tree list = create_list (5); {(list, list), (list.left, list.left), (list.right, list.right)} {list} Tree a1 = list.left Good concretization lista1 Bad concretization lista1 Gianluca Amato Sharing and linearity ICTCS 2015 15 / 27
  • 31. The need for fields (2) Example {} Tree list = create_list (5); {(list, list), (list.left, list.left), (list.right, list.right)} {list} Tree a1 = list.left {(a1, a1), (list.left, a1), (list, a1), (list, list), (list.left, list.left), (list.right, list.right)} {list, a1} Good concretization lista1 Bad concretization lista1 Gianluca Amato Sharing and linearity ICTCS 2015 15 / 27
  • 32. The need for fields (3) Example {} Tree list = create_list (5); {(list, list), (list.left, list.left), (list.right, list.right)} {list} Tree a1 = list.left {(a1,a1), (list.left, a1), (list, a1), (list, list), (list.left, list.left), (list.right, list.right)} {list, a1} list = list.right We have done it! list.left and list.right do not share because list is linear. same abstract information we had after create list. . . we can iterate without losing information Gianluca Amato Sharing and linearity ICTCS 2015 16 / 27
  • 33. The need for fields (3) Example {} Tree list = create_list (5); {(list, list), (list.left, list.left), (list.right, list.right)} {list} Tree a1 = list.left {(a1,a1), (list.left, a1), (list, a1), (list, list), (list.left, list.left), (list.right, list.right)} {list, a1} list = list.right {(a1, a1), (list, list), (list.left, list.left), (list.right, list.right)} {list, a1} We have done it! list.left and list.right do not share because list is linear. same abstract information we had after create list. . . we can iterate without losing information Gianluca Amato Sharing and linearity ICTCS 2015 16 / 27
  • 34. Overview Context Data-flow analysis Abstract interpretation Pointer analysis Plan of the talk 1 Sharing analysis 2 Adding linearity 3 Adding information for fields 4 The domain of ALPs-graphs 5 Conclusion Gianluca Amato Sharing and linearity ICTCS 2015 17 / 27
  • 35. The domain of ALPs-graphs Instead of keeping aliasing, sharing and linearity information as separate entities, we encode them in an ALPs-graph. Heap a b c Abstraction a bc left right right Gianluca Amato Sharing and linearity ICTCS 2015 18 / 27
  • 36. Operators An extract from the definition of abstract operators: SCI τ v:=exp (G) = prune((N E [v → (res), res → ⊥]) sh nl ) SCI τ v.f:=exp (G) =    ⊥ if (v) = ⊥ cl(prune((N ∪ Nnew E Edel ∪ Enew [res → ⊥]) sh ∪ shnew nl ∪ {n (x) | n (x) ∈ Nnew , (x.f) ∈ nl })) if (v) = ⊥ and (res) = ⊥ cl(prune((N ∪ Nnew E Edel ∪ Enew [res → ⊥]) sh ∪ shnew nl ∪ nlnew ∪ {n (x) | n (x) ∈ Nnew , (x.f) ∈ nl })) otherwise SCI τ if v = null then com1 else com2 (G) = SCI τ com1 (G) if (v) = ⊥ SCI τ com1 (G|v=null) SCI τ com2 (G) otherwise SCI τ if v = w then com1 else com2 (G) = SCI τ com1 (G) if (v) = (w) SCI τ com1 (G|v=w ) SCI τ com2 (G) otherwise SCI τ {com1; . . . ; comp} = (λs ∈ ALPsτ .s) ◦ SCI τ comp ◦ · · · ◦ SCI τ com1 Gianluca Amato Sharing and linearity ICTCS 2015 19 / 27
  • 37. Restriction to null Program code // G1 if (v == null) { // G2 cmd Question: How do we obtain G2 from G1? Answer: We delete the node labeled by v and all its descendants. Example (G1) a b v left right right left Example (G2) a left right Gianluca Amato Sharing and linearity ICTCS 2015 20 / 27
  • 38. Restriction to null Program code // G1 if (v == null) { // G2 cmd Question: How do we obtain G2 from G1? Answer: We delete the node labeled by v and all its descendants. Example (G1) a b v left right right left Example (G2) a left right Gianluca Amato Sharing and linearity ICTCS 2015 20 / 27
  • 39. Field Assignment Program code // G1 v.right = null // G2 Question: How do we obtain G2 from G1? Answer: Delete arrow from v labeled by right... but consider possible aliases of v Example (G1) a v left right right left Example (G2 incorrect) a v left right left Gianluca Amato Sharing and linearity ICTCS 2015 21 / 27
  • 40. Field Assignment Program code // G1 v.right = null // G2 Question: How do we obtain G2 from G1? Answer: Delete arrow from v labeled by right... but consider possible aliases of v Example (G1) a v left right right left Example (G2 incorrect) a v left right left Gianluca Amato Sharing and linearity ICTCS 2015 21 / 27
  • 41. Field Assignment Program code // G1 v.right = null // G2 Question: How do we obtain G2 from G1? Answer: Delete arrow from v labeled by right... but consider possible aliases of v Example (G1) a v left right right left Example (G2 correct) a v left right left Gianluca Amato Sharing and linearity ICTCS 2015 21 / 27
  • 42. Overview Context Data-flow analysis Abstract interpretation Pointer analysis Plan of the talk 1 Sharing analysis 2 Adding linearity 3 Adding information for fields 4 The domain of ALPs-graphs 5 Conclusion Gianluca Amato Sharing and linearity ICTCS 2015 22 / 27
  • 43. What we have done Formally define ALPs graphs a Galois connection with the powerset of concrete heaps using concrete heap as formalized in [Secci & Spoto 05] Define abstract operators needed to analyze Java code on the concrete semantics defined in [Secci & Spoto 05] Prove correctness of these operators Gianluca Amato Sharing and linearity ICTCS 2015 23 / 27
  • 44. What we have done Formally define ALPs graphs a Galois connection with the powerset of concrete heaps using concrete heap as formalized in [Secci & Spoto 05] Define abstract operators needed to analyze Java code on the concrete semantics defined in [Secci & Spoto 05] Prove correctness of these operators Gianluca Amato Sharing and linearity ICTCS 2015 23 / 27
  • 45. What we have done Formally define ALPs graphs a Galois connection with the powerset of concrete heaps using concrete heap as formalized in [Secci & Spoto 05] Define abstract operators needed to analyze Java code on the concrete semantics defined in [Secci & Spoto 05] Prove correctness of these operators Gianluca Amato Sharing and linearity ICTCS 2015 23 / 27
  • 46. Todo Experimental evaluation developing an implementation in our static analyzer Jandom https://github.com/jandom-devel/Jandom Determine computational complexity of operators easy all operators in PTIME Optimality of the semantic operators are the abstract operators as precise as possible? hard and not very rewarding Many possible tricks and variations possible aliasing (helps assignment) variable depths of ALPs graphs Gianluca Amato Sharing and linearity ICTCS 2015 24 / 27
  • 47. Todo Experimental evaluation developing an implementation in our static analyzer Jandom https://github.com/jandom-devel/Jandom Determine computational complexity of operators easy all operators in PTIME Optimality of the semantic operators are the abstract operators as precise as possible? hard and not very rewarding Many possible tricks and variations possible aliasing (helps assignment) variable depths of ALPs graphs Gianluca Amato Sharing and linearity ICTCS 2015 24 / 27
  • 48. Todo Experimental evaluation developing an implementation in our static analyzer Jandom https://github.com/jandom-devel/Jandom Determine computational complexity of operators easy all operators in PTIME Optimality of the semantic operators are the abstract operators as precise as possible? hard and not very rewarding Many possible tricks and variations possible aliasing (helps assignment) variable depths of ALPs graphs Gianluca Amato Sharing and linearity ICTCS 2015 24 / 27
  • 49. Todo Experimental evaluation developing an implementation in our static analyzer Jandom https://github.com/jandom-devel/Jandom Determine computational complexity of operators easy all operators in PTIME Optimality of the semantic operators are the abstract operators as precise as possible? hard and not very rewarding Many possible tricks and variations possible aliasing (helps assignment) variable depths of ALPs graphs Gianluca Amato Sharing and linearity ICTCS 2015 24 / 27
  • 50. Thanks Gianluca Amato Sharing and linearity ICTCS 2015 25 / 27
  • 51. Variants of sharing analysis Pair sharing and set sharing Pair sharing Only pair of variables are considered. Set sharing Sets of variables are considered. {a, b, c} means that there is an object which is reachable from a, b and c. This is different from (a, b), (b, c), (a, c). May/must sharing May sharing (a, b) means that variables a and b might share. Also called possible sharing and definite non-sharing. Must sharing (a, b) means that variables a and b must share. Also called definite sharing and possible non-sharing. Gianluca Amato Sharing and linearity ICTCS 2015 26 / 27
  • 52. History Possible sharing has been thoroughly investigated for logic programs. Pair sharing analysis for Java: S. Secci and F. Spoto “Pair-Sharing. Analysis of Object-Oriented Programs” SAS 2005 Set sharing analysis for Java: M. M´endez-Lozo, M. V. Hermenegildo “Precise set-sharing analysis for Java-style programs” VMCAI 2008 Gianluca Amato Sharing and linearity ICTCS 2015 27 / 27