SlideShare uma empresa Scribd logo
1 de 102
Baixar para ler offline
Dynamic
Object Flow Analysis
            PhD defense
      Adrian Lienhard




      Advisor: Oscar Nierstrasz
2
3
4
5
6
image:Image                     copy:Image
               a1                      a2

                         :File
                    name = 'cat.jpg'



image := Image newFor: file.                // creates a1
copy := image duplicate.                    // creates a2




                                                            7
image:Image                copy:Image
               a1                 a2

                       :File
                     name = nil



image := Image newFor: file.           // creates a1
copy := image duplicate.               // creates a2



copy delete
  // file.name := nil




                                                       8
image:Image                copy:Image
               a1                 a2

                       :File
                     name = nil



image := Image newFor: file.           // creates a1
copy := image duplicate.               // creates a2



copy delete
  // file.name := nil
image display
   // file.name asUrl             NullPointerException



                                                         9
image:Image                copy:Image
               a1                 a2

                       :File
                     name = nil



image := aliasing is a problem because a1
 Object Image newFor: file. // creates
copy := image duplicate.      // creates a2
it introduces hidden dependencies.

copy delete
  // file.name := nil
image display
   // file.name asUrl             NullPointerException



                                                         10
Dynamic Control Flow Analysis




                                11
Dynamic Control Flow Analysis




                          delete


upload




                                   12
Dynamic Control Flow Analysis




                                                delete


  upload




Feature "Upload" Feature "Duplicate"   Feature "Delete"


                                  [Salah and Mancoridis ICSM'04]
                                                                   13
Dynamic Control Flow Analysis




                         ?                     delete


  upload




Feature "Upload" Feature "Duplicate"   Feature "Delete"



                                                          14
Dynamic Data Analysis




image:Image                     copy:Image
        a1                      a2

                  :File
             name = 'cat.jpg'




                                             15
Dynamic Data Analysis


    Reference Patterns            Ownership Trees




[De Pauw, Sevitsky ECOOP’99]   [Hill, Noble, Potter JVLC’02]

                                                               16
Dynamic Data Analysis




image:Image                     copy:Image
        a1                      a2

                  :File
             name = 'cat.jpg'




                                             17
Dynamic Data Analysis




image:Image         ?           copy:Image
        a1                      a2

                  :File
             name = 'cat.jpg'




                                             18
Dynamic Analysis

control flow    data       data flow
     !           !           ?
   method     reference   reference
  execution   structure    transfer




                                      19
Dynamic Analysis

control flow    data       data flow
     !           !           ?
   method     reference   reference
  execution   structure    transfer




                                      20
Thesis
Object references must be
captured and modeled explicitly.




                                   21
image:Image           copy:Image
Runtime               a1            a2

                            :File




Object Flow
Metamodel




                                                 22
image:Image           copy:Image
Runtime               a1            a2

                            :File




Object Flow
Metamodel

                                            Object

                                                     23
image:Image                 copy:Image
Runtime               a1                   a2

                              :File




Object Flow
Metamodel

                                      *         1
                      Alias                         Object
                                          value

                                                             24
image:Image                     copy:Image
Runtime                    a1                   a2

                                   :File




Object Flow
Metamodel

                0..1   *                             1
                                           *
                           Alias                         Object
              origin                           value

                                                                  25
Runtime




Object Flow
Metamodel

                0..1   *    *             1
                                   *
                           Alias               Object
              origin                   value

                                                        26
Runtime



                      caller
                      0..1
                          Activation
Object Flow       *
Metamodel

                0..1      *                   1
                                       *
                               Alias               Object
              origin                       value

                                                            27
Runtime



                      caller
                      0..1
                          Activation
Object Flow       *
                             1 context
Metamodel

                0..1      *     *               1
                                         *
                               Alias                 Object
              origin                         value

                                                              28
delete


              upload
                                            duplicate
Runtime



                           caller
                           0..1
                               Activation
Object Flow            *
                                  1 context
Metamodel

                   0..1        *     *                  1
                                              *
                                    Alias                   Object
                 origin                           value

                                                                         29
Object Flow




              30
Visualizing   Feature              Test
Object Flows Dependencies        Blueprints




                                              Runtime Monitoring in the VM
                Metamodel

             Activation



               Alias           Object
    origin


             Object Tracking
                                                                             31
Visualizing   Feature              Test
Object Flows Dependencies        Blueprints




                                              Runtime Monitoring in the VM
                Metamodel

             Activation



               Alias           Object
    origin


             Object Tracking
                                                                             32
Visualizing   Feature              Test
Object Flows Dependencies        Blueprints




                                              Runtime Monitoring in the VM
                Metamodel

             Activation



               Alias           Object
    origin


             Object Tracking
                                                                             33
Visualizing   Feature              Test
Object Flows Dependencies        Blueprints




                                              Runtime Monitoring in the VM
                Metamodel

             Activation



               Alias           Object
    origin


             Object Tracking
                                                                             34
Visualizing   Feature              Test
Object Flows Dependencies        Blueprints




                                              Runtime Monitoring in the VM
                Metamodel

             Activation



               Alias           Object
    origin


             Object Tracking
                                                                             35
Visualizing   Feature              Test
Object Flows Dependencies        Blueprints




                                              Runtime Monitoring in the VM
                Metamodel

             Activation



               Alias           Object
    origin


             Object Tracking
                                                                             36
Detecting flows between classes




                 Activation
                     1 context


          0..1   *    *
                                 *      1
                     Alias                   Object
        origin                       value
                                                      37
Detecting flows between classes




                     Method
                      1


                     *
                 Activation
                      1 context


          0..1   *     *
                                  *      1
                      Alias                   Object
        origin                        value
                                                       38
Detecting flows between classes

Class A                        Class
                                1

                                *
                               Method
Class B                         1


                               *
                           Activation
                                1 context
Class C

                    0..1   *     *
                                            *      1
                                Alias                   Object
                  origin                        value
                                                                 39
Detecting flows between classes

Class A                        Class
                                1

                                *
                               Method
Class B                         1


                               *
                           Activation
                                1 context
Class C

                    0..1   *     *
                                            *      1
                                Alias                   Object
                  origin                        value
                                                                 40
Inter-unit Flow View




                       41
Chronological
 propagation




                42
Chronological
 propagation




                42
Chronological
 propagation




                42
Spanning flows
Parser (4)




                             43
Spanning flows




IRBuilder




                            44
Visualizing   Feature                    Test
Object Flows Dependencies              Blueprints




                                                    Runtime Monitoring in the VM
              l.
       ard eta
[ Lienh AN'09]
       L
  COM
                      Metamodel

                   Activation



                     Alias           Object
      origin


                   Object Tracking
                                                                                   45
Visualizing   Feature              Test
Object Flows Dependencies        Blueprints




                                              Runtime Monitoring in the VM
                Metamodel

             Activation



               Alias           Object
    origin


             Object Tracking
                                                                             46
Feature "Upload"   Feature "Duplicate"     Feature "Delete"



                                 [Salah and Mancoridis ICSM'04]




                                                                  47
Feature "Upload"   Feature "Duplicate"   Feature "Delete"



image:
   a1
      :File




                                                             48
Feature "Upload"   Feature "Duplicate"    Feature "Delete"



image:              image:         copy:
   a1                  a1          a2
      :File                :File




                                                              49
Feature "Upload"   Feature "Duplicate"     Feature "Delete"



image:              image:         copy:   image:        copy:
   a1                  a1          a2         a1          a2
      :File                :File                 :File




                                                                 50
Feature "Upload"       Feature "Duplicate"   Feature "Delete"




             0..1
         *                      *        1
                Activation                   Feature
                    1 context


               *     *                   1
      0..1                      *
                    Alias                    Object
    origin                           value
                                                                51
delete


  upload
                                  duplicate




Feature "Upload"         Feature "Duplicate"      Feature "Delete"




               0..1
           *                      *           1
                  Activation                      Feature
                      1 context


                 *     *                   1
      0..1                        *
                      Alias                       Object
   origin                              value
                                                                     52
IRC client dependencies

         Open
         Setup
       Connect
        MOTD
   Join Channel
  Send Message
Receive Message
  New Console
    Disconnect

                  0         5        10           15     20   25   30   35
                      Our approach        Salah et al.
                                                                             53
Object Dependency Graph
of feature Receive Message




                  Open       Join Channel
                  Connect    Send Message

                                            54
Object Dependency Graph
of feature Receive Message




                  Open       Join Channel
                  Connect    Send Message

                                            55
Object Dependency Graph
of feature Receive Message




                  Open       Join Channel
                  Connect    Send Message

                                            56
Object Dependency Graph
of feature Receive Message




                  Open       Join Channel
                  Connect    Send Message

                                            57
Visualizing   Feature                      Test
Object Flows Dependencies                Blueprints




                                                      Runtime Monitoring in the VM
                             ta   l.
                       ard e
                  Lienh 07
                        '
                   ICPC
                Metamodel

             Activation



               Alias                   Object
    origin


             Object Tracking
                                                                                     58
Visualizing   Feature              Test
Object Flows Dependencies        Blueprints




                                              Runtime Monitoring in the VM
                Metamodel

             Activation



               Alias           Object
    origin


             Object Tracking
                                                                             59
Writing a Unit Test

     1. Setup
     2. Invoke
     3. Assert




                      60
duplicate




            61
duplicate




       Test Blueprint                  Objects
                                       :Image    existing
:Image (target)      :Image (return)   :Image    new

                                       References
                                                 existing
                  :File                          new




                                                            62
duplicate




               Test Blueprint                  Objects
                                               :Image    existing
        :Image (target)      :Image (return)   :Image    new

                                               References
                                                         existing
                          :File                          new


1 file := File named: 'cat.jpg'.
2 image := Image new.
3 image file: file.


                                                                    63
duplicate




               Test Blueprint                       Objects
                                                    :Image    existing
        :Image (target)      :Image (return)        :Image    new

                                                    References
                                                              existing
                          :File                               new


1 file := File named: 'cat.jpg'.        4 copy := image duplicate.
2 image := Image new.
3 image file: file.


                                                                         64
duplicate




               Test Blueprint                       Objects
                                                    :Image    existing
        :Image (target)      :Image (return)        :Image    new

                                                    References
                                                              existing
                          :File                               new


1 file := File named: 'cat.jpg'.        4 copy := image duplicate.
2 image := Image new.
3 image file: file.                     5 self assert: copy class = Image.
                                        6 self assert: copy file == file

                                                                             65
duplicate




         caller
         0..1
     *          Activation
          context

                     target parameters
            *         1     *
 0..1                          *       1
                  Alias                    Object
origin                             value


                                                    66
IRBuilder>>add:              2   FunctionScope>>lookupVar:
      1




                                          NonClosureScopeFixer>>acceptVarNode:
          InstanceScope>>newMethodScope
                                          4
      3
ace                 Test Blueprint




                                                                                 67
Execution Trace   Test Blueprint

                                   68
Initial Study I
           Let a developer use the tool:
                   12 tests in 2h




Execution Trace               Test Blueprint

                                               69
Initial Study II
   Rewrote assertions of 14 existing tests:
    72 identical, 12 missed, 5 additional




Execution Trace            Test Blueprint

                                              70
Visualizing   Feature              Test
Object Flows Dependencies        Blueprints




                                                   Runtime Monitoring in the VM
                                             al.
                                     a rd et
                                Lienh '08
                                     R
                                 CSM
                Metamodel

             Activation



               Alias           Object
    origin


             Object Tracking
                                                                                  71
Visualizing   Feature              Test
Object Flows Dependencies        Blueprints




                                              Runtime Monitoring in the VM
                Metamodel

             Activation



               Alias           Object
    origin


             Object Tracking
                                                                             72
Visualizing   Feature              Test
Object Flows Dependencies        Blueprints




                                              Runtime Monitoring in the VM
                Metamodel

             Activation



               Alias           Object
    origin


             Object Tracking
                                                                             73
74
Specification of object flow tracking
by extending language semantics




                                      75
Example execution

                       Computer           Dynamic
 Source Code
                   (formal semantics)   Analysis Data


f := new File

...

return f




                                                        76
Example execution

                       Computer           Dynamic
 Source Code
                   (formal semantics)   Analysis Data


f := new File                              allocation

...

return f




                                                        77
Example execution

                       Computer           Dynamic
 Source Code
                   (formal semantics)   Analysis Data


f := new File                              allocation

...
                                           field-write
return f




                                                        78
Example execution

                       Computer           Dynamic
 Source Code
                   (formal semantics)   Analysis Data


f := new File                              allocation

...
                                           field-write
return f


                                            return




                                                        79
Visualizing   Feature              Test
Object Flows Dependencies        Blueprints




                                              Runtime Monitoring in the VM
                Metamodel

             Activation



               Alias           Object
    origin


             Object Tracking
                                                                             80
Visualizing   Feature              Test
Object Flows Dependencies        Blueprints




                                              Runtime Monitoring in the VM
                Metamodel

             Activation



               Alias           Object
    origin


             Object Tracking
                                                                             81
Problem of conventional debuggers




In 50% of the cases the execution stack contains
essentially no information about the bug's cause.
                                  [Liblit etal. PLDI'05]

                                                           82
Back-in-time debugging




  Challenges
  1. amount of data
  2. execution overhead

                          83
Approaches

Omniscient            Trace-oriented             Trace-oriented
Debugger              debugger (partial)         debugger (full)




loss of old history   loss of selected history   complete history
overhead 100x         overhead 10x               overhead 100x




                                                                    84
Approaches

     Omniscient         Trace-oriented        Trace-oriented
     Debugger
                      Our approach
                       debugger (partial)     debugger (full)

                        low overhead
                       relevant history


loss of old history    loss of history      complete history
overhead 100x          overhead 10x         overhead 100x



                                                                85
Delete history when it
   gets irrelevant




 History of origins of objects
 Previous field values of objects
 Call stacks in which above appear
                                     86
Before deletion




                  87
Before deletion




After deletion




                  88
Object Flow VM

           regular objects                           alias

  header                              header
                           header                    header
field_1                              field_1                             header
                     ...                           value
field_2                              field_2                       ...
                                                   context
....                                ....
field_n
              pointer               field_n
                                                   origin
                                                   predecessor
                                                   ...


     Typical model                             Object Flow VM


                                                                                89
Capturing historical object state
t1                   t2                 t3
image := Image new   image height: 17   image height: 42




                                                           90
Capturing historical object state
t1                        t2                 t3
image := Image new        image height: 17   image height: 42


                     height
     image:                    @t1                   nil




                                                                91
Capturing historical object state
t1                        t2                   t3
image := Image new        image height: 17     image height: 42



                               @t1                     nil
                                 predecessor
                     height
     image:                    @t2                     17




                                                                  92
Capturing historical object state
t1                        t2                   t3
image := Image new        image height: 17     image height: 42



                               @t1                     nil
                                 predecessor
                               @t2                     17
                                 predecessor
                     height
     image:                    @t3                     42




                                                                  93
Capturing historical object state
t1                        t2                                t3
image := Image new        image height: 17                  image height: 42



                                     @t1                            nil
                                          predecessor
                                     @t2                            17
                                          predecessor
                     height
     image:                          @t3                            42


                       predecessor

                       0..1        0..1
                      Alias                             Object
          origin
                              *                         1
                                  fields                                        94
Evaluation memory usage (1)
2.5e+09                                                              1e+07
                Number of aliases allocated (left Y-axis)
              Number of aliases in memory (right Y-axis)
              Number of objects in memory (right Y-axis)
 2e+09                                                               8e+06



1.5e+09                                                              6e+06



 1e+09                                                               4e+06



 5e+08                                                               2e+06



     0                                                               0
          0            200           400              600   800   1000
                                           #classes
                                                                             95
Evaluation memory usage (2)
 7e+06                                                                50
              Number of aliases allocated
             Number of aliases in memory
 6e+06       Number of objects in memory
                Ratio between aliases in                              40
                  memory and allocated
 5e+06

                                                                      30
 4e+06




                                                                           %
 3e+06
                                                                      20

 2e+06
                                                                      10
 1e+06


     0                                                                0
         0       2      4       6      8     10   12   14   16   18
                                       #samples

                                                                               96
Evaluation memory usage (3)
 1e+07
          Number of aliases allocated
 9e+06   Number of aliases in memory
         Number of objects in memory
 8e+06

 7e+06

 6e+06

 5e+06

 4e+06

 3e+06

 2e+06

 1e+06

     0
                  5             10              15   20   25
                                        #requests

                                                               97
Evaluation run-time overhead


                    Overhead       GC
    Recording off       1.15      1.6%
    Recording on        3.84   27.6%



          Largest overhead: 6.9


                                         98
Visualizing   Feature              Test
Object Flows Dependencies        Blueprints




                                                   Runtime Monitoring in the VM
                Metamodel

             Activation



               Alias           Object
    origin
                                                           al.
                                                   a rd et
             Object Tracking                  Lienh P'08
                                                   O
                                               ECO
                                                                                  99
Visualizing   Feature              Test
Object Flows Dependencies        Blueprints




                                              Runtime Monitoring in the VM
                Metamodel

             Activation



               Alias           Object
    origin


             Object Tracking

Mais conteúdo relacionado

Destaque

CQRS introduction
CQRS introductionCQRS introduction
CQRS introduction
Yura Taras
 
Phenomenal Oct 1, 2009
Phenomenal Oct 1, 2009Phenomenal Oct 1, 2009
Phenomenal Oct 1, 2009
etalcomendras
 
Phenomenal Oct 8, 2009
Phenomenal Oct 8, 2009Phenomenal Oct 8, 2009
Phenomenal Oct 8, 2009
etalcomendras
 
Apture Publisher Overview
Apture Publisher OverviewApture Publisher Overview
Apture Publisher Overview
Apture
 
Elalamy DiabèTe Et Aap Sfa 2009
Elalamy DiabèTe Et Aap Sfa 2009Elalamy DiabèTe Et Aap Sfa 2009
Elalamy DiabèTe Et Aap Sfa 2009
sfa_angeiologie
 
Wolko1- Afiches de cine
Wolko1- Afiches de cineWolko1- Afiches de cine
Wolko1- Afiches de cine
guest0b0bd35
 
Syndrome metabolique et maladies vasculaires s novo
Syndrome metabolique et maladies vasculaires s novoSyndrome metabolique et maladies vasculaires s novo
Syndrome metabolique et maladies vasculaires s novo
sfa_angeiologie
 
Vol 02 chapter 8 2012
Vol 02 chapter 8 2012Vol 02 chapter 8 2012
Vol 02 chapter 8 2012
dphil002
 
Tracking Objects To Detect Feature Dependencies
Tracking Objects To Detect Feature DependenciesTracking Objects To Detect Feature Dependencies
Tracking Objects To Detect Feature Dependencies
lienhard
 

Destaque (20)

007 014 belcaro corrige
007 014 belcaro corrige007 014 belcaro corrige
007 014 belcaro corrige
 
CQRS introduction
CQRS introductionCQRS introduction
CQRS introduction
 
Phenomenal Oct 1, 2009
Phenomenal Oct 1, 2009Phenomenal Oct 1, 2009
Phenomenal Oct 1, 2009
 
Phenomenal Oct 8, 2009
Phenomenal Oct 8, 2009Phenomenal Oct 8, 2009
Phenomenal Oct 8, 2009
 
Terofox v port catalogue (rev.01)
Terofox v port catalogue (rev.01)Terofox v port catalogue (rev.01)
Terofox v port catalogue (rev.01)
 
Apture Publisher Overview
Apture Publisher OverviewApture Publisher Overview
Apture Publisher Overview
 
The San Diego LGBT Community Center
The San Diego LGBT Community CenterThe San Diego LGBT Community Center
The San Diego LGBT Community Center
 
Elalamy DiabèTe Et Aap Sfa 2009
Elalamy DiabèTe Et Aap Sfa 2009Elalamy DiabèTe Et Aap Sfa 2009
Elalamy DiabèTe Et Aap Sfa 2009
 
Wolko1- Afiches de cine
Wolko1- Afiches de cineWolko1- Afiches de cine
Wolko1- Afiches de cine
 
Резервісти
РезервістиРезервісти
Резервісти
 
201106 WICSA
201106 WICSA201106 WICSA
201106 WICSA
 
Syndrome metabolique et maladies vasculaires s novo
Syndrome metabolique et maladies vasculaires s novoSyndrome metabolique et maladies vasculaires s novo
Syndrome metabolique et maladies vasculaires s novo
 
Vol 02 chapter 8 2012
Vol 02 chapter 8 2012Vol 02 chapter 8 2012
Vol 02 chapter 8 2012
 
200910 - iPhone at OOPSLA
200910 - iPhone at OOPSLA200910 - iPhone at OOPSLA
200910 - iPhone at OOPSLA
 
Tracking Objects To Detect Feature Dependencies
Tracking Objects To Detect Feature DependenciesTracking Objects To Detect Feature Dependencies
Tracking Objects To Detect Feature Dependencies
 
Heirloom Travel: Wine Country - Sonoma
Heirloom Travel: Wine Country - SonomaHeirloom Travel: Wine Country - Sonoma
Heirloom Travel: Wine Country - Sonoma
 
Oasis Training Barcelona 2014
Oasis Training Barcelona 2014Oasis Training Barcelona 2014
Oasis Training Barcelona 2014
 
Week9
Week9Week9
Week9
 
Heirloom Travel: Wine Country - Petaluma
Heirloom Travel: Wine Country - PetalumaHeirloom Travel: Wine Country - Petaluma
Heirloom Travel: Wine Country - Petaluma
 
Twitter en Facebook voor journalisten
Twitter en Facebook voor journalistenTwitter en Facebook voor journalisten
Twitter en Facebook voor journalisten
 

Mais de lienhard (10)

Chicken
ChickenChicken
Chicken
 
Prototype-based Programming with JavaScript
Prototype-based Programming with JavaScriptPrototype-based Programming with JavaScript
Prototype-based Programming with JavaScript
 
Virtual Machines Lecture
Virtual Machines LectureVirtual Machines Lecture
Virtual Machines Lecture
 
Flow-Centric, Back-In-Time Debugging
Flow-Centric, Back-In-Time DebuggingFlow-Centric, Back-In-Time Debugging
Flow-Centric, Back-In-Time Debugging
 
OORPT Dynamic Analysis
OORPT Dynamic AnalysisOORPT Dynamic Analysis
OORPT Dynamic Analysis
 
Rapid Prototyping Of Visualizations Using Mondrian
Rapid Prototyping Of Visualizations Using MondrianRapid Prototyping Of Visualizations Using Mondrian
Rapid Prototyping Of Visualizations Using Mondrian
 
Practical Object-Oriented Back-in-Time Debugging
Practical Object-Oriented Back-in-Time DebuggingPractical Object-Oriented Back-in-Time Debugging
Practical Object-Oriented Back-in-Time Debugging
 
Test Blueprints
Test BlueprintsTest Blueprints
Test Blueprints
 
Object Flow Analysis
Object Flow AnalysisObject Flow Analysis
Object Flow Analysis
 
Identifying Traits with Formal Concept Analysis
Identifying Traits with Formal Concept AnalysisIdentifying Traits with Formal Concept Analysis
Identifying Traits with Formal Concept Analysis
 

Último

Último (20)

Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 

Dynamic Object Flow Analysis (PhD Defense)

  • 1. Dynamic Object Flow Analysis PhD defense Adrian Lienhard Advisor: Oscar Nierstrasz
  • 2. 2
  • 3. 3
  • 4. 4
  • 5. 5
  • 6. 6
  • 7. image:Image copy:Image a1 a2 :File name = 'cat.jpg' image := Image newFor: file. // creates a1 copy := image duplicate. // creates a2 7
  • 8. image:Image copy:Image a1 a2 :File name = nil image := Image newFor: file. // creates a1 copy := image duplicate. // creates a2 copy delete // file.name := nil 8
  • 9. image:Image copy:Image a1 a2 :File name = nil image := Image newFor: file. // creates a1 copy := image duplicate. // creates a2 copy delete // file.name := nil image display // file.name asUrl NullPointerException 9
  • 10. image:Image copy:Image a1 a2 :File name = nil image := aliasing is a problem because a1 Object Image newFor: file. // creates copy := image duplicate. // creates a2 it introduces hidden dependencies. copy delete // file.name := nil image display // file.name asUrl NullPointerException 10
  • 11. Dynamic Control Flow Analysis 11
  • 12. Dynamic Control Flow Analysis delete upload 12
  • 13. Dynamic Control Flow Analysis delete upload Feature "Upload" Feature "Duplicate" Feature "Delete" [Salah and Mancoridis ICSM'04] 13
  • 14. Dynamic Control Flow Analysis ? delete upload Feature "Upload" Feature "Duplicate" Feature "Delete" 14
  • 15. Dynamic Data Analysis image:Image copy:Image a1 a2 :File name = 'cat.jpg' 15
  • 16. Dynamic Data Analysis Reference Patterns Ownership Trees [De Pauw, Sevitsky ECOOP’99] [Hill, Noble, Potter JVLC’02] 16
  • 17. Dynamic Data Analysis image:Image copy:Image a1 a2 :File name = 'cat.jpg' 17
  • 18. Dynamic Data Analysis image:Image ? copy:Image a1 a2 :File name = 'cat.jpg' 18
  • 19. Dynamic Analysis control flow data data flow ! ! ? method reference reference execution structure transfer 19
  • 20. Dynamic Analysis control flow data data flow ! ! ? method reference reference execution structure transfer 20
  • 21. Thesis Object references must be captured and modeled explicitly. 21
  • 22. image:Image copy:Image Runtime a1 a2 :File Object Flow Metamodel 22
  • 23. image:Image copy:Image Runtime a1 a2 :File Object Flow Metamodel Object 23
  • 24. image:Image copy:Image Runtime a1 a2 :File Object Flow Metamodel * 1 Alias Object value 24
  • 25. image:Image copy:Image Runtime a1 a2 :File Object Flow Metamodel 0..1 * 1 * Alias Object origin value 25
  • 26. Runtime Object Flow Metamodel 0..1 * * 1 * Alias Object origin value 26
  • 27. Runtime caller 0..1 Activation Object Flow * Metamodel 0..1 * 1 * Alias Object origin value 27
  • 28. Runtime caller 0..1 Activation Object Flow * 1 context Metamodel 0..1 * * 1 * Alias Object origin value 28
  • 29. delete upload duplicate Runtime caller 0..1 Activation Object Flow * 1 context Metamodel 0..1 * * 1 * Alias Object origin value 29
  • 31. Visualizing Feature Test Object Flows Dependencies Blueprints Runtime Monitoring in the VM Metamodel Activation Alias Object origin Object Tracking 31
  • 32. Visualizing Feature Test Object Flows Dependencies Blueprints Runtime Monitoring in the VM Metamodel Activation Alias Object origin Object Tracking 32
  • 33. Visualizing Feature Test Object Flows Dependencies Blueprints Runtime Monitoring in the VM Metamodel Activation Alias Object origin Object Tracking 33
  • 34. Visualizing Feature Test Object Flows Dependencies Blueprints Runtime Monitoring in the VM Metamodel Activation Alias Object origin Object Tracking 34
  • 35. Visualizing Feature Test Object Flows Dependencies Blueprints Runtime Monitoring in the VM Metamodel Activation Alias Object origin Object Tracking 35
  • 36. Visualizing Feature Test Object Flows Dependencies Blueprints Runtime Monitoring in the VM Metamodel Activation Alias Object origin Object Tracking 36
  • 37. Detecting flows between classes Activation 1 context 0..1 * * * 1 Alias Object origin value 37
  • 38. Detecting flows between classes Method 1 * Activation 1 context 0..1 * * * 1 Alias Object origin value 38
  • 39. Detecting flows between classes Class A Class 1 * Method Class B 1 * Activation 1 context Class C 0..1 * * * 1 Alias Object origin value 39
  • 40. Detecting flows between classes Class A Class 1 * Method Class B 1 * Activation 1 context Class C 0..1 * * * 1 Alias Object origin value 40
  • 47. Visualizing Feature Test Object Flows Dependencies Blueprints Runtime Monitoring in the VM l. ard eta [ Lienh AN'09] L COM Metamodel Activation Alias Object origin Object Tracking 45
  • 48. Visualizing Feature Test Object Flows Dependencies Blueprints Runtime Monitoring in the VM Metamodel Activation Alias Object origin Object Tracking 46
  • 49. Feature "Upload" Feature "Duplicate" Feature "Delete" [Salah and Mancoridis ICSM'04] 47
  • 50. Feature "Upload" Feature "Duplicate" Feature "Delete" image: a1 :File 48
  • 51. Feature "Upload" Feature "Duplicate" Feature "Delete" image: image: copy: a1 a1 a2 :File :File 49
  • 52. Feature "Upload" Feature "Duplicate" Feature "Delete" image: image: copy: image: copy: a1 a1 a2 a1 a2 :File :File :File 50
  • 53. Feature "Upload" Feature "Duplicate" Feature "Delete" 0..1 * * 1 Activation Feature 1 context * * 1 0..1 * Alias Object origin value 51
  • 54. delete upload duplicate Feature "Upload" Feature "Duplicate" Feature "Delete" 0..1 * * 1 Activation Feature 1 context * * 1 0..1 * Alias Object origin value 52
  • 55. IRC client dependencies Open Setup Connect MOTD Join Channel Send Message Receive Message New Console Disconnect 0 5 10 15 20 25 30 35 Our approach Salah et al. 53
  • 56. Object Dependency Graph of feature Receive Message Open Join Channel Connect Send Message 54
  • 57. Object Dependency Graph of feature Receive Message Open Join Channel Connect Send Message 55
  • 58. Object Dependency Graph of feature Receive Message Open Join Channel Connect Send Message 56
  • 59. Object Dependency Graph of feature Receive Message Open Join Channel Connect Send Message 57
  • 60. Visualizing Feature Test Object Flows Dependencies Blueprints Runtime Monitoring in the VM ta l. ard e Lienh 07 ' ICPC Metamodel Activation Alias Object origin Object Tracking 58
  • 61. Visualizing Feature Test Object Flows Dependencies Blueprints Runtime Monitoring in the VM Metamodel Activation Alias Object origin Object Tracking 59
  • 62. Writing a Unit Test 1. Setup 2. Invoke 3. Assert 60
  • 63. duplicate 61
  • 64. duplicate Test Blueprint Objects :Image existing :Image (target) :Image (return) :Image new References existing :File new 62
  • 65. duplicate Test Blueprint Objects :Image existing :Image (target) :Image (return) :Image new References existing :File new 1 file := File named: 'cat.jpg'. 2 image := Image new. 3 image file: file. 63
  • 66. duplicate Test Blueprint Objects :Image existing :Image (target) :Image (return) :Image new References existing :File new 1 file := File named: 'cat.jpg'. 4 copy := image duplicate. 2 image := Image new. 3 image file: file. 64
  • 67. duplicate Test Blueprint Objects :Image existing :Image (target) :Image (return) :Image new References existing :File new 1 file := File named: 'cat.jpg'. 4 copy := image duplicate. 2 image := Image new. 3 image file: file. 5 self assert: copy class = Image. 6 self assert: copy file == file 65
  • 68. duplicate caller 0..1 * Activation context target parameters * 1 * 0..1 * 1 Alias Object origin value 66
  • 69. IRBuilder>>add: 2 FunctionScope>>lookupVar: 1 NonClosureScopeFixer>>acceptVarNode: InstanceScope>>newMethodScope 4 3 ace Test Blueprint 67
  • 70. Execution Trace Test Blueprint 68
  • 71. Initial Study I Let a developer use the tool: 12 tests in 2h Execution Trace Test Blueprint 69
  • 72. Initial Study II Rewrote assertions of 14 existing tests: 72 identical, 12 missed, 5 additional Execution Trace Test Blueprint 70
  • 73. Visualizing Feature Test Object Flows Dependencies Blueprints Runtime Monitoring in the VM al. a rd et Lienh '08 R CSM Metamodel Activation Alias Object origin Object Tracking 71
  • 74. Visualizing Feature Test Object Flows Dependencies Blueprints Runtime Monitoring in the VM Metamodel Activation Alias Object origin Object Tracking 72
  • 75. Visualizing Feature Test Object Flows Dependencies Blueprints Runtime Monitoring in the VM Metamodel Activation Alias Object origin Object Tracking 73
  • 76. 74
  • 77. Specification of object flow tracking by extending language semantics 75
  • 78. Example execution Computer Dynamic Source Code (formal semantics) Analysis Data f := new File ... return f 76
  • 79. Example execution Computer Dynamic Source Code (formal semantics) Analysis Data f := new File allocation ... return f 77
  • 80. Example execution Computer Dynamic Source Code (formal semantics) Analysis Data f := new File allocation ... field-write return f 78
  • 81. Example execution Computer Dynamic Source Code (formal semantics) Analysis Data f := new File allocation ... field-write return f return 79
  • 82. Visualizing Feature Test Object Flows Dependencies Blueprints Runtime Monitoring in the VM Metamodel Activation Alias Object origin Object Tracking 80
  • 83. Visualizing Feature Test Object Flows Dependencies Blueprints Runtime Monitoring in the VM Metamodel Activation Alias Object origin Object Tracking 81
  • 84. Problem of conventional debuggers In 50% of the cases the execution stack contains essentially no information about the bug's cause. [Liblit etal. PLDI'05] 82
  • 85. Back-in-time debugging Challenges 1. amount of data 2. execution overhead 83
  • 86. Approaches Omniscient Trace-oriented Trace-oriented Debugger debugger (partial) debugger (full) loss of old history loss of selected history complete history overhead 100x overhead 10x overhead 100x 84
  • 87. Approaches Omniscient Trace-oriented Trace-oriented Debugger Our approach debugger (partial) debugger (full) low overhead relevant history loss of old history loss of history complete history overhead 100x overhead 10x overhead 100x 85
  • 88. Delete history when it gets irrelevant History of origins of objects Previous field values of objects Call stacks in which above appear 86
  • 91. Object Flow VM regular objects alias header header header header field_1 field_1 header ... value field_2 field_2 ... context .... .... field_n pointer field_n origin predecessor ... Typical model Object Flow VM 89
  • 92. Capturing historical object state t1 t2 t3 image := Image new image height: 17 image height: 42 90
  • 93. Capturing historical object state t1 t2 t3 image := Image new image height: 17 image height: 42 height image: @t1 nil 91
  • 94. Capturing historical object state t1 t2 t3 image := Image new image height: 17 image height: 42 @t1 nil predecessor height image: @t2 17 92
  • 95. Capturing historical object state t1 t2 t3 image := Image new image height: 17 image height: 42 @t1 nil predecessor @t2 17 predecessor height image: @t3 42 93
  • 96. Capturing historical object state t1 t2 t3 image := Image new image height: 17 image height: 42 @t1 nil predecessor @t2 17 predecessor height image: @t3 42 predecessor 0..1 0..1 Alias Object origin * 1 fields 94
  • 97. Evaluation memory usage (1) 2.5e+09 1e+07 Number of aliases allocated (left Y-axis) Number of aliases in memory (right Y-axis) Number of objects in memory (right Y-axis) 2e+09 8e+06 1.5e+09 6e+06 1e+09 4e+06 5e+08 2e+06 0 0 0 200 400 600 800 1000 #classes 95
  • 98. Evaluation memory usage (2) 7e+06 50 Number of aliases allocated Number of aliases in memory 6e+06 Number of objects in memory Ratio between aliases in 40 memory and allocated 5e+06 30 4e+06 % 3e+06 20 2e+06 10 1e+06 0 0 0 2 4 6 8 10 12 14 16 18 #samples 96
  • 99. Evaluation memory usage (3) 1e+07 Number of aliases allocated 9e+06 Number of aliases in memory Number of objects in memory 8e+06 7e+06 6e+06 5e+06 4e+06 3e+06 2e+06 1e+06 0 5 10 15 20 25 #requests 97
  • 100. Evaluation run-time overhead Overhead GC Recording off 1.15 1.6% Recording on 3.84 27.6% Largest overhead: 6.9 98
  • 101. Visualizing Feature Test Object Flows Dependencies Blueprints Runtime Monitoring in the VM Metamodel Activation Alias Object origin al. a rd et Object Tracking Lienh P'08 O ECO 99
  • 102. Visualizing Feature Test Object Flows Dependencies Blueprints Runtime Monitoring in the VM Metamodel Activation Alias Object origin Object Tracking