a delta-oriented approach to support the safe reuse of...
TRANSCRIPT
![Page 1: A Delta-Oriented Approach to Support the Safe Reuse of ...mosser/old-ws/_media/research/icsr18.pdf · A Delta-Oriented Approach to Support the Safe Reuse of Black-Box Code Rewriters](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed132a39ec4dc3eac4afa87/html5/thumbnails/1.jpg)
A Delta-Oriented Approach to Support the Safe Reuse of Black-Box Code Rewriters
The 17th International Conference on Software Reuse, May 21-23, 2018
Benjamin Benni, Sébastien Mosser, Naouel Moha, Michel Riveill
�1
![Page 2: A Delta-Oriented Approach to Support the Safe Reuse of ...mosser/old-ws/_media/research/icsr18.pdf · A Delta-Oriented Approach to Support the Safe Reuse of Black-Box Code Rewriters](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed132a39ec4dc3eac4afa87/html5/thumbnails/2.jpg)
753,347 commits
203 open PR, 324 closed
~ 3 (massive) commits per day!2 Context Contribution Validation Conclusion
![Page 3: A Delta-Oriented Approach to Support the Safe Reuse of ...mosser/old-ws/_media/research/icsr18.pdf · A Delta-Oriented Approach to Support the Safe Reuse of Black-Box Code Rewriters](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed132a39ec4dc3eac4afa87/html5/thumbnails/3.jpg)
change
change
changechangechange
change
!3
![Page 4: A Delta-Oriented Approach to Support the Safe Reuse of ...mosser/old-ws/_media/research/icsr18.pdf · A Delta-Oriented Approach to Support the Safe Reuse of Black-Box Code Rewriters](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed132a39ec4dc3eac4afa87/html5/thumbnails/4.jpg)
change
change
changechangechange
change
API change Documentation change
New features Standard may evolve
Driver change Bug fixing
…
!4
![Page 5: A Delta-Oriented Approach to Support the Safe Reuse of ...mosser/old-ws/_media/research/icsr18.pdf · A Delta-Oriented Approach to Support the Safe Reuse of Black-Box Code Rewriters](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed132a39ec4dc3eac4afa87/html5/thumbnails/5.jpg)
Massive codebase
Recurring problems in the changes
From manual to automatic rewritings
!5
![Page 6: A Delta-Oriented Approach to Support the Safe Reuse of ...mosser/old-ws/_media/research/icsr18.pdf · A Delta-Oriented Approach to Support the Safe Reuse of Black-Box Code Rewriters](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed132a39ec4dc3eac4afa87/html5/thumbnails/6.jpg)
… x = kmalloc(sizeof(*a), 0); memset(a, 0, sizeof(*a)) …
Change extract
kzalloc has been added for this very particular reason
Don’t want to reject the whole request for this Automatic check? Automatic rewriting?
!6
![Page 7: A Delta-Oriented Approach to Support the Safe Reuse of ...mosser/old-ws/_media/research/icsr18.pdf · A Delta-Oriented Approach to Support the Safe Reuse of Black-Box Code Rewriters](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed132a39ec4dc3eac4afa87/html5/thumbnails/7.jpg)
… x = kmalloc(sizeof(*a), 0); memset(a, 0, sizeof(*a)) …
Desired mechanism
… x = kzalloc(sizeof(*a), 0); …
This is automatic, and reusable. ie: input-independent and self-
sufficient
!7
![Page 8: A Delta-Oriented Approach to Support the Safe Reuse of ...mosser/old-ws/_media/research/icsr18.pdf · A Delta-Oriented Approach to Support the Safe Reuse of Black-Box Code Rewriters](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed132a39ec4dc3eac4afa87/html5/thumbnails/8.jpg)
… x = kmalloc(sizeof(*a), 0); memset(a, 0, sizeof(*a)) …
Change extract
…kernel developers implemented so-called semantic patch for this.
We have code rewriters to rewrite this…
We want automatic rewritings
!8
![Page 9: A Delta-Oriented Approach to Support the Safe Reuse of ...mosser/old-ws/_media/research/icsr18.pdf · A Delta-Oriented Approach to Support the Safe Reuse of Black-Box Code Rewriters](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed132a39ec4dc3eac4afa87/html5/thumbnails/9.jpg)
Code rewriter definition
P : Program ↦ Program
!9
![Page 10: A Delta-Oriented Approach to Support the Safe Reuse of ...mosser/old-ws/_media/research/icsr18.pdf · A Delta-Oriented Approach to Support the Safe Reuse of Black-Box Code Rewriters](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed132a39ec4dc3eac4afa87/html5/thumbnails/10.jpg)
Black-box Code rewriters
P : Program ↦ Program
We can’t open it and see what is inside, …
!10
![Page 11: A Delta-Oriented Approach to Support the Safe Reuse of ...mosser/old-ws/_media/research/icsr18.pdf · A Delta-Oriented Approach to Support the Safe Reuse of Black-Box Code Rewriters](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed132a39ec4dc3eac4afa87/html5/thumbnails/11.jpg)
Reuse of black-box code rewriters
P : Program ↦Program
We want to reuse those rewriters, and apply them to every incoming
changes!11
![Page 12: A Delta-Oriented Approach to Support the Safe Reuse of ...mosser/old-ws/_media/research/icsr18.pdf · A Delta-Oriented Approach to Support the Safe Reuse of Black-Box Code Rewriters](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed132a39ec4dc3eac4afa87/html5/thumbnails/12.jpg)
1) Does what it is supposed to do when applied with others
(side effect)
2) No syntactic issues between rewriters (interactions, overlaps)
Safe-reuse of black-box code rewriters
!12
![Page 13: A Delta-Oriented Approach to Support the Safe Reuse of ...mosser/old-ws/_media/research/icsr18.pdf · A Delta-Oriented Approach to Support the Safe Reuse of Black-Box Code Rewriters](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed132a39ec4dc3eac4afa87/html5/thumbnails/13.jpg)
http://coccinelle.lip6.fr/Lawal, Muller and al.!13
![Page 14: A Delta-Oriented Approach to Support the Safe Reuse of ...mosser/old-ws/_media/research/icsr18.pdf · A Delta-Oriented Approach to Support the Safe Reuse of Black-Box Code Rewriters](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed132a39ec4dc3eac4afa87/html5/thumbnails/14.jpg)
Rewriters
Base-code exampleSo called “ semantic patches”
!14
![Page 15: A Delta-Oriented Approach to Support the Safe Reuse of ...mosser/old-ws/_media/research/icsr18.pdf · A Delta-Oriented Approach to Support the Safe Reuse of Black-Box Code Rewriters](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed132a39ec4dc3eac4afa87/html5/thumbnails/15.jpg)
Rewriters
Base-code example
!15
![Page 16: A Delta-Oriented Approach to Support the Safe Reuse of ...mosser/old-ws/_media/research/icsr18.pdf · A Delta-Oriented Approach to Support the Safe Reuse of Black-Box Code Rewriters](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed132a39ec4dc3eac4afa87/html5/thumbnails/16.jpg)
Rewriters
Base-code example
!16
![Page 17: A Delta-Oriented Approach to Support the Safe Reuse of ...mosser/old-ws/_media/research/icsr18.pdf · A Delta-Oriented Approach to Support the Safe Reuse of Black-Box Code Rewriters](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed132a39ec4dc3eac4afa87/html5/thumbnails/17.jpg)
Rewriters
Base-code example
!17
![Page 18: A Delta-Oriented Approach to Support the Safe Reuse of ...mosser/old-ws/_media/research/icsr18.pdf · A Delta-Oriented Approach to Support the Safe Reuse of Black-Box Code Rewriters](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed132a39ec4dc3eac4afa87/html5/thumbnails/18.jpg)
Rewriters
Base-code example
!18
![Page 19: A Delta-Oriented Approach to Support the Safe Reuse of ...mosser/old-ws/_media/research/icsr18.pdf · A Delta-Oriented Approach to Support the Safe Reuse of Black-Box Code Rewriters](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed132a39ec4dc3eac4afa87/html5/thumbnails/19.jpg)
Rewriters
Base-code example
!19
![Page 20: A Delta-Oriented Approach to Support the Safe Reuse of ...mosser/old-ws/_media/research/icsr18.pdf · A Delta-Oriented Approach to Support the Safe Reuse of Black-Box Code Rewriters](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed132a39ec4dc3eac4afa87/html5/thumbnails/20.jpg)
Rewriters
Base-code example
!20
![Page 21: A Delta-Oriented Approach to Support the Safe Reuse of ...mosser/old-ws/_media/research/icsr18.pdf · A Delta-Oriented Approach to Support the Safe Reuse of Black-Box Code Rewriters](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed132a39ec4dc3eac4afa87/html5/thumbnails/21.jpg)
Rewriters
Base-code example
!21
![Page 22: A Delta-Oriented Approach to Support the Safe Reuse of ...mosser/old-ws/_media/research/icsr18.pdf · A Delta-Oriented Approach to Support the Safe Reuse of Black-Box Code Rewriters](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed132a39ec4dc3eac4afa87/html5/thumbnails/22.jpg)
Rewriters
Base-code example
Toy example
!22
![Page 23: A Delta-Oriented Approach to Support the Safe Reuse of ...mosser/old-ws/_media/research/icsr18.pdf · A Delta-Oriented Approach to Support the Safe Reuse of Black-Box Code Rewriters](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed132a39ec4dc3eac4afa87/html5/thumbnails/23.jpg)
!23
![Page 24: A Delta-Oriented Approach to Support the Safe Reuse of ...mosser/old-ws/_media/research/icsr18.pdf · A Delta-Oriented Approach to Support the Safe Reuse of Black-Box Code Rewriters](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed132a39ec4dc3eac4afa87/html5/thumbnails/24.jpg)
!24
![Page 25: A Delta-Oriented Approach to Support the Safe Reuse of ...mosser/old-ws/_media/research/icsr18.pdf · A Delta-Oriented Approach to Support the Safe Reuse of Black-Box Code Rewriters](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed132a39ec4dc3eac4afa87/html5/thumbnails/25.jpg)
!25
![Page 26: A Delta-Oriented Approach to Support the Safe Reuse of ...mosser/old-ws/_media/research/icsr18.pdf · A Delta-Oriented Approach to Support the Safe Reuse of Black-Box Code Rewriters](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed132a39ec4dc3eac4afa87/html5/thumbnails/26.jpg)
!26
![Page 27: A Delta-Oriented Approach to Support the Safe Reuse of ...mosser/old-ws/_media/research/icsr18.pdf · A Delta-Oriented Approach to Support the Safe Reuse of Black-Box Code Rewriters](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed132a39ec4dc3eac4afa87/html5/thumbnails/27.jpg)
≡
!27
![Page 28: A Delta-Oriented Approach to Support the Safe Reuse of ...mosser/old-ws/_media/research/icsr18.pdf · A Delta-Oriented Approach to Support the Safe Reuse of Black-Box Code Rewriters](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed132a39ec4dc3eac4afa87/html5/thumbnails/28.jpg)
≡
!28
![Page 29: A Delta-Oriented Approach to Support the Safe Reuse of ...mosser/old-ws/_media/research/icsr18.pdf · A Delta-Oriented Approach to Support the Safe Reuse of Black-Box Code Rewriters](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed132a39ec4dc3eac4afa87/html5/thumbnails/29.jpg)
≡
Initial intent not respected because of interactions
!29
![Page 30: A Delta-Oriented Approach to Support the Safe Reuse of ...mosser/old-ws/_media/research/icsr18.pdf · A Delta-Oriented Approach to Support the Safe Reuse of Black-Box Code Rewriters](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed132a39ec4dc3eac4afa87/html5/thumbnails/30.jpg)
≡
!30
![Page 31: A Delta-Oriented Approach to Support the Safe Reuse of ...mosser/old-ws/_media/research/icsr18.pdf · A Delta-Oriented Approach to Support the Safe Reuse of Black-Box Code Rewriters](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed132a39ec4dc3eac4afa87/html5/thumbnails/31.jpg)
≡
!31
![Page 32: A Delta-Oriented Approach to Support the Safe Reuse of ...mosser/old-ws/_media/research/icsr18.pdf · A Delta-Oriented Approach to Support the Safe Reuse of Black-Box Code Rewriters](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed132a39ec4dc3eac4afa87/html5/thumbnails/32.jpg)
≡
≡z
!32
![Page 33: A Delta-Oriented Approach to Support the Safe Reuse of ...mosser/old-ws/_media/research/icsr18.pdf · A Delta-Oriented Approach to Support the Safe Reuse of Black-Box Code Rewriters](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed132a39ec4dc3eac4afa87/html5/thumbnails/33.jpg)
≡
≡z
!33
![Page 34: A Delta-Oriented Approach to Support the Safe Reuse of ...mosser/old-ws/_media/research/icsr18.pdf · A Delta-Oriented Approach to Support the Safe Reuse of Black-Box Code Rewriters](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed132a39ec4dc3eac4afa87/html5/thumbnails/34.jpg)
≡
≡z
1) We can’t compute every possible sequences and analyse the outcome
2) Today, only the last application is “ensured” => silenced error
!34
![Page 35: A Delta-Oriented Approach to Support the Safe Reuse of ...mosser/old-ws/_media/research/icsr18.pdf · A Delta-Oriented Approach to Support the Safe Reuse of Black-Box Code Rewriters](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed132a39ec4dc3eac4afa87/html5/thumbnails/35.jpg)
1) Does what it is supposed to do when applied with others
(side effect)
2) No syntactic issues between rewriters (interactions, overlaps)
Safe-reuse of black-box code rewriters
!35 Context Contribution Validation Conclusion
![Page 36: A Delta-Oriented Approach to Support the Safe Reuse of ...mosser/old-ws/_media/research/icsr18.pdf · A Delta-Oriented Approach to Support the Safe Reuse of Black-Box Code Rewriters](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed132a39ec4dc3eac4afa87/html5/thumbnails/36.jpg)
If code rewriters are …
P : Program ↦ Program …We can’t do much
!36
![Page 37: A Delta-Oriented Approach to Support the Safe Reuse of ...mosser/old-ws/_media/research/icsr18.pdf · A Delta-Oriented Approach to Support the Safe Reuse of Black-Box Code Rewriters](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed132a39ec4dc3eac4afa87/html5/thumbnails/37.jpg)
P : Program ↦ Program’
Code rewriter 𝝆 is a pair (𝛗, 𝛘)
𝛗 : AST ↦ AST (the rewriter part)
𝛘 : AST x AST ↦ 𝔹 (the checking part - postcondition)
!37
![Page 38: A Delta-Oriented Approach to Support the Safe Reuse of ...mosser/old-ws/_media/research/icsr18.pdf · A Delta-Oriented Approach to Support the Safe Reuse of Black-Box Code Rewriters](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed132a39ec4dc3eac4afa87/html5/thumbnails/38.jpg)
P : Program ↦ Program’
Code rewriter 𝝆 is a pair (𝛗, 𝛘)
AST
Program Program
Reasoning
real-life
!38
![Page 39: A Delta-Oriented Approach to Support the Safe Reuse of ...mosser/old-ws/_media/research/icsr18.pdf · A Delta-Oriented Approach to Support the Safe Reuse of Black-Box Code Rewriters](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed132a39ec4dc3eac4afa87/html5/thumbnails/39.jpg)
P : Program ↦ Program’ 𝝆 = (𝛗, 𝛘)
Iso-functional
apply : AST x P<* ↦ AST
output = 𝛗(𝛗(input)) ; 𝛘 (output, input) holds
!39
![Page 40: A Delta-Oriented Approach to Support the Safe Reuse of ...mosser/old-ws/_media/research/icsr18.pdf · A Delta-Oriented Approach to Support the Safe Reuse of Black-Box Code Rewriters](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed132a39ec4dc3eac4afa87/html5/thumbnails/40.jpg)
P : Program ↦ Program’ 𝝆 = (𝛗, 𝛘)
seq : AST x P<* ↦ AST
output = 𝛗(𝛗(input)) ;
𝛘 (output, input) AND 𝛘 (output, input) holds
apply
Post-conditions check of all rewriters!40
![Page 41: A Delta-Oriented Approach to Support the Safe Reuse of ...mosser/old-ws/_media/research/icsr18.pdf · A Delta-Oriented Approach to Support the Safe Reuse of Black-Box Code Rewriters](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed132a39ec4dc3eac4afa87/html5/thumbnails/41.jpg)
≡
≡z
The seq operator allows us to outline an issue that was
silenced before
!41
![Page 42: A Delta-Oriented Approach to Support the Safe Reuse of ...mosser/old-ws/_media/research/icsr18.pdf · A Delta-Oriented Approach to Support the Safe Reuse of Black-Box Code Rewriters](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed132a39ec4dc3eac4afa87/html5/thumbnails/42.jpg)
P : Program ↦ Program’ 𝝆 = (𝛗, 𝛘) apply seq
P : Program ↦ Program’
We are still considering
What if…
!42
![Page 43: A Delta-Oriented Approach to Support the Safe Reuse of ...mosser/old-ws/_media/research/icsr18.pdf · A Delta-Oriented Approach to Support the Safe Reuse of Black-Box Code Rewriters](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed132a39ec4dc3eac4afa87/html5/thumbnails/43.jpg)
What if…
It exists ⊖, a diff function:
⊖(Program, Program) ↦ Delta<*
P : Program ↦ Program’ 𝝆 = (𝛗, 𝛘) apply seq
!43
![Page 44: A Delta-Oriented Approach to Support the Safe Reuse of ...mosser/old-ws/_media/research/icsr18.pdf · A Delta-Oriented Approach to Support the Safe Reuse of Black-Box Code Rewriters](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed132a39ec4dc3eac4afa87/html5/thumbnails/44.jpg)
P : Program ↦ Program’ 𝝆 = (𝛗, 𝛘) apply seq
⊖(Program, Program) ↦ Delta<*
output = 𝛗(input) Deltas = ⊖(input, output) input ⊕ Deltas = output
!44
![Page 45: A Delta-Oriented Approach to Support the Safe Reuse of ...mosser/old-ws/_media/research/icsr18.pdf · A Delta-Oriented Approach to Support the Safe Reuse of Black-Box Code Rewriters](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed132a39ec4dc3eac4afa87/html5/thumbnails/45.jpg)
P : Program ↦ Program’ 𝝆 = (𝛗, 𝛘) apply seq
output = 𝛗(input) Deltas = ⊖(input, output) input ⊕ Deltas => output
output = 𝛗(input) Deltas = ⊖(input, output) input ⊕ Deltas => output
Deltas ; Deltas
input ⊕ (Deltas ; Deltas) => output
𝛘 (output, input) AND 𝛘 (output, input) holds!45
![Page 46: A Delta-Oriented Approach to Support the Safe Reuse of ...mosser/old-ws/_media/research/icsr18.pdf · A Delta-Oriented Approach to Support the Safe Reuse of Black-Box Code Rewriters](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed132a39ec4dc3eac4afa87/html5/thumbnails/46.jpg)
P : Program ↦ Program’ 𝝆 = (𝛗, 𝛘) apply seq
Isolated applications of rewriters
iso : AST x P* ↦ AST
p , {𝝆1, …, 𝝆n} ↦ pisoDelta
!46
![Page 47: A Delta-Oriented Approach to Support the Safe Reuse of ...mosser/old-ws/_media/research/icsr18.pdf · A Delta-Oriented Approach to Support the Safe Reuse of Black-Box Code Rewriters](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed132a39ec4dc3eac4afa87/html5/thumbnails/47.jpg)
≡
≡z
The iso operator allows us to create a valid output program by ensuring isolations and delaying of rewriters applications and checking all post-
conditions, or outlining incompatible rewriters
!47
![Page 48: A Delta-Oriented Approach to Support the Safe Reuse of ...mosser/old-ws/_media/research/icsr18.pdf · A Delta-Oriented Approach to Support the Safe Reuse of Black-Box Code Rewriters](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed132a39ec4dc3eac4afa87/html5/thumbnails/48.jpg)
True for main languages (diff for Linux or Gumtree for Android)
P : Program ↦ Program’ 𝝆 = (𝛗, 𝛘) apply seq
⊖(Program, Program) ↦ Delta<*
iso
Hypothesis:
!48
![Page 49: A Delta-Oriented Approach to Support the Safe Reuse of ...mosser/old-ws/_media/research/icsr18.pdf · A Delta-Oriented Approach to Support the Safe Reuse of Black-Box Code Rewriters](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed132a39ec4dc3eac4afa87/html5/thumbnails/49.jpg)
Reduce conflict spaceoutput = 𝛗(input)
Deltas = ⊖(input, output) input ⊕ Deltas => output
output = 𝛗(input) Deltas = ⊖(input, output) input ⊕ Deltas => output
conflict? : Delta x Delta ↦ 𝔹
Eg: [setVisibility(method1, private), addStatement(…), …] [setVisibility(method1, public), addAttribute(…), …]
!49
![Page 50: A Delta-Oriented Approach to Support the Safe Reuse of ...mosser/old-ws/_media/research/icsr18.pdf · A Delta-Oriented Approach to Support the Safe Reuse of Black-Box Code Rewriters](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed132a39ec4dc3eac4afa87/html5/thumbnails/50.jpg)
Challenges
ΔΔ
AND ( 𝟀( M, M’ ), 𝟀( M, M’ ) )
conflict? (Δ , Δ)
apply ( Δ;Δ , M )M’
!50
![Page 51: A Delta-Oriented Approach to Support the Safe Reuse of ...mosser/old-ws/_media/research/icsr18.pdf · A Delta-Oriented Approach to Support the Safe Reuse of Black-Box Code Rewriters](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed132a39ec4dc3eac4afa87/html5/thumbnails/51.jpg)
Reduce conflict space
If isolated application failed, because a post condition is violated, start to analyse this very rewriter’s.
Incompatible application?
!51
![Page 52: A Delta-Oriented Approach to Support the Safe Reuse of ...mosser/old-ws/_media/research/icsr18.pdf · A Delta-Oriented Approach to Support the Safe Reuse of Black-Box Code Rewriters](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed132a39ec4dc3eac4afa87/html5/thumbnails/52.jpg)
Our contribution is not techno-specific
!52 Context Contribution Validation Conclusion
![Page 53: A Delta-Oriented Approach to Support the Safe Reuse of ...mosser/old-ws/_media/research/icsr18.pdf · A Delta-Oriented Approach to Support the Safe Reuse of Black-Box Code Rewriters](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed132a39ec4dc3eac4afa87/html5/thumbnails/53.jpg)
R-E-U-S-E
From patches in Coccinnelle Linux-kernel tool…
…to correction of power-consuming anti-patterns in Android app
!53
![Page 54: A Delta-Oriented Approach to Support the Safe Reuse of ...mosser/old-ws/_media/research/icsr18.pdf · A Delta-Oriented Approach to Support the Safe Reuse of Black-Box Code Rewriters](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed132a39ec4dc3eac4afa87/html5/thumbnails/54.jpg)
Correction of power-consuming anti-patterns in Android app
Collaboration with Naouel Moha
!54
![Page 55: A Delta-Oriented Approach to Support the Safe Reuse of ...mosser/old-ws/_media/research/icsr18.pdf · A Delta-Oriented Approach to Support the Safe Reuse of Black-Box Code Rewriters](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed132a39ec4dc3eac4afa87/html5/thumbnails/55.jpg)
Bad practises
More power consumption
Less battery-lifetime
Less Angry Birds!55
![Page 56: A Delta-Oriented Approach to Support the Safe Reuse of ...mosser/old-ws/_media/research/icsr18.pdf · A Delta-Oriented Approach to Support the Safe Reuse of Black-Box Code Rewriters](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed132a39ec4dc3eac4afa87/html5/thumbnails/56.jpg)
• Avoid internal getter/setter call (IGS) • Use static if you can (STA) • Use ArrayMap instead of HashMap (HMU)
Example of rewriters/bad practises
Geoffrey Hecht, Romain Rouvoy, Naouel Moha, and Laurence Duchien. Detecting antipatterns in android apps. In 2nd ACM International Conference on Mobile Software Engineering and Systems, MOBILESoft 2015, Florence, Italy, May 16- 17, 2015, pages 148–149, 2015.
!56
![Page 57: A Delta-Oriented Approach to Support the Safe Reuse of ...mosser/old-ws/_media/research/icsr18.pdf · A Delta-Oriented Approach to Support the Safe Reuse of Black-Box Code Rewriters](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed132a39ec4dc3eac4afa87/html5/thumbnails/57.jpg)
IGS
!57
![Page 58: A Delta-Oriented Approach to Support the Safe Reuse of ...mosser/old-ws/_media/research/icsr18.pdf · A Delta-Oriented Approach to Support the Safe Reuse of Black-Box Code Rewriters](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed132a39ec4dc3eac4afa87/html5/thumbnails/58.jpg)
• More rewriters • Have to work on any Android app
(closed world is over) • Evolving guidelines
A whole new world
!58
![Page 59: A Delta-Oriented Approach to Support the Safe Reuse of ...mosser/old-ws/_media/research/icsr18.pdf · A Delta-Oriented Approach to Support the Safe Reuse of Black-Box Code Rewriters](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed132a39ec4dc3eac4afa87/html5/thumbnails/59.jpg)
Code rewriters are so-called “Spoon processor” Off-the-shelf components
We want to safely reuse all of them
A whole new world
“ What happens when multiple processors have to be applied, ie, when multiple bad-practises
has been detected and must be fixed?”
“…”
!59
![Page 60: A Delta-Oriented Approach to Support the Safe Reuse of ...mosser/old-ws/_media/research/icsr18.pdf · A Delta-Oriented Approach to Support the Safe Reuse of Black-Box Code Rewriters](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed132a39ec4dc3eac4afa87/html5/thumbnails/60.jpg)
!60
![Page 61: A Delta-Oriented Approach to Support the Safe Reuse of ...mosser/old-ws/_media/research/icsr18.pdf · A Delta-Oriented Approach to Support the Safe Reuse of Black-Box Code Rewriters](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed132a39ec4dc3eac4afa87/html5/thumbnails/61.jpg)
!61
![Page 62: A Delta-Oriented Approach to Support the Safe Reuse of ...mosser/old-ws/_media/research/icsr18.pdf · A Delta-Oriented Approach to Support the Safe Reuse of Black-Box Code Rewriters](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed132a39ec4dc3eac4afa87/html5/thumbnails/62.jpg)
!62
![Page 63: A Delta-Oriented Approach to Support the Safe Reuse of ...mosser/old-ws/_media/research/icsr18.pdf · A Delta-Oriented Approach to Support the Safe Reuse of Black-Box Code Rewriters](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed132a39ec4dc3eac4afa87/html5/thumbnails/63.jpg)
≡≡
z
SAME
!63
![Page 64: A Delta-Oriented Approach to Support the Safe Reuse of ...mosser/old-ws/_media/research/icsr18.pdf · A Delta-Oriented Approach to Support the Safe Reuse of Black-Box Code Rewriters](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed132a39ec4dc3eac4afa87/html5/thumbnails/64.jpg)
Isolated application
No conflict!64
![Page 65: A Delta-Oriented Approach to Support the Safe Reuse of ...mosser/old-ws/_media/research/icsr18.pdf · A Delta-Oriented Approach to Support the Safe Reuse of Black-Box Code Rewriters](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed132a39ec4dc3eac4afa87/html5/thumbnails/65.jpg)
Isolated application
No conflict!65
![Page 66: A Delta-Oriented Approach to Support the Safe Reuse of ...mosser/old-ws/_media/research/icsr18.pdf · A Delta-Oriented Approach to Support the Safe Reuse of Black-Box Code Rewriters](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed132a39ec4dc3eac4afa87/html5/thumbnails/66.jpg)
Validation in the Android worldRunnerUp
(https://github.com/jonasoreland/runnerup)
4 rewriters: Lambda, GNP, HMU, IGS
4! = 24 sequences
iso worked fine and some seq don't.!66 Context Contribution Validation Conclusion
![Page 67: A Delta-Oriented Approach to Support the Safe Reuse of ...mosser/old-ws/_media/research/icsr18.pdf · A Delta-Oriented Approach to Support the Safe Reuse of Black-Box Code Rewriters](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed132a39ec4dc3eac4afa87/html5/thumbnails/67.jpg)
Outcome so far
1) Isolated applications of rewriters (iso)
2) Semantic checks (𝛘)
3) Legacy compatible (apply)
4) Conflits “un-silenced” (conflict?)
5) Good/bad sequences finding (seq)
6) Bonus: parallelisation!67 Context Contribution Validation Conclusion
![Page 68: A Delta-Oriented Approach to Support the Safe Reuse of ...mosser/old-ws/_media/research/icsr18.pdf · A Delta-Oriented Approach to Support the Safe Reuse of Black-Box Code Rewriters](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed132a39ec4dc3eac4afa87/html5/thumbnails/68.jpg)
Perspectives and future work
Empirical validation Quantitative validation
Go for another use-case: Git. Rewrite software based on diffs. The final
rewriter is human in case of conflicts.
!68
![Page 69: A Delta-Oriented Approach to Support the Safe Reuse of ...mosser/old-ws/_media/research/icsr18.pdf · A Delta-Oriented Approach to Support the Safe Reuse of Black-Box Code Rewriters](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed132a39ec4dc3eac4afa87/html5/thumbnails/69.jpg)
Thank you for your attention!
Benjamin Benni, Sébastien Mosser, Naouel Moha, Michel Riveill
A Delta-Oriented Approach to Support the Safe Reuse of Black-box Code Rewriters
i3s.unice.fr/~benni [email protected]
!69
![Page 70: A Delta-Oriented Approach to Support the Safe Reuse of ...mosser/old-ws/_media/research/icsr18.pdf · A Delta-Oriented Approach to Support the Safe Reuse of Black-Box Code Rewriters](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed132a39ec4dc3eac4afa87/html5/thumbnails/70.jpg)
Outcome, “summarised”
!70