SlideShare a Scribd company logo
1 of 45
Download to read offline
Points-to Analysis for Context-
Oriented JavaScript Programs
Sergio Cardenas, Paul Leger, Hiroaki Fukuda, Nicolás Cardozo
Systems an Computing Engineering - Universidad de los Andes, Bogotá - Colombia
Universidad Católica del Norte, Coquimbo - Chile
Shibaura Institute of Technology, Tokyo - Japan
se.cardenas@uniandes.edu.co, pleger@ucn.cl, hiroaki@shibaura-it.ac.jp, n.cardozo@uniandes.edu.co
@ncardoz
Formal Techniques for Java-like Programs - 18 / 07 / 2023
Points-to analysis
2
Object first(Object o1, Object o2){
return o1;
}
Object second(Object o1, Object o2){
return first(o2, o1);
}
void f() {
Object o1 = new Object();
Object o2 = new Object();
Object o3 = first(o1, o2);
Object o4 = first(o2, o1);
Object o5 = second(o1, o2);
Object o6 = second(o2, o1);
}
f
Points-to analysis
2
Object first(Object o1, Object o2){
return o1;
}
Object second(Object o1, Object o2){
return first(o2, o1);
}
void f() {
Object o1 = new Object();
Object o2 = new Object();
Object o3 = first(o1, o2);
Object o4 = first(o2, o1);
Object o5 = second(o1, o2);
Object o6 = second(o2, o1);
}
o1 inst1
f
Points-to analysis
2
Object first(Object o1, Object o2){
return o1;
}
Object second(Object o1, Object o2){
return first(o2, o1);
}
void f() {
Object o1 = new Object();
Object o2 = new Object();
Object o3 = first(o1, o2);
Object o4 = first(o2, o1);
Object o5 = second(o1, o2);
Object o6 = second(o2, o1);
}
o1
o2
inst1
inst2
f
Points-to analysis
2
Object first(Object o1, Object o2){
return o1;
}
Object second(Object o1, Object o2){
return first(o2, o1);
}
void f() {
Object o1 = new Object();
Object o2 = new Object();
Object o3 = first(o1, o2);
Object o4 = first(o2, o1);
Object o5 = second(o1, o2);
Object o6 = second(o2, o1);
}
o1
o2
inst1
inst2
o3
f
first
Points-to analysis
2
Object first(Object o1, Object o2){
return o1;
}
Object second(Object o1, Object o2){
return first(o2, o1);
}
void f() {
Object o1 = new Object();
Object o2 = new Object();
Object o3 = first(o1, o2);
Object o4 = first(o2, o1);
Object o5 = second(o1, o2);
Object o6 = second(o2, o1);
}
o1
o2
inst1
inst2
o3
inst1
f
first
Points-to analysis
2
Object first(Object o1, Object o2){
return o1;
}
Object second(Object o1, Object o2){
return first(o2, o1);
}
void f() {
Object o1 = new Object();
Object o2 = new Object();
Object o3 = first(o1, o2);
Object o4 = first(o2, o1);
Object o5 = second(o1, o2);
Object o6 = second(o2, o1);
}
o1
o2
inst1
inst2
o3
inst1
first
inst1
inst2
...
f
first
3
programs need to be more dynamic …
3
programs need to be more dynamic …
… due to complex and
changing requirements
3
programs need to be more dynamic …
… due to complex and
changing requirements
new modularity
abstractions
3
programs need to be more dynamic …
… due to complex and
changing requirements
new modularity
abstractions
changing locations
Context-oriented programming (COP)
4
Msg = {
send: function(msg) {
return msg;
}
};
Context-oriented programming (COP)
4
Msg = {
send: function(msg) {
return msg;
}
};
Encryption = new cop.Context({});
EncryptionBehavior = Trait({
send: function(msg) {
return "<E>" + this.proceed() + "<E>";
}
});
Context-oriented programming (COP)
4
Msg = {
send: function(msg) {
return msg;
}
};
Encryption = new cop.Context({});
EncryptionBehavior = Trait({
send: function(msg) {
return "<E>" + this.proceed() + "<E>";
}
});
Compression = new cop.Context({});
CompressionBehavior = Trait({
send: function(msg) {
return "<C>" + this.proceed() + "<C>";
}
});
Context-oriented programming (COP)
4
Msg = {
send: function(msg) {
return msg;
}
};
Encryption = new cop.Context({});
EncryptionBehavior = Trait({
send: function(msg) {
return "<E>" + this.proceed() + "<E>";
}
});
Compression = new cop.Context({});
CompressionBehavior = Trait({
send: function(msg) {
return "<C>" + this.proceed() + "<C>";
}
});
Encryption.adapt(Msg, EncryptionBehavior);
Compression.adapt(Msg, CompressionBehavior);
Context-oriented programming (COP)
4
Msg = {
send: function(msg) {
return msg;
}
};
Encryption = new cop.Context({});
EncryptionBehavior = Trait({
send: function(msg) {
return "<E>" + this.proceed() + "<E>";
}
});
Compression = new cop.Context({});
CompressionBehavior = Trait({
send: function(msg) {
return "<C>" + this.proceed() + "<C>";
}
});
Encryption.adapt(Msg, EncryptionBehavior);
Compression.adapt(Msg, CompressionBehavior);
Encryption.activate();
Context-oriented programming (COP)
4
Msg = {
send: function(msg) {
return msg;
}
};
Encryption = new cop.Context({});
EncryptionBehavior = Trait({
send: function(msg) {
return "<E>" + this.proceed() + "<E>";
}
});
Compression = new cop.Context({});
CompressionBehavior = Trait({
send: function(msg) {
return "<C>" + this.proceed() + "<C>";
}
});
Encryption.adapt(Msg, EncryptionBehavior);
Compression.adapt(Msg, CompressionBehavior);
Encryption.activate();
Compression.activate();
Context-oriented programming (COP)
5
msg = Msg();
msg.send(42);
Context-oriented programming (COP)
5
Msg = {
send: function(msg) {
return msg;
}
};
Encryption = new cop.Context({});
EncryptionBehavior = Trait({
send: function(msg) {
return "<E>" + this.proceed() + "<E>";
}
});
Compression = new cop.Context({});
CompressionBehavior = Trait({
send: function(msg) {
return "<C>" + this.proceed() + "<C>";
}
});
msg = Msg();
msg.send(42);
6
Base analysis precise and efficient
to determine different properties
about dynamic programs in COP
Analyzing COP programs
7
COP program
Analyzing COP programs
7
COP program
Context.adapt(object1, trait1)
Context.adapt(object2, trait1)
Context.adapt(objectn, traitm)
…
1. tuple extraction
⟨ctx, trait, obj⟩
Analyzing COP programs
7
COP program
Context.adapt(object1, trait1)
Context.adapt(object2, trait1)
Context.adapt(objectn, traitm)
…
1. tuple extraction
⟨ctx, trait, obj⟩ 2. Code transformation
Analyzing COP programs
7
COP program
Context.adapt(object1, trait1)
Context.adapt(object2, trait1)
Context.adapt(objectn, traitm)
…
1. tuple extraction
⟨ctx, trait, obj⟩ 2. Code transformation 3. Field-sensitive correlation
tracking analysis
Context identification and transformation
8
Encryption.adapt(Msg, EncryptionBehavior);
Encryption.activate();
Encryption = new cop.Context({});
EncryptionBehavior = Trait({
send: function(msg) {
return "<E>" + this.proceed() + "<E>";
}
});
Context identification and transformation
9
Encryption.adapt(Msg, EncryptionBehavior);
Encryption.activate();
Encryption = new cop.Context({});
EncryptionBehavior = Trait({
send: function(msg) {
return "<E>" + this.proceed() + "<E>";
}
});
Context identification and transformation
9
Encryption.adapt(Msg, EncryptionBehavior);
Encryption.activate();
Encryption = new cop.Context({});
EncryptionBehavior = Trait({
send: function(msg) {
return "<E>" + this.proceed() + "<E>";
}
});
o = {
send: function() {
return "<E>" + this.proceed() + “<E>";
}
}
EncryptionBehavior = Trait(o);
EncryptionBehavior.obj = o;
Context identification and transformation
10
Encryption.adapt(Msg, EncryptionBehavior);
Encryption.activate();
Encryption = new cop.Context({});
EncryptionBehavior = Trait({
send: function(msg) {
return "<E>" + this.proceed() + "<E>";
}
});
Context identification and transformation
10
Encryption.adapt(Msg, EncryptionBehavior);
Encryption.activate();
Encryption = new cop.Context({});
EncryptionBehavior = Trait({
send: function(msg) {
return "<E>" + this.proceed() + "<E>";
}
});
Encryption.adaptation1 = {
obj: Msg,
trait: EncryptionBehavior
}
Context identification and transformation
11
Encryption.adapt(Msg, EncryptionBehavior);
Encryption.activate();
Encryption = new cop.Context({});
EncryptionBehavior = Trait({
send: function(msg) {
return "<E>" + this.proceed() + "<E>";
}
});
Context identification and transformation
11
Encryption.adapt(Msg, EncryptionBehavior);
Encryption.activate();
Encryption = new cop.Context({});
EncryptionBehavior = Trait({
send: function(msg) {
return "<E>" + this.proceed() + "<E>";
}
});
for(var p in
Encryption.adaptation1.trait.obj) {
(function (prop) {
Encryption.adaptation1.obj[prop] =
Encryption.adaptation1.trait.obj[prop];
})(p);
}
12
Experiments
use four
different
applications
comparing
field-sensitive
analysis and
our extension
hello-world.js
shape-polymorphism.js
video-encoder.js
course-management.js
https://
fl
aglab.github.io/AdaptiveSystemAnalysis/
Precision evaluation
13
Shape = {
b: 2,
h: 3,
type: "shape",
getType: function() { return this.type; },
area: function() { return 'Calling an abstract method area’; },
perimeter: function() { return 'Calling an abstract method perimeter’; },
numberOfSides: function() { return 0; }
};
Triangle = new cop.Context({});
TriangleBehavior = cop.Trait({
getType: function() { return “triangle"; },
area: function() { return this.b * this.h/2; },
perimeter: function() {
return this.b + 2*Math.sqrt(Math.pow(this.h,2) + Math.pow(this.b/2, 2));
},
numberOfSides: function() { return 3; }
});
Triangle.adapt(TShape, TriangleBehavior);
Circle = new cop.Context({});
CircleBehavior = cop.Trait({
getType: function() { return “circle"; },
area: function() { return Math.pow(this.b, 2) * Math.PI; },
perimeter: function() { return this.b * 2* Math.PI; },
numberOfSides: function() {
throw new Error("Number of sides is not defined in a circle");
}
});
Circle.adapt(Shape, CircleBehavior);
baseline ours
r1
r2
r3
r4
r6
r5
r7
r8
r9
Precision evaluation
13
Shape = {
b: 2,
h: 3,
type: "shape",
getType: function() { return this.type; },
area: function() { return 'Calling an abstract method area’; },
perimeter: function() { return 'Calling an abstract method perimeter’; },
numberOfSides: function() { return 0; }
};
Triangle = new cop.Context({});
TriangleBehavior = cop.Trait({
getType: function() { return “triangle"; },
area: function() { return this.b * this.h/2; },
perimeter: function() {
return this.b + 2*Math.sqrt(Math.pow(this.h,2) + Math.pow(this.b/2, 2));
},
numberOfSides: function() { return 3; }
});
Triangle.adapt(TShape, TriangleBehavior);
Circle = new cop.Context({});
CircleBehavior = cop.Trait({
getType: function() { return “circle"; },
area: function() { return Math.pow(this.b, 2) * Math.PI; },
perimeter: function() { return this.b * 2* Math.PI; },
numberOfSides: function() {
throw new Error("Number of sides is not defined in a circle");
}
});
Circle.adapt(Shape, CircleBehavior);
area
baseline ours
r1
r1
r2
r3
r4
r6
r5
r7
r8
r9
Precision evaluation
13
Shape = {
b: 2,
h: 3,
type: "shape",
getType: function() { return this.type; },
area: function() { return 'Calling an abstract method area’; },
perimeter: function() { return 'Calling an abstract method perimeter’; },
numberOfSides: function() { return 0; }
};
Triangle = new cop.Context({});
TriangleBehavior = cop.Trait({
getType: function() { return “triangle"; },
area: function() { return this.b * this.h/2; },
perimeter: function() {
return this.b + 2*Math.sqrt(Math.pow(this.h,2) + Math.pow(this.b/2, 2));
},
numberOfSides: function() { return 3; }
});
Triangle.adapt(TShape, TriangleBehavior);
Circle = new cop.Context({});
CircleBehavior = cop.Trait({
getType: function() { return “circle"; },
area: function() { return Math.pow(this.b, 2) * Math.PI; },
perimeter: function() { return this.b * 2* Math.PI; },
numberOfSides: function() {
throw new Error("Number of sides is not defined in a circle");
}
});
Circle.adapt(Shape, CircleBehavior);
area
baseline ours
r1
r1
r2
r3
r4
r6
r5
r1
r3
r6
r7
r8
r9
area
Precision evaluation
14
Shape = {
b: 2,
h: 3,
type: "shape",
getType: function() { return this.type; },
area: function() { return 'Calling an abstract method area’; },
perimeter: function() { return 'Calling an abstract method perimeter’; },
numberOfSides: function() { return 0; }
};
Triangle = new cop.Context({});
TriangleBehavior = cop.Trait({
getType: function() { return “triangle"; },
area: function() { return this.b * this.h/2; },
perimeter: function() {
return this.b + 2*Math.sqrt(Math.pow(this.h,2) + Math.pow(this.b/2, 2));
},
numberOfSides: function() { return 3; }
});
Triangle.adapt(TShape, TriangleBehavior);
Circle = new cop.Context({});
CircleBehavior = cop.Trait({
getType: function() { return “circle"; },
area: function() { return Math.pow(this.b, 2) * Math.PI; },
perimeter: function() { return this.b * 2* Math.PI; },
numberOfSides: function() {
throw new Error("Number of sides is not defined in a circle");
}
});
Circle.adapt(Shape, CircleBehavior);
baseline ours
r1
r2
r3
r4
r6
r5
r7
r8
r9
Precision evaluation
14
Shape = {
b: 2,
h: 3,
type: "shape",
getType: function() { return this.type; },
area: function() { return 'Calling an abstract method area’; },
perimeter: function() { return 'Calling an abstract method perimeter’; },
numberOfSides: function() { return 0; }
};
Triangle = new cop.Context({});
TriangleBehavior = cop.Trait({
getType: function() { return “triangle"; },
area: function() { return this.b * this.h/2; },
perimeter: function() {
return this.b + 2*Math.sqrt(Math.pow(this.h,2) + Math.pow(this.b/2, 2));
},
numberOfSides: function() { return 3; }
});
Triangle.adapt(TShape, TriangleBehavior);
Circle = new cop.Context({});
CircleBehavior = cop.Trait({
getType: function() { return “circle"; },
area: function() { return Math.pow(this.b, 2) * Math.PI; },
perimeter: function() { return this.b * 2* Math.PI; },
numberOfSides: function() {
throw new Error("Number of sides is not defined in a circle");
}
});
Circle.adapt(Shape, CircleBehavior);
sides
baseline ours
r9
r1
r2
r3
r4
r6
r5
r7
r8
r9
Precision evaluation
14
Shape = {
b: 2,
h: 3,
type: "shape",
getType: function() { return this.type; },
area: function() { return 'Calling an abstract method area’; },
perimeter: function() { return 'Calling an abstract method perimeter’; },
numberOfSides: function() { return 0; }
};
Triangle = new cop.Context({});
TriangleBehavior = cop.Trait({
getType: function() { return “triangle"; },
area: function() { return this.b * this.h/2; },
perimeter: function() {
return this.b + 2*Math.sqrt(Math.pow(this.h,2) + Math.pow(this.b/2, 2));
},
numberOfSides: function() { return 3; }
});
Triangle.adapt(TShape, TriangleBehavior);
Circle = new cop.Context({});
CircleBehavior = cop.Trait({
getType: function() { return “circle"; },
area: function() { return Math.pow(this.b, 2) * Math.PI; },
perimeter: function() { return this.b * 2* Math.PI; },
numberOfSides: function() {
throw new Error("Number of sides is not defined in a circle");
}
});
Circle.adapt(Shape, CircleBehavior);
sides
baseline ours
r9
r1
r2
r3
r4
r6
r5
r8
r7
r9
r7
r8
r9
sides
The road ahead … adaptation completeness
15
Context1 = new cop.Context({});
Behavior1 = cop.Trait({
foo: function() ...
});
Context1.adapt(Object, Behavior1);
Context2 = new cop.Context({});
Behavior2 = cop.Trait({
bar: function(){
baz();
foo();
}
});
Context2.adapt(Object, Behavior2);
Object = {
baz: function() ...
};
The road ahead … adaptation completeness
15
Context1 = new cop.Context({});
Behavior1 = cop.Trait({
foo: function() ...
});
Context1.adapt(Object, Behavior1);
Context2 = new cop.Context({});
Behavior2 = cop.Trait({
bar: function(){
baz();
foo();
}
});
Context2.adapt(Object, Behavior2);
Object = {
baz: function() ...
};
Context1.activate();
Context2.activate();
bar();
1.
The road ahead … adaptation completeness
15
Context1 = new cop.Context({});
Behavior1 = cop.Trait({
foo: function() ...
});
Context1.adapt(Object, Behavior1);
Context2 = new cop.Context({});
Behavior2 = cop.Trait({
bar: function(){
baz();
foo();
}
});
Context2.adapt(Object, Behavior2);
Object = {
baz: function() ...
};
Context1.activate();
Context2.activate();
bar();
Context2.activate();
bar();
1. 2.
The road ahead … adaptation completeness
15
Context1 = new cop.Context({});
Behavior1 = cop.Trait({
foo: function() ...
});
Context1.adapt(Object, Behavior1);
Context2 = new cop.Context({});
Behavior2 = cop.Trait({
bar: function(){
baz();
foo();
}
});
Context2.adapt(Object, Behavior2);
Object = {
baz: function() ...
};
Context1.activate();
Context2.activate();
bar();
Context2.activate();
bar();
1. 2.
Conclusion
16
@ncardoz
COP
analysis framework
Conclusion
16
@ncardoz
COP
analysis framework
First analysis taking into
account the modularity and
dynamic aspects of COP
Conclusion
16
@ncardoz
COP
analysis framework
First analysis taking into
account the modularity and
dynamic aspects of COP
Improved recall for COP
programs (without proceed)

More Related Content

Similar to [FTfJP23] Points-to Analysis for Context-oriented Javascript Programs

Functional Programming You Already Know - Kevlin Henney - Codemotion Rome 2015
Functional Programming You Already Know - Kevlin Henney - Codemotion Rome 2015Functional Programming You Already Know - Kevlin Henney - Codemotion Rome 2015
Functional Programming You Already Know - Kevlin Henney - Codemotion Rome 2015Codemotion
 
Functional Programming You Already Know - Kevlin Henney - Codemotion Rome 2015
Functional Programming You Already Know - Kevlin Henney - Codemotion Rome 2015Functional Programming You Already Know - Kevlin Henney - Codemotion Rome 2015
Functional Programming You Already Know - Kevlin Henney - Codemotion Rome 2015Codemotion
 
CS101- Introduction to Computing- Lecture 29
CS101- Introduction to Computing- Lecture 29CS101- Introduction to Computing- Lecture 29
CS101- Introduction to Computing- Lecture 29Bilal Ahmed
 
CS101- Introduction to Computing- Lecture 29
CS101- Introduction to Computing- Lecture 29CS101- Introduction to Computing- Lecture 29
CS101- Introduction to Computing- Lecture 29Bilal Ahmed
 
Java 8 - Nuts and Bold - SFEIR Benelux
Java 8 - Nuts and Bold - SFEIR BeneluxJava 8 - Nuts and Bold - SFEIR Benelux
Java 8 - Nuts and Bold - SFEIR Beneluxyohanbeschi
 
Java 8 - Nuts and Bold - SFEIR Benelux
Java 8 - Nuts and Bold - SFEIR BeneluxJava 8 - Nuts and Bold - SFEIR Benelux
Java 8 - Nuts and Bold - SFEIR Beneluxyohanbeschi
 
Столпы функционального программирования для адептов ООП, Николай Мозговой
Столпы функционального программирования для адептов ООП, Николай МозговойСтолпы функционального программирования для адептов ООП, Николай Мозговой
Столпы функционального программирования для адептов ООП, Николай МозговойSigma Software
 
Столпы функционального программирования для адептов ООП, Николай Мозговой
Столпы функционального программирования для адептов ООП, Николай МозговойСтолпы функционального программирования для адептов ООП, Николай Мозговой
Столпы функционального программирования для адептов ООП, Николай МозговойSigma Software
 
25-inheritance-polymorphism.ppt
25-inheritance-polymorphism.ppt25-inheritance-polymorphism.ppt
25-inheritance-polymorphism.pptPiyushAery
 
information on -inheritance-polymorphism in java.ppt
information on -inheritance-polymorphism in java.pptinformation on -inheritance-polymorphism in java.ppt
information on -inheritance-polymorphism in java.pptssuserf170c4
 
25-inheritance-polymorphism.ppt
25-inheritance-polymorphism.ppt25-inheritance-polymorphism.ppt
25-inheritance-polymorphism.pptPiyushAery
 
information on -inheritance-polymorphism in java.ppt
information on -inheritance-polymorphism in java.pptinformation on -inheritance-polymorphism in java.ppt
information on -inheritance-polymorphism in java.pptssuserf170c4
 
Functional Programming In Java
Functional Programming In JavaFunctional Programming In Java
Functional Programming In JavaAndrei Solntsev
 
Functional Programming In Java
Functional Programming In JavaFunctional Programming In Java
Functional Programming In JavaAndrei Solntsev
 

Similar to [FTfJP23] Points-to Analysis for Context-oriented Javascript Programs (20)

Functional Programming You Already Know - Kevlin Henney - Codemotion Rome 2015
Functional Programming You Already Know - Kevlin Henney - Codemotion Rome 2015Functional Programming You Already Know - Kevlin Henney - Codemotion Rome 2015
Functional Programming You Already Know - Kevlin Henney - Codemotion Rome 2015
 
Functional Programming You Already Know - Kevlin Henney - Codemotion Rome 2015
Functional Programming You Already Know - Kevlin Henney - Codemotion Rome 2015Functional Programming You Already Know - Kevlin Henney - Codemotion Rome 2015
Functional Programming You Already Know - Kevlin Henney - Codemotion Rome 2015
 
CS101- Introduction to Computing- Lecture 29
CS101- Introduction to Computing- Lecture 29CS101- Introduction to Computing- Lecture 29
CS101- Introduction to Computing- Lecture 29
 
CS101- Introduction to Computing- Lecture 29
CS101- Introduction to Computing- Lecture 29CS101- Introduction to Computing- Lecture 29
CS101- Introduction to Computing- Lecture 29
 
06slide.ppt
06slide.ppt06slide.ppt
06slide.ppt
 
06slide.ppt
06slide.ppt06slide.ppt
06slide.ppt
 
Java 8 - Nuts and Bold - SFEIR Benelux
Java 8 - Nuts and Bold - SFEIR BeneluxJava 8 - Nuts and Bold - SFEIR Benelux
Java 8 - Nuts and Bold - SFEIR Benelux
 
Java 8 - Nuts and Bold - SFEIR Benelux
Java 8 - Nuts and Bold - SFEIR BeneluxJava 8 - Nuts and Bold - SFEIR Benelux
Java 8 - Nuts and Bold - SFEIR Benelux
 
Matlab integration
Matlab integrationMatlab integration
Matlab integration
 
Matlab integration
Matlab integrationMatlab integration
Matlab integration
 
Ds practical file
Ds practical fileDs practical file
Ds practical file
 
Ds practical file
Ds practical fileDs practical file
Ds practical file
 
Столпы функционального программирования для адептов ООП, Николай Мозговой
Столпы функционального программирования для адептов ООП, Николай МозговойСтолпы функционального программирования для адептов ООП, Николай Мозговой
Столпы функционального программирования для адептов ООП, Николай Мозговой
 
Столпы функционального программирования для адептов ООП, Николай Мозговой
Столпы функционального программирования для адептов ООП, Николай МозговойСтолпы функционального программирования для адептов ООП, Николай Мозговой
Столпы функционального программирования для адептов ООП, Николай Мозговой
 
25-inheritance-polymorphism.ppt
25-inheritance-polymorphism.ppt25-inheritance-polymorphism.ppt
25-inheritance-polymorphism.ppt
 
information on -inheritance-polymorphism in java.ppt
information on -inheritance-polymorphism in java.pptinformation on -inheritance-polymorphism in java.ppt
information on -inheritance-polymorphism in java.ppt
 
25-inheritance-polymorphism.ppt
25-inheritance-polymorphism.ppt25-inheritance-polymorphism.ppt
25-inheritance-polymorphism.ppt
 
information on -inheritance-polymorphism in java.ppt
information on -inheritance-polymorphism in java.pptinformation on -inheritance-polymorphism in java.ppt
information on -inheritance-polymorphism in java.ppt
 
Functional Programming In Java
Functional Programming In JavaFunctional Programming In Java
Functional Programming In Java
 
Functional Programming In Java
Functional Programming In JavaFunctional Programming In Java
Functional Programming In Java
 

More from Universidad de los Andes

An expressive and modular layer activation mechanism for Context-Oriented Pro...
An expressive and modular layer activation mechanism for Context-Oriented Pro...An expressive and modular layer activation mechanism for Context-Oriented Pro...
An expressive and modular layer activation mechanism for Context-Oriented Pro...Universidad de los Andes
 
[JIST] Programming language implementations for context-oriented self-adaptiv...
[JIST] Programming language implementations for context-oriented self-adaptiv...[JIST] Programming language implementations for context-oriented self-adaptiv...
[JIST] Programming language implementations for context-oriented self-adaptiv...Universidad de los Andes
 
[CAIN'23] Prevalence of Code Smells in Reinforcement Learning Projects
[CAIN'23] Prevalence of Code Smells in Reinforcement Learning Projects[CAIN'23] Prevalence of Code Smells in Reinforcement Learning Projects
[CAIN'23] Prevalence of Code Smells in Reinforcement Learning ProjectsUniversidad de los Andes
 
[CIbSE2023] Cross-language clone detection for Mobile Apps
[CIbSE2023] Cross-language clone detection for Mobile Apps[CIbSE2023] Cross-language clone detection for Mobile Apps
[CIbSE2023] Cross-language clone detection for Mobile AppsUniversidad de los Andes
 
[JPDC,JCC@LMN22] Ad hoc systems Management and specification with distributed...
[JPDC,JCC@LMN22] Ad hoc systems Management and specification with distributed...[JPDC,JCC@LMN22] Ad hoc systems Management and specification with distributed...
[JPDC,JCC@LMN22] Ad hoc systems Management and specification with distributed...Universidad de los Andes
 
[CCC'21] Evaluation of Work Stealing Algorithms
[CCC'21] Evaluation of Work Stealing Algorithms[CCC'21] Evaluation of Work Stealing Algorithms
[CCC'21] Evaluation of Work Stealing AlgorithmsUniversidad de los Andes
 
Generating Adaptations from the System Execution using Reinforcement Learning...
Generating Adaptations from the System Execution using Reinforcement Learning...Generating Adaptations from the System Execution using Reinforcement Learning...
Generating Adaptations from the System Execution using Reinforcement Learning...Universidad de los Andes
 
Language Abstractions and Techniques for Developing Collective Adaptive Syste...
Language Abstractions and Techniques for Developing Collective Adaptive Syste...Language Abstractions and Techniques for Developing Collective Adaptive Syste...
Language Abstractions and Techniques for Developing Collective Adaptive Syste...Universidad de los Andes
 
Does Neuron Coverage Matter for Deep Reinforcement Learning? A preliminary study
Does Neuron Coverage Matter for Deep Reinforcement Learning? A preliminary studyDoes Neuron Coverage Matter for Deep Reinforcement Learning? A preliminary study
Does Neuron Coverage Matter for Deep Reinforcement Learning? A preliminary studyUniversidad de los Andes
 
Learning run-time composition of interacting adaptations
Learning run-time composition of interacting adaptationsLearning run-time composition of interacting adaptations
Learning run-time composition of interacting adaptationsUniversidad de los Andes
 
CQL: declarative language for context activation
CQL: declarative language for context activationCQL: declarative language for context activation
CQL: declarative language for context activationUniversidad de los Andes
 
Generating software adaptations using machine learning
Generating software adaptations using machine learningGenerating software adaptations using machine learning
Generating software adaptations using machine learningUniversidad de los Andes
 
[Bachelor_project] Asignación de exámenes finales
[Bachelor_project] Asignación de exámenes finales[Bachelor_project] Asignación de exámenes finales
[Bachelor_project] Asignación de exámenes finalesUniversidad de los Andes
 
Programming language techniques for adaptive software
Programming language techniques for adaptive softwareProgramming language techniques for adaptive software
Programming language techniques for adaptive softwareUniversidad de los Andes
 
Peace COrP: Learning to solve conflicts between contexts
Peace COrP: Learning to solve conflicts between contextsPeace COrP: Learning to solve conflicts between contexts
Peace COrP: Learning to solve conflicts between contextsUniversidad de los Andes
 

More from Universidad de los Andes (18)

An expressive and modular layer activation mechanism for Context-Oriented Pro...
An expressive and modular layer activation mechanism for Context-Oriented Pro...An expressive and modular layer activation mechanism for Context-Oriented Pro...
An expressive and modular layer activation mechanism for Context-Oriented Pro...
 
[JIST] Programming language implementations for context-oriented self-adaptiv...
[JIST] Programming language implementations for context-oriented self-adaptiv...[JIST] Programming language implementations for context-oriented self-adaptiv...
[JIST] Programming language implementations for context-oriented self-adaptiv...
 
[CAIN'23] Prevalence of Code Smells in Reinforcement Learning Projects
[CAIN'23] Prevalence of Code Smells in Reinforcement Learning Projects[CAIN'23] Prevalence of Code Smells in Reinforcement Learning Projects
[CAIN'23] Prevalence of Code Smells in Reinforcement Learning Projects
 
[CIbSE2023] Cross-language clone detection for Mobile Apps
[CIbSE2023] Cross-language clone detection for Mobile Apps[CIbSE2023] Cross-language clone detection for Mobile Apps
[CIbSE2023] Cross-language clone detection for Mobile Apps
 
Keeping Up! with LaTeX
Keeping Up! with LaTeXKeeping Up! with LaTeX
Keeping Up! with LaTeX
 
[JPDC,JCC@LMN22] Ad hoc systems Management and specification with distributed...
[JPDC,JCC@LMN22] Ad hoc systems Management and specification with distributed...[JPDC,JCC@LMN22] Ad hoc systems Management and specification with distributed...
[JPDC,JCC@LMN22] Ad hoc systems Management and specification with distributed...
 
[CCC'21] Evaluation of Work Stealing Algorithms
[CCC'21] Evaluation of Work Stealing Algorithms[CCC'21] Evaluation of Work Stealing Algorithms
[CCC'21] Evaluation of Work Stealing Algorithms
 
Generating Adaptations from the System Execution using Reinforcement Learning...
Generating Adaptations from the System Execution using Reinforcement Learning...Generating Adaptations from the System Execution using Reinforcement Learning...
Generating Adaptations from the System Execution using Reinforcement Learning...
 
Language Abstractions and Techniques for Developing Collective Adaptive Syste...
Language Abstractions and Techniques for Developing Collective Adaptive Syste...Language Abstractions and Techniques for Developing Collective Adaptive Syste...
Language Abstractions and Techniques for Developing Collective Adaptive Syste...
 
Does Neuron Coverage Matter for Deep Reinforcement Learning? A preliminary study
Does Neuron Coverage Matter for Deep Reinforcement Learning? A preliminary studyDoes Neuron Coverage Matter for Deep Reinforcement Learning? A preliminary study
Does Neuron Coverage Matter for Deep Reinforcement Learning? A preliminary study
 
Learning run-time composition of interacting adaptations
Learning run-time composition of interacting adaptationsLearning run-time composition of interacting adaptations
Learning run-time composition of interacting adaptations
 
Distributed context Petri nets
Distributed context Petri netsDistributed context Petri nets
Distributed context Petri nets
 
CQL: declarative language for context activation
CQL: declarative language for context activationCQL: declarative language for context activation
CQL: declarative language for context activation
 
Generating software adaptations using machine learning
Generating software adaptations using machine learningGenerating software adaptations using machine learning
Generating software adaptations using machine learning
 
[Bachelor_project] Asignación de exámenes finales
[Bachelor_project] Asignación de exámenes finales[Bachelor_project] Asignación de exámenes finales
[Bachelor_project] Asignación de exámenes finales
 
Programming language techniques for adaptive software
Programming language techniques for adaptive softwareProgramming language techniques for adaptive software
Programming language techniques for adaptive software
 
Peace COrP: Learning to solve conflicts between contexts
Peace COrP: Learning to solve conflicts between contextsPeace COrP: Learning to solve conflicts between contexts
Peace COrP: Learning to solve conflicts between contexts
 
Emergent Software Services
Emergent Software ServicesEmergent Software Services
Emergent Software Services
 

Recently uploaded

Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxAvyJaneVismanos
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
Blooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxBlooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxUnboundStockton
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
Class 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfClass 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfakmcokerachita
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,Virag Sontakke
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting DataJhengPantaleon
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxsocialsciencegdgrohi
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaVirag Sontakke
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsKarinaGenton
 

Recently uploaded (20)

Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptx
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
Blooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxBlooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docx
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
Class 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfClass 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdf
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of India
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its Characteristics
 

[FTfJP23] Points-to Analysis for Context-oriented Javascript Programs

  • 1. Points-to Analysis for Context- Oriented JavaScript Programs Sergio Cardenas, Paul Leger, Hiroaki Fukuda, Nicolás Cardozo Systems an Computing Engineering - Universidad de los Andes, Bogotá - Colombia Universidad Católica del Norte, Coquimbo - Chile Shibaura Institute of Technology, Tokyo - Japan se.cardenas@uniandes.edu.co, pleger@ucn.cl, hiroaki@shibaura-it.ac.jp, n.cardozo@uniandes.edu.co @ncardoz Formal Techniques for Java-like Programs - 18 / 07 / 2023
  • 2. Points-to analysis 2 Object first(Object o1, Object o2){ return o1; } Object second(Object o1, Object o2){ return first(o2, o1); } void f() { Object o1 = new Object(); Object o2 = new Object(); Object o3 = first(o1, o2); Object o4 = first(o2, o1); Object o5 = second(o1, o2); Object o6 = second(o2, o1); } f
  • 3. Points-to analysis 2 Object first(Object o1, Object o2){ return o1; } Object second(Object o1, Object o2){ return first(o2, o1); } void f() { Object o1 = new Object(); Object o2 = new Object(); Object o3 = first(o1, o2); Object o4 = first(o2, o1); Object o5 = second(o1, o2); Object o6 = second(o2, o1); } o1 inst1 f
  • 4. Points-to analysis 2 Object first(Object o1, Object o2){ return o1; } Object second(Object o1, Object o2){ return first(o2, o1); } void f() { Object o1 = new Object(); Object o2 = new Object(); Object o3 = first(o1, o2); Object o4 = first(o2, o1); Object o5 = second(o1, o2); Object o6 = second(o2, o1); } o1 o2 inst1 inst2 f
  • 5. Points-to analysis 2 Object first(Object o1, Object o2){ return o1; } Object second(Object o1, Object o2){ return first(o2, o1); } void f() { Object o1 = new Object(); Object o2 = new Object(); Object o3 = first(o1, o2); Object o4 = first(o2, o1); Object o5 = second(o1, o2); Object o6 = second(o2, o1); } o1 o2 inst1 inst2 o3 f first
  • 6. Points-to analysis 2 Object first(Object o1, Object o2){ return o1; } Object second(Object o1, Object o2){ return first(o2, o1); } void f() { Object o1 = new Object(); Object o2 = new Object(); Object o3 = first(o1, o2); Object o4 = first(o2, o1); Object o5 = second(o1, o2); Object o6 = second(o2, o1); } o1 o2 inst1 inst2 o3 inst1 f first
  • 7. Points-to analysis 2 Object first(Object o1, Object o2){ return o1; } Object second(Object o1, Object o2){ return first(o2, o1); } void f() { Object o1 = new Object(); Object o2 = new Object(); Object o3 = first(o1, o2); Object o4 = first(o2, o1); Object o5 = second(o1, o2); Object o6 = second(o2, o1); } o1 o2 inst1 inst2 o3 inst1 first inst1 inst2 ... f first
  • 8. 3 programs need to be more dynamic …
  • 9. 3 programs need to be more dynamic … … due to complex and changing requirements
  • 10. 3 programs need to be more dynamic … … due to complex and changing requirements new modularity abstractions
  • 11. 3 programs need to be more dynamic … … due to complex and changing requirements new modularity abstractions changing locations
  • 12. Context-oriented programming (COP) 4 Msg = { send: function(msg) { return msg; } };
  • 13. Context-oriented programming (COP) 4 Msg = { send: function(msg) { return msg; } }; Encryption = new cop.Context({}); EncryptionBehavior = Trait({ send: function(msg) { return "<E>" + this.proceed() + "<E>"; } });
  • 14. Context-oriented programming (COP) 4 Msg = { send: function(msg) { return msg; } }; Encryption = new cop.Context({}); EncryptionBehavior = Trait({ send: function(msg) { return "<E>" + this.proceed() + "<E>"; } }); Compression = new cop.Context({}); CompressionBehavior = Trait({ send: function(msg) { return "<C>" + this.proceed() + "<C>"; } });
  • 15. Context-oriented programming (COP) 4 Msg = { send: function(msg) { return msg; } }; Encryption = new cop.Context({}); EncryptionBehavior = Trait({ send: function(msg) { return "<E>" + this.proceed() + "<E>"; } }); Compression = new cop.Context({}); CompressionBehavior = Trait({ send: function(msg) { return "<C>" + this.proceed() + "<C>"; } }); Encryption.adapt(Msg, EncryptionBehavior); Compression.adapt(Msg, CompressionBehavior);
  • 16. Context-oriented programming (COP) 4 Msg = { send: function(msg) { return msg; } }; Encryption = new cop.Context({}); EncryptionBehavior = Trait({ send: function(msg) { return "<E>" + this.proceed() + "<E>"; } }); Compression = new cop.Context({}); CompressionBehavior = Trait({ send: function(msg) { return "<C>" + this.proceed() + "<C>"; } }); Encryption.adapt(Msg, EncryptionBehavior); Compression.adapt(Msg, CompressionBehavior); Encryption.activate();
  • 17. Context-oriented programming (COP) 4 Msg = { send: function(msg) { return msg; } }; Encryption = new cop.Context({}); EncryptionBehavior = Trait({ send: function(msg) { return "<E>" + this.proceed() + "<E>"; } }); Compression = new cop.Context({}); CompressionBehavior = Trait({ send: function(msg) { return "<C>" + this.proceed() + "<C>"; } }); Encryption.adapt(Msg, EncryptionBehavior); Compression.adapt(Msg, CompressionBehavior); Encryption.activate(); Compression.activate();
  • 19. Context-oriented programming (COP) 5 Msg = { send: function(msg) { return msg; } }; Encryption = new cop.Context({}); EncryptionBehavior = Trait({ send: function(msg) { return "<E>" + this.proceed() + "<E>"; } }); Compression = new cop.Context({}); CompressionBehavior = Trait({ send: function(msg) { return "<C>" + this.proceed() + "<C>"; } }); msg = Msg(); msg.send(42);
  • 20. 6 Base analysis precise and efficient to determine different properties about dynamic programs in COP
  • 22. Analyzing COP programs 7 COP program Context.adapt(object1, trait1) Context.adapt(object2, trait1) Context.adapt(objectn, traitm) … 1. tuple extraction ⟨ctx, trait, obj⟩
  • 23. Analyzing COP programs 7 COP program Context.adapt(object1, trait1) Context.adapt(object2, trait1) Context.adapt(objectn, traitm) … 1. tuple extraction ⟨ctx, trait, obj⟩ 2. Code transformation
  • 24. Analyzing COP programs 7 COP program Context.adapt(object1, trait1) Context.adapt(object2, trait1) Context.adapt(objectn, traitm) … 1. tuple extraction ⟨ctx, trait, obj⟩ 2. Code transformation 3. Field-sensitive correlation tracking analysis
  • 25. Context identification and transformation 8 Encryption.adapt(Msg, EncryptionBehavior); Encryption.activate(); Encryption = new cop.Context({}); EncryptionBehavior = Trait({ send: function(msg) { return "<E>" + this.proceed() + "<E>"; } });
  • 26. Context identification and transformation 9 Encryption.adapt(Msg, EncryptionBehavior); Encryption.activate(); Encryption = new cop.Context({}); EncryptionBehavior = Trait({ send: function(msg) { return "<E>" + this.proceed() + "<E>"; } });
  • 27. Context identification and transformation 9 Encryption.adapt(Msg, EncryptionBehavior); Encryption.activate(); Encryption = new cop.Context({}); EncryptionBehavior = Trait({ send: function(msg) { return "<E>" + this.proceed() + "<E>"; } }); o = { send: function() { return "<E>" + this.proceed() + “<E>"; } } EncryptionBehavior = Trait(o); EncryptionBehavior.obj = o;
  • 28. Context identification and transformation 10 Encryption.adapt(Msg, EncryptionBehavior); Encryption.activate(); Encryption = new cop.Context({}); EncryptionBehavior = Trait({ send: function(msg) { return "<E>" + this.proceed() + "<E>"; } });
  • 29. Context identification and transformation 10 Encryption.adapt(Msg, EncryptionBehavior); Encryption.activate(); Encryption = new cop.Context({}); EncryptionBehavior = Trait({ send: function(msg) { return "<E>" + this.proceed() + "<E>"; } }); Encryption.adaptation1 = { obj: Msg, trait: EncryptionBehavior }
  • 30. Context identification and transformation 11 Encryption.adapt(Msg, EncryptionBehavior); Encryption.activate(); Encryption = new cop.Context({}); EncryptionBehavior = Trait({ send: function(msg) { return "<E>" + this.proceed() + "<E>"; } });
  • 31. Context identification and transformation 11 Encryption.adapt(Msg, EncryptionBehavior); Encryption.activate(); Encryption = new cop.Context({}); EncryptionBehavior = Trait({ send: function(msg) { return "<E>" + this.proceed() + "<E>"; } }); for(var p in Encryption.adaptation1.trait.obj) { (function (prop) { Encryption.adaptation1.obj[prop] = Encryption.adaptation1.trait.obj[prop]; })(p); }
  • 32. 12 Experiments use four different applications comparing field-sensitive analysis and our extension hello-world.js shape-polymorphism.js video-encoder.js course-management.js https:// fl aglab.github.io/AdaptiveSystemAnalysis/
  • 33. Precision evaluation 13 Shape = { b: 2, h: 3, type: "shape", getType: function() { return this.type; }, area: function() { return 'Calling an abstract method area’; }, perimeter: function() { return 'Calling an abstract method perimeter’; }, numberOfSides: function() { return 0; } }; Triangle = new cop.Context({}); TriangleBehavior = cop.Trait({ getType: function() { return “triangle"; }, area: function() { return this.b * this.h/2; }, perimeter: function() { return this.b + 2*Math.sqrt(Math.pow(this.h,2) + Math.pow(this.b/2, 2)); }, numberOfSides: function() { return 3; } }); Triangle.adapt(TShape, TriangleBehavior); Circle = new cop.Context({}); CircleBehavior = cop.Trait({ getType: function() { return “circle"; }, area: function() { return Math.pow(this.b, 2) * Math.PI; }, perimeter: function() { return this.b * 2* Math.PI; }, numberOfSides: function() { throw new Error("Number of sides is not defined in a circle"); } }); Circle.adapt(Shape, CircleBehavior); baseline ours r1 r2 r3 r4 r6 r5 r7 r8 r9
  • 34. Precision evaluation 13 Shape = { b: 2, h: 3, type: "shape", getType: function() { return this.type; }, area: function() { return 'Calling an abstract method area’; }, perimeter: function() { return 'Calling an abstract method perimeter’; }, numberOfSides: function() { return 0; } }; Triangle = new cop.Context({}); TriangleBehavior = cop.Trait({ getType: function() { return “triangle"; }, area: function() { return this.b * this.h/2; }, perimeter: function() { return this.b + 2*Math.sqrt(Math.pow(this.h,2) + Math.pow(this.b/2, 2)); }, numberOfSides: function() { return 3; } }); Triangle.adapt(TShape, TriangleBehavior); Circle = new cop.Context({}); CircleBehavior = cop.Trait({ getType: function() { return “circle"; }, area: function() { return Math.pow(this.b, 2) * Math.PI; }, perimeter: function() { return this.b * 2* Math.PI; }, numberOfSides: function() { throw new Error("Number of sides is not defined in a circle"); } }); Circle.adapt(Shape, CircleBehavior); area baseline ours r1 r1 r2 r3 r4 r6 r5 r7 r8 r9
  • 35. Precision evaluation 13 Shape = { b: 2, h: 3, type: "shape", getType: function() { return this.type; }, area: function() { return 'Calling an abstract method area’; }, perimeter: function() { return 'Calling an abstract method perimeter’; }, numberOfSides: function() { return 0; } }; Triangle = new cop.Context({}); TriangleBehavior = cop.Trait({ getType: function() { return “triangle"; }, area: function() { return this.b * this.h/2; }, perimeter: function() { return this.b + 2*Math.sqrt(Math.pow(this.h,2) + Math.pow(this.b/2, 2)); }, numberOfSides: function() { return 3; } }); Triangle.adapt(TShape, TriangleBehavior); Circle = new cop.Context({}); CircleBehavior = cop.Trait({ getType: function() { return “circle"; }, area: function() { return Math.pow(this.b, 2) * Math.PI; }, perimeter: function() { return this.b * 2* Math.PI; }, numberOfSides: function() { throw new Error("Number of sides is not defined in a circle"); } }); Circle.adapt(Shape, CircleBehavior); area baseline ours r1 r1 r2 r3 r4 r6 r5 r1 r3 r6 r7 r8 r9 area
  • 36. Precision evaluation 14 Shape = { b: 2, h: 3, type: "shape", getType: function() { return this.type; }, area: function() { return 'Calling an abstract method area’; }, perimeter: function() { return 'Calling an abstract method perimeter’; }, numberOfSides: function() { return 0; } }; Triangle = new cop.Context({}); TriangleBehavior = cop.Trait({ getType: function() { return “triangle"; }, area: function() { return this.b * this.h/2; }, perimeter: function() { return this.b + 2*Math.sqrt(Math.pow(this.h,2) + Math.pow(this.b/2, 2)); }, numberOfSides: function() { return 3; } }); Triangle.adapt(TShape, TriangleBehavior); Circle = new cop.Context({}); CircleBehavior = cop.Trait({ getType: function() { return “circle"; }, area: function() { return Math.pow(this.b, 2) * Math.PI; }, perimeter: function() { return this.b * 2* Math.PI; }, numberOfSides: function() { throw new Error("Number of sides is not defined in a circle"); } }); Circle.adapt(Shape, CircleBehavior); baseline ours r1 r2 r3 r4 r6 r5 r7 r8 r9
  • 37. Precision evaluation 14 Shape = { b: 2, h: 3, type: "shape", getType: function() { return this.type; }, area: function() { return 'Calling an abstract method area’; }, perimeter: function() { return 'Calling an abstract method perimeter’; }, numberOfSides: function() { return 0; } }; Triangle = new cop.Context({}); TriangleBehavior = cop.Trait({ getType: function() { return “triangle"; }, area: function() { return this.b * this.h/2; }, perimeter: function() { return this.b + 2*Math.sqrt(Math.pow(this.h,2) + Math.pow(this.b/2, 2)); }, numberOfSides: function() { return 3; } }); Triangle.adapt(TShape, TriangleBehavior); Circle = new cop.Context({}); CircleBehavior = cop.Trait({ getType: function() { return “circle"; }, area: function() { return Math.pow(this.b, 2) * Math.PI; }, perimeter: function() { return this.b * 2* Math.PI; }, numberOfSides: function() { throw new Error("Number of sides is not defined in a circle"); } }); Circle.adapt(Shape, CircleBehavior); sides baseline ours r9 r1 r2 r3 r4 r6 r5 r7 r8 r9
  • 38. Precision evaluation 14 Shape = { b: 2, h: 3, type: "shape", getType: function() { return this.type; }, area: function() { return 'Calling an abstract method area’; }, perimeter: function() { return 'Calling an abstract method perimeter’; }, numberOfSides: function() { return 0; } }; Triangle = new cop.Context({}); TriangleBehavior = cop.Trait({ getType: function() { return “triangle"; }, area: function() { return this.b * this.h/2; }, perimeter: function() { return this.b + 2*Math.sqrt(Math.pow(this.h,2) + Math.pow(this.b/2, 2)); }, numberOfSides: function() { return 3; } }); Triangle.adapt(TShape, TriangleBehavior); Circle = new cop.Context({}); CircleBehavior = cop.Trait({ getType: function() { return “circle"; }, area: function() { return Math.pow(this.b, 2) * Math.PI; }, perimeter: function() { return this.b * 2* Math.PI; }, numberOfSides: function() { throw new Error("Number of sides is not defined in a circle"); } }); Circle.adapt(Shape, CircleBehavior); sides baseline ours r9 r1 r2 r3 r4 r6 r5 r8 r7 r9 r7 r8 r9 sides
  • 39. The road ahead … adaptation completeness 15 Context1 = new cop.Context({}); Behavior1 = cop.Trait({ foo: function() ... }); Context1.adapt(Object, Behavior1); Context2 = new cop.Context({}); Behavior2 = cop.Trait({ bar: function(){ baz(); foo(); } }); Context2.adapt(Object, Behavior2); Object = { baz: function() ... };
  • 40. The road ahead … adaptation completeness 15 Context1 = new cop.Context({}); Behavior1 = cop.Trait({ foo: function() ... }); Context1.adapt(Object, Behavior1); Context2 = new cop.Context({}); Behavior2 = cop.Trait({ bar: function(){ baz(); foo(); } }); Context2.adapt(Object, Behavior2); Object = { baz: function() ... }; Context1.activate(); Context2.activate(); bar(); 1.
  • 41. The road ahead … adaptation completeness 15 Context1 = new cop.Context({}); Behavior1 = cop.Trait({ foo: function() ... }); Context1.adapt(Object, Behavior1); Context2 = new cop.Context({}); Behavior2 = cop.Trait({ bar: function(){ baz(); foo(); } }); Context2.adapt(Object, Behavior2); Object = { baz: function() ... }; Context1.activate(); Context2.activate(); bar(); Context2.activate(); bar(); 1. 2.
  • 42. The road ahead … adaptation completeness 15 Context1 = new cop.Context({}); Behavior1 = cop.Trait({ foo: function() ... }); Context1.adapt(Object, Behavior1); Context2 = new cop.Context({}); Behavior2 = cop.Trait({ bar: function(){ baz(); foo(); } }); Context2.adapt(Object, Behavior2); Object = { baz: function() ... }; Context1.activate(); Context2.activate(); bar(); Context2.activate(); bar(); 1. 2.
  • 44. Conclusion 16 @ncardoz COP analysis framework First analysis taking into account the modularity and dynamic aspects of COP
  • 45. Conclusion 16 @ncardoz COP analysis framework First analysis taking into account the modularity and dynamic aspects of COP Improved recall for COP programs (without proceed)