Program Slicing Notes

This commit is contained in:
Oliver Kennedy 2019-09-17 00:13:40 -04:00
parent 0eb9801b15
commit 1fe245235c
Signed by: okennedy
GPG key ID: 3E5F9B3ABD3FDB60
2 changed files with 82 additions and 0 deletions

View file

@ -1,5 +1,8 @@
---
title: CSE 662 - Languages and Runtimes for Big Data - Fall 2019
paper_ideas:
- name: Adaptive Functional Programming
url: https://www.cs.cmu.edu/~guyb/papers/popl02.pdf
---

View file

@ -0,0 +1,79 @@
---
title: Program Slicing
supplements:
- name: A Survey of Program Slicing Techniques (Frank Tip)
url: "https://wiki.epfl.ch/provenance2011/documents/10.1.1.93.5469.pdf"
---
- Announcements:
- Progress report Thursday / Talk by Learned Index (45 min + 15 + 15)
- Sept 25 deadline for Checkpoint 1:
- What is the specific challenge that you will solve?
- What metrics will you use to evaluate success?
- What deliverables will you produce?
- What resources have you collected / what have you learned?
- How do you plan to approach the problem?
- Typo in the paper:
- EQN defining B_C^0
- Overview
- Delta query: Come up with a query that computes the difference in results given a change to the output.
- Related: Provenance query: What inputs affected the output
- Program slice: What instructions affected the output.
- Background
- Program
- A sequence of instructions w/ flow patterns (not quite a lattice -- but could be multiple tops)
- View 1: (As Memory) Instructions listed in order
- View 2: (Control Flow Graph) Previous/next instruction (in some possible trace) "Predecessor", "Successor"
- Trace
- A sequence of instructions in execution order
- e.g., State Trajectory in paper: Instructions + Corresponding Input State
- Flow Dependence
- i flows to j if
(i) There is a variable x assigned to by i, and
(ii) x is read from by j, and
(iii) There is *some* path from i to j on which x is not read.
- Post-dominance (Inverse dominator):
- A node i in the CFG is post-dominatedby a node by j if all paths from i to STOP pass through j.
- A node j is control dependent on a node i if
(i) there exists a path P from i to j such that j post-dominates every node in P, excluding i and j, and
(ii) i is not post-dominated by j. <- Q: Because of loops
- Static Slicing:
- Input: A pair (n, V)
- n: A line of the program
- V: a set of variables of interest.
- Output: A (not minimal) subset of the program that can still compute everything in V (assuming deterministic evaluation)
- Use cases:
- Dead Code Elimination
- Highlight Dependent Instructions
- Delta Programs
- Optimization
- Cache/JIT compilation via hotspot prediction
- Lazy evaluation
- Parallel Execution
- Weiser:
- Delete instructions from the program that can not influence the output
- R^0(n): "relevant" variables at a line. Start with V being relevant for the line n, and work backwards through the CFG
- Remove variables on lines that overwrite them
- When a variable is removed, add all variables read by the line.
- S^0: Lines that modify a variable in the line's relevant variable set
- B^0: Lines on which some line in S^0 has a control-dependency
- {R, S, B}^{n>0}: Add the inputs of everything in B^n-1 to the relevant variable set, and then add lines with a dependency.
- Information Flow Relations (Bergeretti & Carre)
- Provenance P10 / Fig 7
- Intraprocedural slicing:
- Figure out which variables the code reads from / writes to.
- Weisers algorithm does not take into accountwhichoutput parameters aredependent onwhichinput parameters is a source of imprecision
- Bergeretti & Carre:
- Dynamic Slicing:
- Input: A triple (x, n, V) and a state trajectory/trace
- x: program input
- n: step in the trajectory/trace
- V: subset of variables of interest
- For each step, look at the dependencies:
- DU: (Statement that used a variable, Last Statement to Modify It)
- TC: (Statement that issues a control predicate, Statement Dependent on it)
- IR: (Statement, Any other occurrence of the same statement in the trace)
- Needed to capture forward dependencies.
- Extend the trace with dependencies in the trace, then map to statements.