Dynamic Slicing in OVM - PowerPoint PPT Presentation

1 / 14
About This Presentation
Title:

Dynamic Slicing in OVM

Description:

Byte Code Re-writing and Instrumentation. Dynamic Tracing. Slicer. Trace Parsing ... Byte Code re-writting still required. Future Work. Multi-threaded programs ... – PowerPoint PPT presentation

Number of Views:104
Avg rating:3.0/5.0
Slides: 15
Provided by: lukasz1
Category:

less

Transcript and Presenter's Notes

Title: Dynamic Slicing in OVM


1
Dynamic Slicing in OVM
  • Umang, Vince, and Lukasz
  • Software Engineering CS510

2
Outline
  • Overview of Dynamic Slicing
  • Implementation
  • Tracing
  • Slicing
  • Examples
  • Project Outline
  • Lessons Learned
  • Future Work

3
Dynamic Slicing
  • Slicing Criteria
  • A set of statements and a set of variables on
    which a slice is performed
  • Forward Slice
  • Given a slicing criteria, compute all statements
    affected by the criteria
  • Backward Slice
  • Given a slicing criteria, computer all statements
    which affected the criteria

4
Implementation
  • OVM
  • Static CFG generation
  • Byte Code Re-writing and Instrumentation
  • Dynamic Tracing
  • Slicer
  • Trace Parsing
  • Control Dependency Discovery
  • Data Dependency Discovery
  • Slice Generation

5
Tracing
  • Method Calls
  • Branches
  • Stack Loads and Stores
  • Heap Loads and Stores
  • Currently not supported due to GC moving objects
  • No method to uniquely identify locations
  • Trace Compaction
  • Function Maps for function names
  • Selector Map maps java type names to type
    identifiers

6
Slicing
  • Read in Byte Code Trace
  • Traverse Byte Code Trace
  • Discover Data Dependencies
  • Add Method Call Control Dependencies
  • Add other Control Dependencies
  • Traverse dependency trace backward to construct
    program slice based on slicing criteria

7
Data Dependency Discovery
  • Create Use Sets
  • Which variables and stack locations are used
  • Create Define Sets
  • Which new variables and stack locations are
    defined
  • Requires Stack Reconstruction

8
Control Dependency
  • Basic Dependencies
  • Method Calls
  • Branch and Loop Dependencies
  • Construct Control Flow Graph statically
  • Export Graphs and Correlate Traced Byte Codes
  • Add Dependencies to Slicing Tool

9
Stack Reconstruction
  • Walk down trace keep track of stack push and pop
    operations
  • Example

.. ISUB INVOKESTATIC ILOAD_1 IFNE ICONST_1 IRET
URN IADD IRETURN .
Stack contents grows from left to right . S6
S13 S51 S58 S65 S6 S13 S51 S58 S66 S6 S13 S51
S58 S66 S67 S6 S13 S51 S58 S66 S6 S13 S51 S58
S66 S68 S6 S13 S51 S58 S66 S6 S13 S51 S69 .
10
Example Hello World
  • public class HelloWorld
  • private static void StartTrace()
  • private static void EndTrace()
  • public static int ourdef(int a, int b)
  • int m a, n b
  • return m n
  • public static int fib(int n)
  • if(n 0) return 1
  • else if(n 1) return 1
  • else return fib(n - 1) fib(n - 2)
  • public static void main(String args)
  • StartTrace()
  • int a,b
  • a 4
  • b 5
  • b a b

11
Example Hello World
  • ..
  • LN 0.44 PC 4 OP 61
    IN ISTORE_2 LV 2
  • LN 0.45 PC 5 OP 8
    IN ICONST_5
  • LN 0.45 PC 6 OP 62
    IN ISTORE_3 LV 3
  • LN 0.46 PC 7 OP 28
    IN ILOAD_2 LV 2
  • LN 0.46 PC 8 OP 29
    IN ILOAD_3 LV 3
  • LN 0.46 PC 9 OP 96
    IN IADD
  • LN 0.46 PC 10 OP 62
    IN ISTORE_3 LV 3
  • LN 0.47 PC 11 OP 28
    IN ILOAD_2 LV 2
  • LN 0.47 PC 12 OP 184
    IN INVOKESTATIC MID 2 AC 1
    RET I FC
  • LN 2.22 PC 0 OP 27
    IN ILOAD_1 LV 1
  • LN 2.22 PC 1 OP 154
    IN IFNE TAR 5
  • LN 2.24 PC 6 OP 27
    IN ILOAD_1 LV 1
  • LN 2.24 PC 7 OP 4
    IN ICONST_1
  • LN 2.24 PC 8 OP 160
    IN IF_ICMPNE TAR 5
  • LN 2.27 PC 13 OP 27
    IN ILOAD_1 LV 1
  • LN 2.27 PC 14 OP 4
    IN ICONST_1
  • public class HelloWorld
  • private static void StartTrace()
  • private static void EndTrace()
  • public static int ourdef(int a, int b)
  • int m a, n b
  • return m n
  • public static int fib(int n)
  • if(n 0) return 1
  • else if(n 1) return 1
  • else return fib(n - 1) fib(n - 2)
  • public static void main(String args)
  • StartTrace()
  • int a,b
  • a 4
  • b 5
  • b a b

12
Example Hello World
  • public class HelloWorld
  • private static void StartTrace()
  • private static void EndTrace()
  • public static int ourdef(int a, int b)
  • int m a, n b
  • return m n
  • public static int fib(int n)
  • if(n 0) return 1
  • else if(n 1) return 1
  • else return fib(n - 1) fib(n - 2)
  • public static void main(String args)
  • StartTrace()
  • int a,b
  • a 4
  • b 5
  • b a b

13
Previous Attempts
  • Static Slicing in OVM
  • Reaching Definition Analysis
  • Points to Analysis
  • Dynamic Slicing in the Interpreter
  • Not easy to modify
  • Byte Code re-writting still required

14
Future Work
  • Multi-threaded programs
  • Trace Context Switch Points
  • Trace Thread Dependencies to create a schedule
  • Handling Heap Variables
  • Need method to track locations
  • Instrument the GC
  • Unique Object Identifiers
  • Object Hash Codes
  • Compacting Traces
  • Grammar based lossless compression techniques
  • Utilize patterns in byte code sequences
Write a Comment
User Comments (0)
About PowerShow.com