Lightweight Extraction of Object Models from Bytecode - PowerPoint PPT Presentation

1 / 22
About This Presentation
Title:

Lightweight Extraction of Object Models from Bytecode

Description:

There is at least one method that takes or returns an object of class Object. class A ... If the field is not an array and does not reference a container class ... – PowerPoint PPT presentation

Number of Views:39
Avg rating:3.0/5.0
Slides: 23
Provided by: salmosa
Category:

less

Transcript and Presenter's Notes

Title: Lightweight Extraction of Object Models from Bytecode


1
Lightweight Extraction of Object Models from
Bytecode
  • Daniel Jackson, Allison Waingold
  • ICSE 99 , TSE 00
  • 2002. 5. 14
  • Presented by Jeon Sanguk

2
Contents
  • Introduction
  • Extraction Mechanism
  • Inferring Association
  • Inferring Multiplicity
  • Inferring Mutability
  • Experiment
  • Conclusion

3
Introduction(1/3)
  • Object model
  • Is a representation of the abstract state of a
    program
  • An architectural view of a program
  • Takes the form of a graph
  • Node object
  • Edge subset relationship or association

4
Introduction(2/3)
  • Usage of object model
  • Requirement
  • Capture the structure of the problem domain
  • Design
  • Articulate overall structure
  • Guide implementation
  • Maintenance
  • Understand a program
  • Rework a program

5
Introduction(3/3)
  • Womble
  • Is a tool that extracts object models from Java
    bytecode
  • Applies a simple, lightweight analysis to the
    code
  • Handles container classes by inferring the types
    of elements stored in a container

class Company Vector employees
employees

Company
Person
employees
Company
Vector
6
Notations
  • Association
  • extends or implements
  • Multiplicity
  • (zero or more), ?(zero or one), !(exactly one)
  • Mutability

class A B r
r
B
A
class A implements B class A extends B
B
A
r
B cannot change during its lifetime
B
A
7
Extraction Mechanism
  • Use of most of information in the classfile
  • Name of the class
  • Name of the class it extends or implements
  • The declarations of fields
  • The signature of methods
  • The bytecode instructions within methods
  • Extraction of basic structure

class A B p C q
p
B
A
q
C
8
Inferring Associations(1/2)
  • Ignores fields of primitive type
  • Identification of container class
  • Its methods and fields reference only built in
    classes(from the java.lang package)
  • There is at least one method that takes or
    returns an object of class Object

class A void A_Method(Object o,)
class B Object A_Method()
9
Inferring Associations(2/2)
  • Inference of the type of elements stored in it
  • Classes appearing in downcasts that are applied
    to objects returned by container methods
  • Classes passed as arguments to container methods

r
Vector
Certain_class
v (A)container.a_method()
A a container.a_method(a,)
r

Certain_class
A
10
Inferring Multiplicity(1/2)
  • Zero or more
  • Default in case of array and container class
  • Zero or one / exactly one
  • If the field is not an array and does not
    reference a container class
  • If the field is ever set to null, then zero or
    one
  • Otherwise exactly one

class A B p public A() p
null
p
B
A
11
Inferring Multiplicity(2/2)
  • Zero or more
  • Default
  • Zero or one
  • The B object is created in A
  • The field p is private
  • No method in A returns an object of class B
  • Exactly one
  • No attempt to identify

p
B
A
12
Inferring Mutability
  • Mutability of a field
  • If a value is assigned to it in any method of the
    class that is not a constructor
  • Mutability of a container
  • If it has a method that takes arguments of class
    Object and returns void
  • The most unsound analysis in their work

class A void A_Method(Object o,)
13
Example
14
Using Extracted Object Models
  • Sketching gross structure
  • Shows the essential elements of a programs
    structure
  • Comparing to design
  • Identifying design patterns
  • Identifying data structures
  • Looking for design anomalies
  • E.g) Useless redundancy
  • Looking for bugs

15
Experiment(1/5)
  • Suite of programs
  • Blob A graph drawing tool
  • Alcoa An object constraint solver
  • Fusion An environment for teaching graphics
    programming
  • Grappa A graph drawing toolkit
  • Haystack An information retrieval system
  • Rivet An open Java virtual machine for dynamic
    analysis
  • Womble itself

16
Experiment(2/5)
  • Basic statistics for the suite of programs

17
Experiment(3/5)
  • Inferring multiplicity and immutability

18
Experiment(4/5)
  • Inferring container classes

17
19
Experiment(5/5)
  • Comparison of association annotations

20
Flaws in Womble
  • Containers
  • Cannot infer actual type of element stored in
    nested container
  • Cannot distinguish keys and values in a hashtable
  • Cannot product qualified association

21
Superwomble
  • New version of Womble
  • Derives specification from each class
  • Gives the types of methods and fields
  • Can handle nested container hashtable
  • Elision of containers is optional

22
Conclusion
  • Womble
  • Is a tool that extracts object models from Java
    bytecode
  • Uses a collection of simple heuristics
  • The analysis is linear, mostly monotonic, and
    reasonably accurate
Write a Comment
User Comments (0)
About PowerShow.com